public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* recursive call to platform_device_register deadlocks
@ 2005-06-18 14:39 Jamey Hicks
  2005-06-19  5:59 ` Greg KH
  2005-06-21  7:43 ` Russell King
  0 siblings, 2 replies; 6+ messages in thread
From: Jamey Hicks @ 2005-06-18 14:39 UTC (permalink / raw)
  To: linux-kernel


We wrote soc_device to handle ASICs that were structured as a number of 
subcomponents, some of which are reused from ASIC to ASIC.  This enables 
the drivers for the subcomponents to be in separate files, loaded as 
modules, and enhances code reuse.  We submitted soc_device, but it was 
pointed out that platform_device probably does what we want.

We've started working on replacing uses of soc_device in handhelds 
drivers by platform_device.   One of the things we ran into is that the 
platform_device driver for an ASIC was calling soc_device_register 
inside its probe function.  If this is converted to 
platform_device_register, then the process deadlocks because 
bus_add_device locks platform_bus_type.

We could restructure the toplevel driver so that it does not call 
platform_device inside its probe function.  An alternative would be to 
add a pointer to a vector of subdevices to platform_device and have it 
register the subdevices after it has probed the toplevel device.  Do you 
have any recommendations?

Thanks,
Jamey Hicks


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

* Re: recursive call to platform_device_register deadlocks
@ 2005-06-18 16:06 David Brownell
  0 siblings, 0 replies; 6+ messages in thread
From: David Brownell @ 2005-06-18 16:06 UTC (permalink / raw)
  To: jamey.hicks; +Cc: Linux Kernel list


> We could restructure the toplevel driver so that it does not call 
> platform_device inside its probe function.  An alternative would be to 
> add a pointer to a vector of subdevices to platform_device and have it 
> register the subdevices after it has probed the toplevel device.  Do you 
> have any recommendations?

Other busses have taken the former approach... the toplevel bit
being more like a bridge/hub than anything else, and the children
appearing later through some dynamic scan/hotplug.  That vector
could be used to implement such a "scan", triggered sometime after
the bridge/hub driver returns from probe(), avoiding both that
driver core deadlock and recursion during probe().

I think the SPI stack will have similar issues.  There it'll be
typical that configurations be static board-specific ones ... not
so dissimilar from configurations involving board-specific ASICs.
An SOC may have several SPI controllers, with their own chipselects,
and different boards will have different chips (like serial flash,
sensors, DAC/ADC, etc) on each chipselect.  Unlike busses designed
for hotplug, those chips won't always self-identify; a dynamic
scan won't generally behave.

Some model that makes it easy to declare static sections of the
device tree, and which is easily applied to other bus types, would
be a good thing.  Like maybe that "alternative" you sketched.

- Dave


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

* Re: recursive call to platform_device_register deadlocks
  2005-06-18 14:39 recursive call to platform_device_register deadlocks Jamey Hicks
@ 2005-06-19  5:59 ` Greg KH
  2005-06-20 13:26   ` Jamey Hicks
  2005-06-21 13:55   ` Jamey Hicks
  2005-06-21  7:43 ` Russell King
  1 sibling, 2 replies; 6+ messages in thread
From: Greg KH @ 2005-06-19  5:59 UTC (permalink / raw)
  To: Jamey Hicks; +Cc: linux-kernel

On Sat, Jun 18, 2005 at 10:39:34AM -0400, Jamey Hicks wrote:
> 
> We could restructure the toplevel driver so that it does not call 
> platform_device inside its probe function.  An alternative would be to 
> add a pointer to a vector of subdevices to platform_device and have it 
> register the subdevices after it has probed the toplevel device.  Do you 
> have any recommendations?

Use the -mm kernel, this should be allowed in that release, due to a
rework of the driver core logic in this area.  Can you test this out and
verify this?

thanks,

greg k-h

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

* Re: recursive call to platform_device_register deadlocks
  2005-06-19  5:59 ` Greg KH
@ 2005-06-20 13:26   ` Jamey Hicks
  2005-06-21 13:55   ` Jamey Hicks
  1 sibling, 0 replies; 6+ messages in thread
From: Jamey Hicks @ 2005-06-20 13:26 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Greg KH wrote:

>On Sat, Jun 18, 2005 at 10:39:34AM -0400, Jamey Hicks wrote:
>  
>
>>We could restructure the toplevel driver so that it does not call 
>>platform_device inside its probe function.  An alternative would be to 
>>add a pointer to a vector of subdevices to platform_device and have it 
>>register the subdevices after it has probed the toplevel device.  Do you 
>>have any recommendations?
>>    
>>
>
>Use the -mm kernel, this should be allowed in that release, due to a
>rework of the driver core logic in this area.  Can you test this out and
>verify this?
>
>  
>
Sounds good.  I will test it out.

Jamey


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

* Re: recursive call to platform_device_register deadlocks
  2005-06-18 14:39 recursive call to platform_device_register deadlocks Jamey Hicks
  2005-06-19  5:59 ` Greg KH
@ 2005-06-21  7:43 ` Russell King
  1 sibling, 0 replies; 6+ messages in thread
From: Russell King @ 2005-06-21  7:43 UTC (permalink / raw)
  To: Jamey Hicks; +Cc: linux-kernel, Greg KH

On Sat, Jun 18, 2005 at 10:39:34AM -0400, Jamey Hicks wrote:
> We've started working on replacing uses of soc_device in handhelds 
> drivers by platform_device.   One of the things we ran into is that the 
> platform_device driver for an ASIC was calling soc_device_register 
> inside its probe function.  If this is converted to 
> platform_device_register, then the process deadlocks because 
> bus_add_device locks platform_bus_type.

This should now be resolved as a result of Greg's recent patch driver
model patch set, as appeared on lkml last night.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

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

* Re: recursive call to platform_device_register deadlocks
  2005-06-19  5:59 ` Greg KH
  2005-06-20 13:26   ` Jamey Hicks
@ 2005-06-21 13:55   ` Jamey Hicks
  1 sibling, 0 replies; 6+ messages in thread
From: Jamey Hicks @ 2005-06-21 13:55 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Greg KH wrote:

>On Sat, Jun 18, 2005 at 10:39:34AM -0400, Jamey Hicks wrote:
>  
>
>>We could restructure the toplevel driver so that it does not call 
>>platform_device inside its probe function.  An alternative would be to 
>>add a pointer to a vector of subdevices to platform_device and have it 
>>register the subdevices after it has probed the toplevel device.  Do you 
>>have any recommendations?
>>    
>>
>
>Use the -mm kernel, this should be allowed in that release, due to a
>rework of the driver core logic in this area.  Can you test this out and
>verify this?
>
>  
>
I tested 2.6.12-mm1 yesterday and verified that it allows recursive 
calls to platform_device.

Jamey


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

end of thread, other threads:[~2005-06-21 13:59 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-18 14:39 recursive call to platform_device_register deadlocks Jamey Hicks
2005-06-19  5:59 ` Greg KH
2005-06-20 13:26   ` Jamey Hicks
2005-06-21 13:55   ` Jamey Hicks
2005-06-21  7:43 ` Russell King
  -- strict thread matches above, loose matches on Subject: below --
2005-06-18 16:06 David Brownell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox