All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
@ 2014-09-29 10:31 He YunLei
  2014-09-29 17:54 ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: He YunLei @ 2014-09-29 10:31 UTC (permalink / raw)
  To: linux-kernel
  Cc: grant.likely, robh+dt, wangbintian, tony, liguozhu, kong.kongxinwei

On our arm platform, some modules (e.g. I2C bus driver) will use the 
pinctrl-single driver to configure the SoC pin, but pinctrl-single 
driver uses module_init time, that makes some modules initialize ahead 
the pinctrl-single and fail to register.

This patch promotes the initialization priority of pinctrl-single from 
module_init time to arch_initcall time.


Signed-off-by: Yunlei He <heyunlei@huawei.com>
Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com>
---
  drivers/pinctrl/pinctrl-single.c |   13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/pinctrl-single.c 
b/drivers/pinctrl/pinctrl-single.c
index 95dd9cf..4b9e5b9 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -2012,7 +2012,18 @@ static struct platform_driver pcs_driver = {
  #endif
  };

-module_platform_driver(pcs_driver);
+static int __init pinctrl_single_init(void)
+{
+		return platform_driver_register(&pcs_driver);
+}
+
+static void __exit pinctrl_single_exit(void)
+{
+		platform_driver_unregister(&pcs_driver);
+}
+
+arch_initcall(pinctrl_single_init);
+module_exit(pinctrl_single_exit);

  MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
  MODULE_DESCRIPTION("One-register-per-pin type device tree based 
pinctrl driver");
-- 
1.7.9.5


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

* Re: [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
  2014-09-29 10:31 [RFC PATCH] pinctrl: pinctrl-single.c: init pinctrl single at arch_initcall time He YunLei
@ 2014-09-29 17:54 ` Tony Lindgren
  2014-10-08  1:42   ` He YunLei
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2014-09-29 17:54 UTC (permalink / raw)
  To: He YunLei
  Cc: linux-kernel, grant.likely, robh+dt, wangbintian, liguozhu,
	kong.kongxinwei

* He YunLei <heyunlei@huawei.com> [140929 03:32]:
> On our arm platform, some modules (e.g. I2C bus driver) will use the
> pinctrl-single driver to configure the SoC pin, but pinctrl-single driver
> uses module_init time, that makes some modules initialize ahead the
> pinctrl-single and fail to register.
> 
> This patch promotes the initialization priority of pinctrl-single from
> module_init time to arch_initcall time.

This has come up earlier and so far in all cases the problem
is that you have custom initcall levels for your other drivers.

Get rid of custom initcall levels for your drivers and the
problem goes away. There's no need to init the drivers earlier
nowadays. If you have other dependencies then deferred probe
helps but should be only needed for a limited number of cases.

We want to initialize things later, not earlier in general. That
removes the issues of no proper debug output while booting the
kernel.

Regards,

Tony

 
> Signed-off-by: Yunlei He <heyunlei@huawei.com>
> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com>
> ---
>  drivers/pinctrl/pinctrl-single.c |   13 ++++++++++++-
>  1 file changed, 12 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-single.c
> b/drivers/pinctrl/pinctrl-single.c
> index 95dd9cf..4b9e5b9 100644
> --- a/drivers/pinctrl/pinctrl-single.c
> +++ b/drivers/pinctrl/pinctrl-single.c
> @@ -2012,7 +2012,18 @@ static struct platform_driver pcs_driver = {
>  #endif
>  };
> 
> -module_platform_driver(pcs_driver);
> +static int __init pinctrl_single_init(void)
> +{
> +		return platform_driver_register(&pcs_driver);
> +}
> +
> +static void __exit pinctrl_single_exit(void)
> +{
> +		platform_driver_unregister(&pcs_driver);
> +}
> +
> +arch_initcall(pinctrl_single_init);
> +module_exit(pinctrl_single_exit);
> 
>  MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
>  MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl
> driver");
> -- 
> 1.7.9.5
> 

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

* Re: [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
  2014-09-29 17:54 ` Tony Lindgren
@ 2014-10-08  1:42   ` He YunLei
  2014-10-08 18:10     ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: He YunLei @ 2014-10-08  1:42 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-kernel, grant.likely, robh+dt, wangbintian, liguozhu,
	kong.kongxinwei

On 2014/9/30 1:54, Tony Lindgren wrote:
> * He YunLei <heyunlei@huawei.com> [140929 03:32]:
>> On our arm platform, some modules (e.g. I2C bus driver) will use the
>> pinctrl-single driver to configure the SoC pin, but pinctrl-single driver
>> uses module_init time, that makes some modules initialize ahead the
>> pinctrl-single and fail to register.
>>
>> This patch promotes the initialization priority of pinctrl-single from
>> module_init time to arch_initcall time.
>
> This has come up earlier and so far in all cases the problem
> is that you have custom initcall levels for your other drivers.
>
> Get rid of custom initcall levels for your drivers and the
> problem goes away. There's no need to init the drivers earlier
> nowadays. If you have other dependencies then deferred probe
> helps but should be only needed for a limited number of cases.
>
> We want to initialize things later, not earlier in general. That
> removes the issues of no proper debug output while booting the
> kernel.
>
> Regards,
>
> Tony
>
>
>> Signed-off-by: Yunlei He <heyunlei@huawei.com>
>> Signed-off-by: Xinwei Kong <kong.kongxinwei@hisilicon.com>
>> ---
>>   drivers/pinctrl/pinctrl-single.c |   13 ++++++++++++-
>>   1 file changed, 12 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/pinctrl/pinctrl-single.c
>> b/drivers/pinctrl/pinctrl-single.c
>> index 95dd9cf..4b9e5b9 100644
>> --- a/drivers/pinctrl/pinctrl-single.c
>> +++ b/drivers/pinctrl/pinctrl-single.c
>> @@ -2012,7 +2012,18 @@ static struct platform_driver pcs_driver = {
>>   #endif
>>   };
>>
>> -module_platform_driver(pcs_driver);
>> +static int __init pinctrl_single_init(void)
>> +{
>> +		return platform_driver_register(&pcs_driver);
>> +}
>> +
>> +static void __exit pinctrl_single_exit(void)
>> +{
>> +		platform_driver_unregister(&pcs_driver);
>> +}
>> +
>> +arch_initcall(pinctrl_single_init);
>> +module_exit(pinctrl_single_exit);
>>
>>   MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>");
>>   MODULE_DESCRIPTION("One-register-per-pin type device tree based pinctrl
>> driver");
>> --
>> 1.7.9.5
>>
>
> .
>

Thanks for your review and I am really appreciated it, but in our arm 
platform, we haven't custom initcall levels for other drivers. Although 
deferred probe helps other drivers to register well, we are also 
confused for the issues of lots of pin request errors debug output while 
booting the kernel. Besides, if the number is bigger than the limited 
number, whether deferred probe can solve this problem.

Regards,
He YunLei


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

* Re: [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
  2014-10-08  1:42   ` He YunLei
@ 2014-10-08 18:10     ` Tony Lindgren
  2014-10-11  9:01       ` He YunLei
  0 siblings, 1 reply; 6+ messages in thread
From: Tony Lindgren @ 2014-10-08 18:10 UTC (permalink / raw)
  To: He YunLei
  Cc: linux-kernel, grant.likely, robh+dt, wangbintian, liguozhu,
	kong.kongxinwei

* He YunLei <heyunlei@huawei.com> [141007 18:43]:
> 
> Thanks for your review and I am really appreciated it, but in our arm
> platform, we haven't custom initcall levels for other drivers. Although
> deferred probe helps other drivers to register well, we are also confused
> for the issues of lots of pin request errors debug output while booting the
> kernel. Besides, if the number is bigger than the limited number, whether
> deferred probe can solve this problem.

OK. Care to provide some examples where this happens on your
platform?

Note that we already have pinctrl very early in drivers/Makefile.
What are the early users for pinctrl-single in your setup?

Regards,

Tony

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

* Re: [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
  2014-10-08 18:10     ` Tony Lindgren
@ 2014-10-11  9:01       ` He YunLei
  2014-10-13 15:42         ` Tony Lindgren
  0 siblings, 1 reply; 6+ messages in thread
From: He YunLei @ 2014-10-11  9:01 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: linux-kernel, grant.likely, robh+dt, wangbintian, liguozhu,
	kong.kongxinwei

On 2014/10/9 2:10, Tony Lindgren wrote:
> * He YunLei <heyunlei@huawei.com> [141007 18:43]:
>>
>> Thanks for your review and I am really appreciated it, but in our arm
>> platform, we haven't custom initcall levels for other drivers. Although
>> deferred probe helps other drivers to register well, we are also confused
>> for the issues of lots of pin request errors debug output while booting the
>> kernel. Besides, if the number is bigger than the limited number, whether
>> deferred probe can solve this problem.
>
> OK. Care to provide some examples where this happens on your
> platform?
>
> Note that we already have pinctrl very early in drivers/Makefile.
> What are the early users for pinctrl-single in your setup?
>
> Regards,
>
> Tony
>
> .
>
In our platform we use subsys_initcall in I2C, and fs_initcall in PMIC, 
Both of them are early than pinctrl-single. Although they register well
with the aid of deferred probe, it's really confused us that pins 
request deferred. Why can't we setup pinctrl-single earlier to reduce 
these messages.

Regards

YunLei


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

* Re: [RFC PATCH] pinctrl: pinctrl-single.c:  init pinctrl single at arch_initcall time
  2014-10-11  9:01       ` He YunLei
@ 2014-10-13 15:42         ` Tony Lindgren
  0 siblings, 0 replies; 6+ messages in thread
From: Tony Lindgren @ 2014-10-13 15:42 UTC (permalink / raw)
  To: He YunLei
  Cc: linux-kernel, grant.likely, robh+dt, wangbintian, liguozhu,
	kong.kongxinwei, linux-omap

* He YunLei <heyunlei@huawei.com> [141011 02:03]:
> On 2014/10/9 2:10, Tony Lindgren wrote:
> >* He YunLei <heyunlei@huawei.com> [141007 18:43]:
> >>
> >>Thanks for your review and I am really appreciated it, but in our arm
> >>platform, we haven't custom initcall levels for other drivers. Although
> >>deferred probe helps other drivers to register well, we are also confused
> >>for the issues of lots of pin request errors debug output while booting the
> >>kernel. Besides, if the number is bigger than the limited number, whether
> >>deferred probe can solve this problem.
> >
> >OK. Care to provide some examples where this happens on your
> >platform?
> >
> >Note that we already have pinctrl very early in drivers/Makefile.
> >What are the early users for pinctrl-single in your setup?
> >
> >Regards,
> >
> >Tony
> >
> >.
> >
> In our platform we use subsys_initcall in I2C, and fs_initcall in PMIC, Both
> of them are early than pinctrl-single. Although they register well
> with the aid of deferred probe, it's really confused us that pins request
> deferred. Why can't we setup pinctrl-single earlier to reduce these
> messages.

How about make the I2C controller just regular module_init?

We're planning to do that for omaps as soon as we have made omap3
DT only as we still have some board-*.c files.

Presumably your PMIC is also on I2C and you need the PMIC for
regulators?

In that case you can just make the PMICinit normal module_init too.

Regards,

Tony

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

end of thread, other threads:[~2014-10-13 15:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-29 10:31 [RFC PATCH] pinctrl: pinctrl-single.c: init pinctrl single at arch_initcall time He YunLei
2014-09-29 17:54 ` Tony Lindgren
2014-10-08  1:42   ` He YunLei
2014-10-08 18:10     ` Tony Lindgren
2014-10-11  9:01       ` He YunLei
2014-10-13 15:42         ` Tony Lindgren

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.