Re: [PATCH 04/11] remove usb_interface pointer
From: Stefani Seibold
Date: Thu Jun 07 2012 - 15:49:59 EST
Am Donnerstag, den 07.06.2012, 11:27 -0400 schrieb Alan Stern:
> On Thu, 7 Jun 2012, Stefani Seibold wrote:
> > I think it will be needed, since usb core will decrement the reference
> > when the device go away.
>
> But before it decrements the reference, it will unbind the driver. As
> long as usb-skeleton is careful not to access the device or the
> interface after the disconnect routine returns, it doesn't need to keep
> a reference.
>
> > Lock every access to the usb core if a tedious
> > thing and will waste a lot of code.
>
> With proper design, it's not necessary to lock every access.
> >
> > BTW: An interface have no reference count.
>
> Sure it does. Look at the definitions of usb_get_intf() and
> usb_put_intf() in drivers/usb/core/usb.c.
>
That what i am looking for. If we do an usb_get_intf() in the
skel_probe() function and an usb_put_intf() in skel_delete() function at
the end, then it should be save to access the usb_device pointer by
interface_to_usbdev() in the skel_delete() function. Right?
Greetings,
Stefani
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/