]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
crypto: ccp - Constify 'dev_vdata' member
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Fri, 7 Nov 2025 08:15:51 +0000 (09:15 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 14 Nov 2025 10:15:48 +0000 (18:15 +0800)
sp_device->dev_vdata points to only const data (see 'static const struct
sp_dev_vdata dev_vdata'), so can be made pointer to const for code
safety.

Update also sp_get_acpi_version() function which returns this pointer to
'pointer to const' for code readability, even though it is not needed.

On the other hand, do not touch similar function sp_get_of_version()
because it will be immediately removed in next patches.

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-dev.h
drivers/crypto/ccp/sp-platform.c

index 6f9d7063257d70c7f836c99b4a3bf036d6b7057f..1335a83fe052ea90c0e998a3fee1a8ccc87f5a9a 100644 (file)
@@ -95,7 +95,7 @@ struct sp_device {
 
        struct device *dev;
 
-       struct sp_dev_vdata *dev_vdata;
+       const struct sp_dev_vdata *dev_vdata;
        unsigned int ord;
        char name[SP_MAX_NAME_LEN];
 
index 3933cac1694d4e15a799b522055d1f48a91283fc..de8a8183efdb4c63fcddb3dad63f8c964bb850bd 100644 (file)
@@ -63,13 +63,13 @@ static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev)
        return NULL;
 }
 
-static struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev)
+static const struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev)
 {
        const struct acpi_device_id *match;
 
        match = acpi_match_device(sp_acpi_match, &pdev->dev);
        if (match && match->driver_data)
-               return (struct sp_dev_vdata *)match->driver_data;
+               return (const struct sp_dev_vdata *)match->driver_data;
 
        return NULL;
 }