Skip to content

Commit c6c247a

Browse files
krzkherbertx
authored andcommitted
crypto: artpec6 - Simplify with of_device_get_match_data()
Driver's probe function matches against driver's of_device_id table, so of_match_node() can be simplified with of_device_get_match_data(). This requires changing the enum used in the driver match data entries to non-zero, to be able to recognize error case of of_device_get_match_data(). Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Acked-by: Jesper Nilsson <jesper.nilsson@axis.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 6b94eb6 commit c6c247a

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

drivers/crypto/axis/artpec6_crypto.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ struct artpec6_crypto_dma_descriptors {
252252
};
253253

254254
enum artpec6_crypto_variant {
255-
ARTPEC6_CRYPTO,
255+
ARTPEC6_CRYPTO = 1,
256256
ARTPEC7_CRYPTO,
257257
};
258258

@@ -2842,7 +2842,6 @@ MODULE_DEVICE_TABLE(of, artpec6_crypto_of_match);
28422842

28432843
static int artpec6_crypto_probe(struct platform_device *pdev)
28442844
{
2845-
const struct of_device_id *match;
28462845
enum artpec6_crypto_variant variant;
28472846
struct artpec6_crypto *ac;
28482847
struct device *dev = &pdev->dev;
@@ -2853,12 +2852,10 @@ static int artpec6_crypto_probe(struct platform_device *pdev)
28532852
if (artpec6_crypto_dev)
28542853
return -ENODEV;
28552854

2856-
match = of_match_node(artpec6_crypto_of_match, dev->of_node);
2857-
if (!match)
2855+
variant = (enum artpec6_crypto_variant)of_device_get_match_data(dev);
2856+
if (!variant)
28582857
return -EINVAL;
28592858

2860-
variant = (enum artpec6_crypto_variant)match->data;
2861-
28622859
base = devm_platform_ioremap_resource(pdev, 0);
28632860
if (IS_ERR(base))
28642861
return PTR_ERR(base);

0 commit comments

Comments
 (0)