Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Fri, 15 Feb 2013 00:58:23 +0800, Haojian Zhuang wrote: > On 15 February 2013 00:50, Arnd Bergmann wrote: > > On Thursday 14 February 2013, Haojian Zhuang wrote: > >> On 14 February 2013 23:57, Arnd Bergmann wrote: > >> > On Thursday 14 February 2013, Haojian Zhuang wrote: > >> >> If you can

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread anish kumar
On Thu, 2013-02-14 at 16:33 +, Grant Likely wrote: > On Thu, 14 Feb 2013 08:57:17 +0530, anish singh > wrote: > > On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely > > wrote: > > > static int deferred_probe_initcall(void) > > > { > > > deferred_wq =

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 15:57:18 +, Arnd Bergmann wrote: > On Thursday 14 February 2013, Haojian Zhuang wrote: > > If you can change it into code in below, it could work. Otherwise, it > > always fails. > > driver_deferred_probe_enable = true; > > driver_deferred_probe_trigger();

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 23:52:14 +0800, Haojian Zhuang wrote: > On 14 February 2013 05:36, Grant Likely wrote: > > On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang > > wrote: > >> On 12 February 2013 07:10, Andrew Morton wrote: > >> > On Sun, 10 Feb 2013 00:57:57 +0800 > >> > Haojian Zhuang

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 15 February 2013 00:50, Arnd Bergmann wrote: > On Thursday 14 February 2013, Haojian Zhuang wrote: >> On 14 February 2013 23:57, Arnd Bergmann wrote: >> > On Thursday 14 February 2013, Haojian Zhuang wrote: >> >> If you can change it into code in below, it could work. Otherwise, it >> >>

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Haojian Zhuang wrote: > On 14 February 2013 23:57, Arnd Bergmann wrote: > > On Thursday 14 February 2013, Haojian Zhuang wrote: > >> If you can change it into code in below, it could work. Otherwise, it > >> always fails. > >> driver_deferred_probe_enable =

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 08:57:17 +0530, anish singh wrote: > On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely > wrote: > > static int deferred_probe_initcall(void) > > { > > deferred_wq = create_singlethread_workqueue("deferwq"); > > if (WARN_ON(!deferred_wq)) > >

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 14 February 2013 23:57, Arnd Bergmann wrote: > On Thursday 14 February 2013, Haojian Zhuang wrote: >> If you can change it into code in below, it could work. Otherwise, it >> always fails. >> driver_deferred_probe_enable = true; >> driver_deferred_probe_trigger(); >> +

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Haojian Zhuang wrote: > If you can change it into code in below, it could work. Otherwise, it > always fails. > driver_deferred_probe_enable = true; > driver_deferred_probe_trigger(); > + deferred_probe_work_func(NULL); > return 0; > >

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 14 February 2013 05:36, Grant Likely wrote: > On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang > wrote: >> On 12 February 2013 07:10, Andrew Morton wrote: >> > On Sun, 10 Feb 2013 00:57:57 +0800 >> > Haojian Zhuang wrote: >> > >> >> do_initcalls() could call all driver initialization

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Russell King - ARM Linux wrote: > In the general case, that remains true, but it's still not true for > console drivers. > > The console should be initialised before it is attempted to be opened > before passing control to userspace, which happens before the .init >

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Russell King - ARM Linux
On Thu, Feb 14, 2013 at 09:56:36AM +, Arnd Bergmann wrote: > I would put it this way: With the introduction of deferred probing, the > rules for the use of __init sections have changed slightly for some > corner cases. While normal device drivers can, as before, not call > __init functions

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, anish singh wrote: > Grant, Can you please explain me this problem?My understanding is below: > If all the detection of devices with there respective driver is done before > __init section is freed then we will not have the problem mentioned. > However if the driver

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, anish singh wrote: Grant, Can you please explain me this problem?My understanding is below: If all the detection of devices with there respective driver is done before __init section is freed then we will not have the problem mentioned. However if the driver

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Russell King - ARM Linux
On Thu, Feb 14, 2013 at 09:56:36AM +, Arnd Bergmann wrote: I would put it this way: With the introduction of deferred probing, the rules for the use of __init sections have changed slightly for some corner cases. While normal device drivers can, as before, not call __init functions from

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Russell King - ARM Linux wrote: In the general case, that remains true, but it's still not true for console drivers. The console should be initialised before it is attempted to be opened before passing control to userspace, which happens before the .init

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 14 February 2013 05:36, Grant Likely grant.lik...@secretlab.ca wrote: On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 12 February 2013 07:10, Andrew Morton a...@linux-foundation.org wrote: On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Haojian Zhuang wrote: If you can change it into code in below, it could work. Otherwise, it always fails. driver_deferred_probe_enable = true; driver_deferred_probe_trigger(); + deferred_probe_work_func(NULL); return 0; Because

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 14 February 2013 23:57, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: If you can change it into code in below, it could work. Otherwise, it always fails. driver_deferred_probe_enable = true; driver_deferred_probe_trigger(); +

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 08:57:17 +0530, anish singh anish198519851...@gmail.com wrote: On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely grant.lik...@secretlab.ca wrote: static int deferred_probe_initcall(void) { deferred_wq = create_singlethread_workqueue(deferwq); if

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Arnd Bergmann
On Thursday 14 February 2013, Haojian Zhuang wrote: On 14 February 2013 23:57, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: If you can change it into code in below, it could work. Otherwise, it always fails. driver_deferred_probe_enable =

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Haojian Zhuang
On 15 February 2013 00:50, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: On 14 February 2013 23:57, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: If you can change it into code in below, it could work.

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 23:52:14 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 14 February 2013 05:36, Grant Likely grant.lik...@secretlab.ca wrote: On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 12 February 2013 07:10, Andrew Morton

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Thu, 14 Feb 2013 15:57:18 +, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: If you can change it into code in below, it could work. Otherwise, it always fails. driver_deferred_probe_enable = true;

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread anish kumar
On Thu, 2013-02-14 at 16:33 +, Grant Likely wrote: On Thu, 14 Feb 2013 08:57:17 +0530, anish singh anish198519851...@gmail.com wrote: On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely grant.lik...@secretlab.ca wrote: static int deferred_probe_initcall(void) { deferred_wq

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-14 Thread Grant Likely
On Fri, 15 Feb 2013 00:58:23 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 15 February 2013 00:50, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013, Haojian Zhuang wrote: On 14 February 2013 23:57, Arnd Bergmann a...@arndb.de wrote: On Thursday 14 February 2013,

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-13 Thread anish singh
On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely wrote: > On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang > wrote: >> On 12 February 2013 07:10, Andrew Morton wrote: >> > On Sun, 10 Feb 2013 00:57:57 +0800 >> > Haojian Zhuang wrote: >> > >> >> do_initcalls() could call all driver

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-13 Thread Grant Likely
On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang wrote: > On 12 February 2013 07:10, Andrew Morton wrote: > > On Sun, 10 Feb 2013 00:57:57 +0800 > > Haojian Zhuang wrote: > > > >> do_initcalls() could call all driver initialization code in kernel_init > >> thread. It means that probe()

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-13 Thread Grant Likely
On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 12 February 2013 07:10, Andrew Morton a...@linux-foundation.org wrote: On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang haojian.zhu...@linaro.org wrote: do_initcalls() could call all driver

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-13 Thread anish singh
On Thu, Feb 14, 2013 at 3:06 AM, Grant Likely grant.lik...@secretlab.ca wrote: On Tue, 12 Feb 2013 10:52:10 +0800, Haojian Zhuang haojian.zhu...@linaro.org wrote: On 12 February 2013 07:10, Andrew Morton a...@linux-foundation.org wrote: On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-11 Thread Haojian Zhuang
On 12 February 2013 07:10, Andrew Morton wrote: > On Sun, 10 Feb 2013 00:57:57 +0800 > Haojian Zhuang wrote: > >> do_initcalls() could call all driver initialization code in kernel_init >> thread. It means that probe() function will be also called from that >> time. After this, kernel could

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-11 Thread Andrew Morton
On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang wrote: > do_initcalls() could call all driver initialization code in kernel_init > thread. It means that probe() function will be also called from that > time. After this, kernel could access console & release __init section > in the same thread.

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-11 Thread Andrew Morton
On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang haojian.zhu...@linaro.org wrote: do_initcalls() could call all driver initialization code in kernel_init thread. It means that probe() function will be also called from that time. After this, kernel could access console release __init section

Re: [PATCH] driver core: add wait event for deferred probe

2013-02-11 Thread Haojian Zhuang
On 12 February 2013 07:10, Andrew Morton a...@linux-foundation.org wrote: On Sun, 10 Feb 2013 00:57:57 +0800 Haojian Zhuang haojian.zhu...@linaro.org wrote: do_initcalls() could call all driver initialization code in kernel_init thread. It means that probe() function will be also called from

[PATCH] driver core: add wait event for deferred probe

2013-02-09 Thread Haojian Zhuang
do_initcalls() could call all driver initialization code in kernel_init thread. It means that probe() function will be also called from that time. After this, kernel could access console & release __init section in the same thread. But if device probe fails and moves into deferred probe list, a

[PATCH] driver core: add wait event for deferred probe

2013-02-09 Thread Haojian Zhuang
do_initcalls() could call all driver initialization code in kernel_init thread. It means that probe() function will be also called from that time. After this, kernel could access console release __init section in the same thread. But if device probe fails and moves into deferred probe list, a