[PATCH 1/4] base: Introduce deferred probing

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Mon Apr 13 07:26:12 PDT 2015


On 13.04.2015 08:54, Sascha Hauer wrote:
> On Fri, Apr 10, 2015 at 03:02:43AM +0200, Sebastian Hesselbarth wrote:
>> As expected, we would need deferred probing sooner or later. This is
>> a first approach to allow devices to return -EPROBE_DEFER and get
>> sorted into a list of deferred devices that will be re-probed later.
[...}
>> +static int device_probe_deferred(void)
>> +{
>> +	struct device_d *dev, *tmp;
>> +	struct driver_d *drv;
>> +	int retries = 10;
>> +
>> +	do {
>> +		if (list_empty(&deferred))
>> +			break;
>> +
>> +		list_for_each_entry_safe(dev, tmp, &deferred, active) {
>> +			list_del(&dev->active);
>> +
>> +			if (dev->bus) {
>> +				bus_for_each_driver(dev->bus, drv) {
>> +					if (!match(drv, dev))
>> +						break;
>> +				}
>> +				device_probe(dev);
>> +			}
>> +		}
>> +	} while (retries--);
>
> Instead of a hardcoded loop counter I think this should be "while at least
> one device successfully probed". Also if probe fails and the return
> value is still -EPROBE_DEFER you have to add the device to the deferred
> list again.

Sascha,

agreed. I'll have another look at how deferred probing is handled here
and resend once I have implemented your comments above.

Sebastian




More information about the barebox mailing list