]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: artpec6 - Simplify with of_device_get_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 7 Nov 2025 08:15:50 +0000 (09:15 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Nov 2025 10:15:48 +0000 (18:15 +0800)
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>
drivers/crypto/axis/artpec6_crypto.c

index 75ee065da1ec3156ab42630321a848c705116da5..b04d6379244ae8b25a3770ac60d846f09ec59e2b 100644 (file)
@@ -252,7 +252,7 @@ struct artpec6_crypto_dma_descriptors {
 };
 
 enum artpec6_crypto_variant {
-       ARTPEC6_CRYPTO,
+       ARTPEC6_CRYPTO = 1,
        ARTPEC7_CRYPTO,
 };
 
@@ -2842,7 +2842,6 @@ MODULE_DEVICE_TABLE(of, artpec6_crypto_of_match);
 
 static int artpec6_crypto_probe(struct platform_device *pdev)
 {
-       const struct of_device_id *match;
        enum artpec6_crypto_variant variant;
        struct artpec6_crypto *ac;
        struct device *dev = &pdev->dev;
@@ -2853,12 +2852,10 @@ static int artpec6_crypto_probe(struct platform_device *pdev)
        if (artpec6_crypto_dev)
                return -ENODEV;
 
-       match = of_match_node(artpec6_crypto_of_match, dev->of_node);
-       if (!match)
+       variant = (enum artpec6_crypto_variant)of_device_get_match_data(dev);
+       if (!variant)
                return -EINVAL;
 
-       variant = (enum artpec6_crypto_variant)match->data;
-
        base = devm_platform_ioremap_resource(pdev, 0);
        if (IS_ERR(base))
                return PTR_ERR(base);