mfd: core: make platform_data pointer const in struct

A patch from »Drivers to support the MCU on QNAP NAS devices« in state Mainline for linux-kernel

From: Heiko Stuebner <heiko@...> Date: Thu, 5 Sep 2024 14:04:29 +0200

Commit-Message

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 <heiko@...>

Patch-Comment

include/linux/mfd/core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)

Statistics

  • 1 lines added
  • 1 lines removed

Changes

--------------------------- include/linux/mfd/core.h ---------------------------
index e8bcad641d8c..faeea7abd688 100644
@@ -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 */
 
 

Recent Patches

About Us

Sed lacus. Donec lectus. Nullam pretium nibh ut turpis. Nam bibendum. In nulla tortor, elementum vel, tempor at, varius non, purus. Mauris vitae nisl nec metus placerat consectetuer.

Read More...