[PATCH v2 1/3] Staging: IndustryPack bus for the Linux Kernel

Samuel Iglesias Gonsálvez siglesias at igalia.com
Mon May 7 14:24:36 UTC 2012


On Mon, 2012-05-07 at 10:24 +0200, Samuel Iglesias Gonsálvez wrote:
> On Mon, 2012-05-07 at 11:04 +0300, Dan Carpenter wrote:
> > 
> > [snip]
> > 
> > > +int ipack_device_find_drv(struct device_driver *driver, void *param)
> > > +{
> > > +	int ret;
> > > +	struct ipack_device *dev = (struct ipack_device *)param;
> > > +
> > > +	ret = ipack_bus_match(&dev->dev, driver);
> > > +	if (ret)
> > > +		return !ipack_bus_probe(&dev->dev);
> > 
> > Wouldn't probe() return zero or a negative error code?
> 
> Yes. However, in case of the function called by bus_for_each_drv(), it
> should return zero if you want to continue or nonzero value to stop the
> iteration.
> 
> I considered that if the probe fails, we can try with the next driver in
> the list. So, the returned value of probe() is negated.

Checking the device_register() function, it actually does the same I am
trying to do here: call the bus' match() function with each driver
registered on the bus searching which one can manage the device, and
then call the probe().

So I can delete this function safely and bus_for_each_drv() in
ipack_device_register().

Thanks,

Sam




More information about the devel mailing list