Skip to content

Commit ec2054c

Browse files
krzkherbertx
authored andcommitted
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>
1 parent c6c247a commit ec2054c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

drivers/crypto/ccp/sp-dev.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ struct sp_device {
9595

9696
struct device *dev;
9797

98-
struct sp_dev_vdata *dev_vdata;
98+
const struct sp_dev_vdata *dev_vdata;
9999
unsigned int ord;
100100
char name[SP_MAX_NAME_LEN];
101101

drivers/crypto/ccp/sp-platform.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev)
6363
return NULL;
6464
}
6565

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)
6767
{
6868
const struct acpi_device_id *match;
6969

7070
match = acpi_match_device(sp_acpi_match, &pdev->dev);
7171
if (match && match->driver_data)
72-
return (struct sp_dev_vdata *)match->driver_data;
72+
return (const struct sp_dev_vdata *)match->driver_data;
7373

7474
return NULL;
7575
}

0 commit comments

Comments
 (0)