]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: ccp - Simplify with of_device_get_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 7 Nov 2025 08:15:52 +0000 (09:15 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Nov 2025 10:15:49 +0000 (18:15 +0800)
Driver's probe function matches against driver's of_device_id table,
where each entry has non-NULL match data, so of_match_node() can be
simplified with of_device_get_match_data().

Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/sp-platform.c

index de8a8183efdb4c63fcddb3dad63f8c964bb850bd..3f9843fa77827c9be17b26d8a5e4d2fd2c5e4ec1 100644 (file)
@@ -52,17 +52,6 @@ static const struct of_device_id sp_of_match[] = {
 };
 MODULE_DEVICE_TABLE(of, sp_of_match);
 
-static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev)
-{
-       const struct of_device_id *match;
-
-       match = of_match_node(sp_of_match, pdev->dev.of_node);
-       if (match && match->data)
-               return (struct sp_dev_vdata *)match->data;
-
-       return NULL;
-}
-
 static const struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev)
 {
        const struct acpi_device_id *match;
@@ -123,7 +112,7 @@ static int sp_platform_probe(struct platform_device *pdev)
                goto e_err;
 
        sp->dev_specific = sp_platform;
-       sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev)
+       sp->dev_vdata = pdev->dev.of_node ? of_device_get_match_data(&pdev->dev)
                                         : sp_get_acpi_version(pdev);
        if (!sp->dev_vdata) {
                ret = -ENODEV;