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

Driver core: convert platform_{get,set}_drvdata to static inline functions

This patch converts the macros for platform_{get,set}_drvdata to
static inline functions to add typechecking.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Marc Kleine-Budde and committed by
Greg Kroah-Hartman
71d64290 9194a595

+9 -2
+9 -2
include/linux/platform_device.h
··· 130 130 extern int platform_driver_probe(struct platform_driver *driver, 131 131 int (*probe)(struct platform_device *)); 132 132 133 - #define platform_get_drvdata(_dev) dev_get_drvdata(&(_dev)->dev) 134 - #define platform_set_drvdata(_dev,data) dev_set_drvdata(&(_dev)->dev, (data)) 133 + static inline void *platform_get_drvdata(const struct platform_device *pdev) 134 + { 135 + return dev_get_drvdata(&pdev->dev); 136 + } 137 + 138 + static inline void platform_set_drvdata(struct platform_device *pdev, void *data) 139 + { 140 + dev_set_drvdata(&pdev->dev, data); 141 + } 135 142 136 143 extern struct platform_device *platform_create_bundle(struct platform_driver *driver, 137 144 int (*probe)(struct platform_device *),