linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall
@ 2016-04-06 13:49 Javier Martinez Canillas
  2016-04-06 13:49 ` [PATCH 2/2] regulator: max77686: " Javier Martinez Canillas
  2016-04-07 12:30 ` [PATCH 1/2] regulator: s2mps11: " Krzysztof Kozlowski
  0 siblings, 2 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-04-06 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, linux-samsung-soc, Krzysztof Kozlowski,
	Sangbeom Kim, Mark Brown, Liam Girdwood

The driver's init and exit function don't do anything besides registering
and unregistering the platform driver, so the module_platform_driver()
macro could just be used instead of having separate functions.

Currently the macro is not being used because the driver is initialized at
subsys init call level but this isn't necessary since consumer devices are
defined in the DT as dependencies so there's no need for init calls order.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---
This patch was tested on an Exynos5422 Odroid XU4 board.

 drivers/regulator/s2mps11.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/regulator/s2mps11.c b/drivers/regulator/s2mps11.c
index 6dfa3502e1f1..64a262f10845 100644
--- a/drivers/regulator/s2mps11.c
+++ b/drivers/regulator/s2mps11.c
@@ -1237,17 +1237,7 @@ static struct platform_driver s2mps11_pmic_driver = {
 	.id_table = s2mps11_pmic_id,
 };
 
-static int __init s2mps11_pmic_init(void)
-{
-	return platform_driver_register(&s2mps11_pmic_driver);
-}
-subsys_initcall(s2mps11_pmic_init);
-
-static void __exit s2mps11_pmic_exit(void)
-{
-	platform_driver_unregister(&s2mps11_pmic_driver);
-}
-module_exit(s2mps11_pmic_exit);
+module_platform_driver(s2mps11_pmic_driver);
 
 /* Module information */
 MODULE_AUTHOR("Sangbeom Kim <sbkim73@samsung.com>");
-- 
2.5.0

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

