Re: [PATCH 05/10] driver core: Export device_driver_attach()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 08, 2021 at 07:19:33AM +0100, Christoph Hellwig wrote:
> On Mon, Jun 07, 2021 at 09:55:47PM -0300, Jason Gunthorpe wrote:
> > This is intended as a replacement API for device_bind_driver(). It has at
> > least the following benefits:
> > 
> > - Internal locking. Few of the users of device_bind_driver() follow the
> >   locking rules
> > 
> > - Calls device driver probe() internally. Notably this means that devm
> >   support for probe works correctly as probe() error will call
> >   devres_release_all()
> > 
> > - struct device_driver -> dev_groups is supported
> > 
> > - Simplified calling convention, no need to manually call probe().
> 
> Btw, it would be nice to convert at least one existing user of
> device_bind_driver to show this.  Also maybe Cc all maintainers of
> subsystems using device_bind_driver so that they get a headsup and
> maybe quickly move over?

Sure. I would do the MDIO phy, though I cann't test that code, I'm at
least familiar with it..

> > @@ -1077,6 +1079,7 @@ int device_driver_attach(struct device_driver *drv, struct device *dev)
> >  		return -EAGAIN;
> >  	return ret;
> >  }
> > +EXPORT_SYMBOL_GPL(device_driver_attach);
> 
> Ok, this means my earlier suggestions of a locked driver_probe_device
> helper needs a different name as we really don't want to expose flags
> and always return -EAGAIN here.  So maybe rename driver_probe_device
> to __driver_probe_device, have a driver_probe_device around it that
> does the locking and keep device_driver_attach for the newly exported
> API.

I put the squashing to -EAGAIN here specifically because of this
export. EPROBE_DEFER should not be returned to userspace and if I leak
it out to drivers at this point then one of them will eventually do
it wrong, as we saw already in sysfs bind_store

Jason



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux