Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Thierry Reding
On Mon, Aug 19, 2013 at 02:53:37PM -0600, Stephen Warren wrote: > On 08/19/2013 02:10 PM, Thierry Reding wrote: > > On Mon, Aug 19, 2013 at 01:43:59PM -0600, Stephen Warren wrote: > >> On 08/17/2013 05:17 AM, Thierry Reding wrote: ... > >>> Well, the most obvious cases where early initialization is

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Stephen Warren
On 08/19/2013 02:10 PM, Thierry Reding wrote: > On Mon, Aug 19, 2013 at 01:43:59PM -0600, Stephen Warren wrote: >> On 08/17/2013 05:17 AM, Thierry Reding wrote: ... >>> Well, the most obvious cases where early initialization is >>> needed are interrupt controllers and clocks. >> >> ... and IOMMUs,

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Thierry Reding
On Mon, Aug 19, 2013 at 01:43:59PM -0600, Stephen Warren wrote: > On 08/17/2013 05:17 AM, Thierry Reding wrote: > ... > > Well, the most obvious cases where early initialization is needed > > are interrupt controllers and clocks. > > ... and IOMMUs, which apparently need to initialize before any d

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Thierry Reding
On Mon, Aug 19, 2013 at 01:49:18PM -0600, Stephen Warren wrote: > On 08/17/2013 04:26 AM, Tomasz Figa wrote: > ... > > Please correct me if I'm wrong, but to get to initcalls you need a timer. > > However a timer driver might need interrupts (to tick) and clocks (to get > > the frequency). > > >

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Stephen Warren
On 08/17/2013 04:26 AM, Tomasz Figa wrote: ... > Please correct me if I'm wrong, but to get to initcalls you need a timer. > However a timer driver might need interrupts (to tick) and clocks (to get > the frequency). > > At least this is what happens on the platforms I work with. They don't > n

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-19 Thread Stephen Warren
On 08/17/2013 05:17 AM, Thierry Reding wrote: ... > Well, the most obvious cases where early initialization is needed > are interrupt controllers and clocks. ... and IOMMUs, which apparently need to initialize before any devices whose transactions are routed through the IOMMU, in order to set them

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-17 Thread Thierry Reding
On Fri, Aug 16, 2013 at 03:08:07PM -0700, Greg Kroah-Hartman wrote: > On Fri, Aug 16, 2013 at 11:55:31PM +0200, Thierry Reding wrote: > > > > + list_for_each_entry(private, &device_early_list, early) { > > > > + struct device *dev = private->device; > > > > + int e

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-17 Thread Thierry Reding
On Fri, Aug 16, 2013 at 11:20:55PM +0100, Grant Likely wrote: > On Fri, Aug 16, 2013 at 10:55 PM, Thierry Reding > wrote: > > On Fri, Aug 16, 2013 at 02:06:37PM -0700, Greg Kroah-Hartman wrote: > >> On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote: > >> > +static DEFINE_MUTEX(device_

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-17 Thread Tomasz Figa
On Friday 16 of August 2013 23:20:55 Grant Likely wrote: > On Fri, Aug 16, 2013 at 10:55 PM, Thierry Reding > > wrote: > > On Fri, Aug 16, 2013 at 02:06:37PM -0700, Greg Kroah-Hartman wrote: > >> On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote: > >> > +static DEFINE_MUTEX(device_ea

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-16 Thread Greg Kroah-Hartman
On Fri, Aug 16, 2013 at 11:20:55PM +0100, Grant Likely wrote: > Also, for the devices that are created early, is it really appropriate > to use APIs that require a struct device? I could easily argue that > anything done at early boot should only be the bare minimum to allow > the kernel to get to

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-16 Thread Greg Kroah-Hartman
On Fri, Aug 16, 2013 at 11:55:31PM +0200, Thierry Reding wrote: > > > + list_for_each_entry(private, &device_early_list, early) { > > > + struct device *dev = private->device; > > > + int err; > > > + > > > + if (dev->bus == &platform_bus_type) { > > > > Why special case th

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-16 Thread Greg Kroah-Hartman
On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote: > +static DEFINE_MUTEX(device_early_mutex); > +static LIST_HEAD(device_early_list); > +static bool device_is_early = true; > + > +/* > + * Keep a list of early registered devices so that they can be fully > + * registered at a later po

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-16 Thread Thierry Reding
On Fri, Aug 16, 2013 at 02:06:37PM -0700, Greg Kroah-Hartman wrote: > On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote: > > +static DEFINE_MUTEX(device_early_mutex); > > +static LIST_HEAD(device_early_list); > > +static bool device_is_early = true; > > + > > +/* > > + * Keep a list of

Re: [RFC 2/4] driver core: Allow early registration of devices

2013-08-16 Thread Grant Likely
On Fri, Aug 16, 2013 at 10:55 PM, Thierry Reding wrote: > On Fri, Aug 16, 2013 at 02:06:37PM -0700, Greg Kroah-Hartman wrote: >> On Fri, Aug 16, 2013 at 10:39:21PM +0200, Thierry Reding wrote: >> > +static DEFINE_MUTEX(device_early_mutex); >> > +static LIST_HEAD(device_early_list); >> > +static bo