platform: add two helpers for early_platform code
cover platform: add two helpers for early_platform code
From: Bartosz Golaszewski <[email protected]>
I'm using the early_platform infrastructure for converting the davinci timer support to a real platform_driver. I noticed that it would be nice to have these two helpers for more code brevity.
Bartosz Golaszewski (2):
platform: provide early_platform_add_device()
platform: provide early_platform_driver_register_probe_all()
include/linux/platform_device.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
Signature · 1 line
2.17.0
PATCH 1/2 platform: provide early_platform_add_device()
From: Bartosz Golaszewski <[email protected]>
Currently we only have early_platform_add_devices() which takes struct platform_device ** as argument, requiring the users to have an intermediate array of platform_device pointers even if we're only adding a single device. Provide a helper for adding a single device at a time.
--- include/linux/platform_device.h | 5 +++++ 1 file changed, 5 insertions(+)
include/linux/platform_device.h +5 -0
@@ -301,6 +301,11 @@ extern int early_platform_driver_register(struct early_platform_driver *epdrv, char *buf);extern void early_platform_add_devices (struct platform_device **devs,int num); +static inline void early_platform_add_device (struct platform_device *pdev) +{ +early_platform_add_devices (&pdev,1 ); +} +static inline int is_early_platform_device (struct platform_device *pdev) {return !pdev->dev.driver;
Signature · 1 line
2.17.0
Re: [PATCH 1/2] platform: provide early_platform_add_device()
Quoted 9 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
Currently we only have
early_platform_add_devices()which takes structplatform_device** as argument, requiring the users to have an intermediate array ofplatform_devicepointers even if we're only adding a single device. Provide a helper for adding a single device at a time.Signed-off-by Bartosz Golaszewski <[email protected]>
Feel free to take these with your driver cleanups:
PATCH 2/2 platform: provide early_platform_driver_register_probe_all()
In reply to Bartosz GolaszewskiFrom: Bartosz Golaszewski <[email protected]>
All users of early_platform_driver_register_all() subsequently call early_platform_driver_probe(). Provide a helper that calls both functions.
--- include/linux/platform_device.h | 9 +++++++++ 1 file changed, 9 insertions(+)
include/linux/platform_device.h +9 -0
@@ -314,6 +314,15 @@ static inline int is_early_platform_device(struct platform_device *pdev)extern void early_platform_driver_register_all (char *class_str);extern int early_platform_driver_probe (char *class_str,int nr_probe,int user_only); + +static inline int early_platform_driver_register_probe_all (char *class_str, +int nr_probe, +int user_only) +{ +early_platform_driver_register_all (class_str); +return early_platform_driver_probe (class_str, nr_probe, user_only); +} +extern void early_platform_cleanup (void );#define early_platform_init (class_string, platdrv) \
Signature · 1 line
2.17.0
Re: [PATCH 2/2] platform: provide early_platform_driver_register_probe_all()
Quoted 7 lines · Bartosz Golaszewski
From: Bartosz Golaszewski <[email protected]>
All users of
early_platform_driver_register_all()subsequently callearly_platform_driver_probe(). Provide a helper that calls both functions.Signed-off-by Bartosz Golaszewski <[email protected]>