Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Krzysztof Kozlowski and committed by
Herbert Xu
c6c247ae 6b94eb68

+3 -6
+3 -6
drivers/crypto/axis/artpec6_crypto.c
··· 252 252 }; 253 253 254 254 enum artpec6_crypto_variant { 255 - ARTPEC6_CRYPTO, 255 + ARTPEC6_CRYPTO = 1, 256 256 ARTPEC7_CRYPTO, 257 257 }; 258 258 ··· 2842 2842 2843 2843 static int artpec6_crypto_probe(struct platform_device *pdev) 2844 2844 { 2845 - const struct of_device_id *match; 2846 2845 enum artpec6_crypto_variant variant; 2847 2846 struct artpec6_crypto *ac; 2848 2847 struct device *dev = &pdev->dev; ··· 2852 2853 if (artpec6_crypto_dev) 2853 2854 return -ENODEV; 2854 2855 2855 - match = of_match_node(artpec6_crypto_of_match, dev->of_node); 2856 - if (!match) 2856 + variant = (enum artpec6_crypto_variant)of_device_get_match_data(dev); 2857 + if (!variant) 2857 2858 return -EINVAL; 2858 - 2859 - variant = (enum artpec6_crypto_variant)match->data; 2860 2859 2861 2860 base = devm_platform_ioremap_resource(pdev, 0); 2862 2861 if (IS_ERR(base))