Skip to content

Commit

Permalink
mfd: core: Make platform_data pointer const in struct mfd_cell
Browse files Browse the repository at this point in the history
The content of the platform_data of a struct mfd_cell is simply passed on
to the platform_device_add_data() call in mfd_add_device() .

platform_device_add_data() already handles the data behind that pointer
as const and also uses kmemdup to create a copy of the data before
handing that copy over to the newly created platform-device,
so there is no reason to not extend this to struct mfd_cell, as the old
copy in the mfd_cell will be stale anyway.

This allows to pass structs gathered from of_device_get_match_data()
as platform-data to sub-devices - which is retrieved as const already.

Signed-off-by: Heiko Stuebner <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Lee Jones <[email protected]>
  • Loading branch information
mmind authored and lag-linaro committed Dec 17, 2024
1 parent 8a5b38c commit fa52c04
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/linux/mfd/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ struct mfd_cell {
int (*resume)(struct platform_device *dev);

/* platform data passed to the sub devices drivers */
void *platform_data;
const void *platform_data;
size_t pdata_size;

/* Matches ACPI */
Expand Down

0 comments on commit fa52c04

Please sign in to comment.