Skip to content

Commit 4ae946a

Browse files
krzkherbertx
authored andcommitted
crypto: ccp - Simplify with of_device_get_match_data()
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>
1 parent ec2054c commit 4ae946a

1 file changed

Lines changed: 1 addition & 12 deletions

File tree

drivers/crypto/ccp/sp-platform.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,6 @@ static const struct of_device_id sp_of_match[] = {
5252
};
5353
MODULE_DEVICE_TABLE(of, sp_of_match);
5454

55-
static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev)
56-
{
57-
const struct of_device_id *match;
58-
59-
match = of_match_node(sp_of_match, pdev->dev.of_node);
60-
if (match && match->data)
61-
return (struct sp_dev_vdata *)match->data;
62-
63-
return NULL;
64-
}
65-
6655
static const struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev)
6756
{
6857
const struct acpi_device_id *match;
@@ -123,7 +112,7 @@ static int sp_platform_probe(struct platform_device *pdev)
123112
goto e_err;
124113

125114
sp->dev_specific = sp_platform;
126-
sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev)
115+
sp->dev_vdata = pdev->dev.of_node ? of_device_get_match_data(&pdev->dev)
127116
: sp_get_acpi_version(pdev);
128117
if (!sp->dev_vdata) {
129118
ret = -ENODEV;

0 commit comments

Comments
 (0)