* [PATCH 2/2] regulator: max77686: Use module_platform_driver() instead subsys initcall
  2016-04-06 13:49 [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall Javier Martinez Canillas
@ 2016-04-06 13:49 ` Javier Martinez Canillas
  2016-04-07 12:30 ` [PATCH 1/2] regulator: s2mps11: " Krzysztof Kozlowski
  1 sibling, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-04-06 13:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Javier Martinez Canillas, Liam Girdwood, Krzysztof Kozlowski,
	Chanwoo Choi, Mark Brown

The driver's init and exit function don't do anything besides registering
and unregistering the platform driver, so the module_platform_driver()
macro could just be used instead of having separate functions.

Currently the macro is not being used because the driver is initialized at
subsys init call level but this isn't necessary since consumer devices are
defined in the DT as dependencies so there's no need for init calls order.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>

---
This patch was tested on an Exynos5250 Snow Chromebook.

 drivers/regulator/max77686-regulator.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c
index 17ccf365a9c0..d1ab6a4da88f 100644
--- a/drivers/regulator/max77686-regulator.c
+++ b/drivers/regulator/max77686-regulator.c
@@ -553,17 +553,7 @@ static struct platform_driver max77686_pmic_driver = {
 	.id_table = max77686_pmic_id,
 };
 
-static int __init max77686_pmic_init(void)
-{
-	return platform_driver_register(&max77686_pmic_driver);
-}
-subsys_initcall(max77686_pmic_init);
-
-static void __exit max77686_pmic_cleanup(void)
-{
-	platform_driver_unregister(&max77686_pmic_driver);
-}
-module_exit(max77686_pmic_cleanup);
+module_platform_driver(max77686_pmic_driver);
 
 MODULE_DESCRIPTION("MAXIM 77686 Regulator Driver");
 MODULE_AUTHOR("Chiwoong Byun <woong.byun@samsung.com>");
-- 
2.5.0

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

* Re: [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall
  2016-04-06 13:49 [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall Javier Martinez Canillas
  2016-04-06 13:49 ` [PATCH 2/2] regulator: max77686: " Javier Martinez Canillas
@ 2016-04-07 12:30 ` Krzysztof Kozlowski
  2016-04-07 18:16   ` Javier Martinez Canillas
  1 sibling, 1 reply; 5+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-07 12:30 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: linux-kernel, linux-samsung-soc, Krzysztof Kozlowski,
	Sangbeom Kim, Mark Brown, Liam Girdwood

On Wed, Apr 06, 2016 at 09:49:46AM -0400, Javier Martinez Canillas wrote:
> The driver's init and exit function don't do anything besides registering
> and unregistering the platform driver, so the module_platform_driver()
> macro could just be used instead of having separate functions.
> 
> Currently the macro is not being used because the driver is initialized at
> subsys init call level but this isn't necessary since consumer devices are
> defined in the DT as dependencies so there's no need for init calls order.
> 
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> 
> ---
> This patch was tested on an Exynos5422 Odroid XU4 board.

This test might not be sufficient. XU4 is not a mobile device like many
other users of this driver (except Arndale Octa and Artiks all of other
users are mobiles/wearables).

For example XU4 does not have USB OTG (like other devices and like XU3).

Best regards,
Krzysztof

> 
>  drivers/regulator/s2mps11.c | 12 +-----------
>  1 file changed, 1 insertion(+), 11 deletions(-)
> 

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

* Re: [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall
  2016-04-07 12:30 ` [PATCH 1/2] regulator: s2mps11: " Krzysztof Kozlowski
@ 2016-04-07 18:16   ` Javier Martinez Canillas
  2016-04-08  3:55     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-04-07 18:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: linux-kernel, linux-samsung-soc, Sangbeom Kim, Mark Brown, Liam Girdwood

Hello Krzysztof,

On 04/07/2016 08:30 AM, Krzysztof Kozlowski wrote:
> On Wed, Apr 06, 2016 at 09:49:46AM -0400, Javier Martinez Canillas wrote:
>> The driver's init and exit function don't do anything besides registering
>> and unregistering the platform driver, so the module_platform_driver()
>> macro could just be used instead of having separate functions.
>>
>> Currently the macro is not being used because the driver is initialized at
>> subsys init call level but this isn't necessary since consumer devices are
>> defined in the DT as dependencies so there's no need for init calls order.
>>
>> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
>>
>> ---
>> This patch was tested on an Exynos5422 Odroid XU4 board.
> 
> This test might not be sufficient. XU4 is not a mobile device like many
> other users of this driver (except Arndale Octa and Artiks all of other
> users are mobiles/wearables).
> 
> For example XU4 does not have USB OTG (like other devices and like XU3).
>

All the consumer device nodes for these regulators are defined in the
exynos5422-odroidxu3-common.dtsi that is shared by all the Odroid XU*
so I thought testing in the XU4 was as good as testing in the XU3
(since the USB OTG doesn't use a regulator from this PMIC).

I've also checked the DTS for all the boards that use regulators that
are registered by this driver and all consumer drivers supports probe
deferral so I think this change is safe.

Also, the driver Kconfig symbol is tristate already so the driver can be
built as module and the init func won't be executed at subsys init call.
 
> Best regards,
> Krzysztof
> 
>>
>>  drivers/regulator/s2mps11.c | 12 +-----------
>>  1 file changed, 1 insertion(+), 11 deletions(-)
>>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

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

* Re: [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall
  2016-04-07 18:16   ` Javier Martinez Canillas
@ 2016-04-08  3:55     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Kozlowski @ 2016-04-08  3:55 UTC (permalink / raw)
  To: Javier Martinez Canillas
  Cc: Krzysztof Kozlowski, linux-kernel, linux-samsung-soc,
	Sangbeom Kim, Mark Brown, Liam Girdwood

On Thu, Apr 07, 2016 at 02:16:29PM -0400, Javier Martinez Canillas wrote:
> Hello Krzysztof,
> 
> On 04/07/2016 08:30 AM, Krzysztof Kozlowski wrote:
> > On Wed, Apr 06, 2016 at 09:49:46AM -0400, Javier Martinez Canillas wrote:
> >> The driver's init and exit function don't do anything besides registering
> >> and unregistering the platform driver, so the module_platform_driver()
> >> macro could just be used instead of having separate functions.
> >>
> >> Currently the macro is not being used because the driver is initialized at
> >> subsys init call level but this isn't necessary since consumer devices are
> >> defined in the DT as dependencies so there's no need for init calls order.
> >>
> >> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> >>
> >> ---
> >> This patch was tested on an Exynos5422 Odroid XU4 board.
> > 
> > This test might not be sufficient. XU4 is not a mobile device like many
> > other users of this driver (except Arndale Octa and Artiks all of other
> > users are mobiles/wearables).
> > 
> > For example XU4 does not have USB OTG (like other devices and like XU3).
> >
> 
> All the consumer device nodes for these regulators are defined in the
> exynos5422-odroidxu3-common.dtsi that is shared by all the Odroid XU*
> so I thought testing in the XU4 was as good as testing in the XU3
> (since the USB OTG doesn't use a regulator from this PMIC).
> 
> I've also checked the DTS for all the boards that use regulators that
> are registered by this driver and all consumer drivers supports probe
> deferral so I think this change is safe.

Ah, seems fine then! Thanks for checking.

Best regards,
Krzysztof

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

end of thread, other threads:[~2016-04-08  3:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-06 13:49 [PATCH 1/2] regulator: s2mps11: Use module_platform_driver() instead subsys initcall Javier Martinez Canillas
2016-04-06 13:49 ` [PATCH 2/2] regulator: max77686: " Javier Martinez Canillas
2016-04-07 12:30 ` [PATCH 1/2] regulator: s2mps11: " Krzysztof Kozlowski
2016-04-07 18:16   ` Javier Martinez Canillas
2016-04-08  3:55     ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).