[Intel-gfx] [PATCH] drivers/base: use a worker for sysfs unbind

Daniel Vetter daniel at ffwll.ch
Fri Dec 7 11:00:17 UTC 2018


On Fri, Dec 07, 2018 at 09:58:06AM +0000, Chris Wilson wrote:
> Quoting Daniel Vetter (2018-12-07 09:31:33)
> > +void unbind_work_fn(struct work_struct *work)
> > +{
> > +       struct unbind_work *unbind_work =
> > +               container_of(work, struct unbind_work, work);
> > +
> > +       device_release_driver(unbind_work->dev);
> > +       put_device(unbind_work->dev);
> > +}
> > +
> >  /* Manually detach a device from its associated driver. */
> >  static ssize_t unbind_store(struct device_driver *drv, const char *buf,
> >                             size_t count)
> >  {
> >         struct bus_type *bus = bus_get(drv->bus);
> > +       struct unbind_work *unbind_work;
> >         struct device *dev;
> >         int err = -ENODEV;
> >  
> >         dev = bus_find_device_by_name(bus, NULL, buf);
> >         if (dev && dev->driver == drv) {
> > -               if (dev->parent && dev->bus->need_parent_lock)
> > -                       device_lock(dev->parent);
> 
> Do we not need to keep this locking in the worker?

Ah forgot to mention that in the commit message: This locking is already
done in device_release_driver -> device_release_driver_internal. I'll fix
up the commit message, thanks for the reminder.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list