All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] platform: add two helpers for early_platform code
@ 2018-04-20 16:39 Bartosz Golaszewski
  2018-04-20 16:39 ` [PATCH 1/2] platform: provide early_platform_add_device() Bartosz Golaszewski
  2018-04-20 16:39 ` [PATCH 2/2] platform: provide early_platform_driver_register_probe_all() Bartosz Golaszewski
  0 siblings, 2 replies; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-20 16:39 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Jan Kiszka, Andy Shevchenko
  Cc: linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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(+)

-- 
2.17.0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] platform: provide early_platform_add_device()
  2018-04-20 16:39 [PATCH 0/2] platform: add two helpers for early_platform code Bartosz Golaszewski
@ 2018-04-20 16:39 ` Bartosz Golaszewski
  2018-04-23 12:03   ` Greg Kroah-Hartman
  2018-04-20 16:39 ` [PATCH 2/2] platform: provide early_platform_driver_register_probe_all() Bartosz Golaszewski
  1 sibling, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-20 16:39 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Jan Kiszka, Andy Shevchenko
  Cc: linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

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.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 include/linux/platform_device.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 49f634d96118..80942ed0f728 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -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;
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] platform: provide early_platform_driver_register_probe_all()
  2018-04-20 16:39 [PATCH 0/2] platform: add two helpers for early_platform code Bartosz Golaszewski
  2018-04-20 16:39 ` [PATCH 1/2] platform: provide early_platform_add_device() Bartosz Golaszewski
@ 2018-04-20 16:39 ` Bartosz Golaszewski
  2018-04-23 12:03   ` Greg Kroah-Hartman
  1 sibling, 1 reply; 5+ messages in thread
From: Bartosz Golaszewski @ 2018-04-20 16:39 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Jan Kiszka, Andy Shevchenko
  Cc: linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bgolaszewski@baylibre.com>

All users of early_platform_driver_register_all() subsequently call
early_platform_driver_probe(). Provide a helper that calls both
functions.

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 include/linux/platform_device.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 80942ed0f728..a06b194ba30b 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -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)		\
-- 
2.17.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] platform: provide early_platform_add_device()
  2018-04-20 16:39 ` [PATCH 1/2] platform: provide early_platform_add_device() Bartosz Golaszewski
@ 2018-04-23 12:03   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-04-23 12:03 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Arnd Bergmann, Jan Kiszka, Andy Shevchenko, linux-kernel,
	Bartosz Golaszewski

On Fri, Apr 20, 2018 at 06:39:23PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> 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.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Feel free to take these with your driver cleanups:

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] platform: provide early_platform_driver_register_probe_all()
  2018-04-20 16:39 ` [PATCH 2/2] platform: provide early_platform_driver_register_probe_all() Bartosz Golaszewski
@ 2018-04-23 12:03   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-04-23 12:03 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Arnd Bergmann, Jan Kiszka, Andy Shevchenko, linux-kernel,
	Bartosz Golaszewski

On Fri, Apr 20, 2018 at 06:39:24PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
> 
> All users of early_platform_driver_register_all() subsequently call
> early_platform_driver_probe(). Provide a helper that calls both
> functions.
> 
> Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-04-23 12:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-20 16:39 [PATCH 0/2] platform: add two helpers for early_platform code Bartosz Golaszewski
2018-04-20 16:39 ` [PATCH 1/2] platform: provide early_platform_add_device() Bartosz Golaszewski
2018-04-23 12:03   ` Greg Kroah-Hartman
2018-04-20 16:39 ` [PATCH 2/2] platform: provide early_platform_driver_register_probe_all() Bartosz Golaszewski
2018-04-23 12:03   ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.