From: Suman Anna <s-anna@ti.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>
Cc: Deepak Saxena <dsaxena@plexity.net>,
Tero Kristo <kristo@kernel.org>, Keerthy <j-keerthy@ti.com>,
Gowtham Tammana <g-tammana@ti.com>,
Vaibhav Gupta <v_gupta@ti.com>, <linux-crypto@vger.kernel.org>,
<linux-kernel@vger.kernel.org>, Suman Anna <s-anna@ti.com>
Subject: [PATCH 4/6] crypto: sa2ul - Use of_device_get_match_data() helper
Date: Fri, 14 May 2021 11:12:44 -0500 [thread overview]
Message-ID: <20210514161246.22517-5-s-anna@ti.com> (raw)
In-Reply-To: <20210514161246.22517-1-s-anna@ti.com>
Simplify the probe function by using the of_device_get_match_data()
helper instead of open coding. The logic is also moved up to fix the
missing pm_runtime cleanup in case of a match failure.
Fixes: 0bc42311cdff ("crypto: sa2ul - Add support for AM64")
Signed-off-by: Suman Anna <s-anna@ti.com>
---
drivers/crypto/sa2ul.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/crypto/sa2ul.c b/drivers/crypto/sa2ul.c
index a215daedf78a..9f077ec9dbb7 100644
--- a/drivers/crypto/sa2ul.c
+++ b/drivers/crypto/sa2ul.c
@@ -2388,7 +2388,6 @@ MODULE_DEVICE_TABLE(of, of_match);
static int sa_ul_probe(struct platform_device *pdev)
{
- const struct of_device_id *match;
struct device *dev = &pdev->dev;
struct device_node *node = dev->of_node;
struct resource *res;
@@ -2400,6 +2399,10 @@ static int sa_ul_probe(struct platform_device *pdev)
if (!dev_data)
return -ENOMEM;
+ dev_data->match_data = of_device_get_match_data(dev);
+ if (!dev_data->match_data)
+ return -ENODEV;
+
sa_k3_dev = dev;
dev_data->dev = dev;
dev_data->pdev = pdev;
@@ -2420,13 +2423,6 @@ static int sa_ul_probe(struct platform_device *pdev)
if (ret)
goto destroy_dma_pool;
- match = of_match_node(of_match, dev->of_node);
- if (!match) {
- dev_err(dev, "No compatible match found\n");
- return -ENODEV;
- }
- dev_data->match_data = match->data;
-
spin_lock_init(&dev_data->scid_lock);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
saul_base = devm_ioremap_resource(dev, res);
--
2.30.1
next prev parent reply other threads:[~2021-05-14 16:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-14 16:12 [PATCH 0/6] Misc. SA2UL fixes/cleanups Suman Anna
2021-05-14 16:12 ` [PATCH 1/6] hwrng: omap - Enable driver for TI K3 family Suman Anna
2021-05-14 16:12 ` [PATCH 2/6] crypto: sa2ul - Fix leaks on failure paths with sa_dma_init() Suman Anna
2021-05-14 16:12 ` [PATCH 3/6] crypto: sa2ul - Fix pm_runtime enable in sa_ul_probe() Suman Anna
2021-05-14 16:12 ` Suman Anna [this message]
2021-05-14 16:12 ` [PATCH 5/6] crypto: sa2ul - Use devm_platform_ioremap_resource() Suman Anna
2021-05-14 16:12 ` [PATCH 6/6] crypto: sa2ul - Remove child devices in remove Suman Anna
2021-05-17 6:09 ` [PATCH 0/6] Misc. SA2UL fixes/cleanups Tero Kristo
2021-05-21 8:23 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210514161246.22517-5-s-anna@ti.com \
--to=s-anna@ti.com \
--cc=davem@davemloft.net \
--cc=dsaxena@plexity.net \
--cc=g-tammana@ti.com \
--cc=herbert@gondor.apana.org.au \
--cc=j-keerthy@ti.com \
--cc=kristo@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=v_gupta@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®