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

crypto: ccp - Constify 'dev_vdata' member

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>

authored by

Krzysztof Kozlowski and committed by
Herbert Xu
ec2054c1 c6c247ae

+3 -3
+1 -1
drivers/crypto/ccp/sp-dev.h
··· 95 95 96 96 struct device *dev; 97 97 98 - struct sp_dev_vdata *dev_vdata; 98 + const struct sp_dev_vdata *dev_vdata; 99 99 unsigned int ord; 100 100 char name[SP_MAX_NAME_LEN]; 101 101
+2 -2
drivers/crypto/ccp/sp-platform.c
··· 63 63 return NULL; 64 64 } 65 65 66 - static struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev) 66 + static const struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev) 67 67 { 68 68 const struct acpi_device_id *match; 69 69 70 70 match = acpi_match_device(sp_acpi_match, &pdev->dev); 71 71 if (match && match->driver_data) 72 - return (struct sp_dev_vdata *)match->driver_data; 72 + return (const struct sp_dev_vdata *)match->driver_data; 73 73 74 74 return NULL; 75 75 }