Skip to contentSkip to conversation

recursive call to platform_device_register deadlocks

DISCUSSION Jamey Hicks 3 participants 5 messages Jun 18, 2005 – Jun 21, 2005

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 6 lines · Jamey Hicks

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

#2 lore raw
Quoted 13 lines · Greg KH
Quoted 3 lines · Jamey Hicks

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

#3 lore raw
In reply to Greg KH
Quoted 13 lines · Greg KH
Quoted 3 lines · Jamey Hicks

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

#4 lore raw
In reply to Jamey Hicks
Quoted 6 lines · Jamey Hicks

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.

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