Re: [PATCH 04/11] remove usb_interface pointer

From: Stefani Seibold
Date: Thu Jun 07 2012 - 07:51:23 EST


Hi Greg,

Am Donnerstag, den 07.06.2012, 07:54 +0900 schrieb Greg KH:
> On Wed, Jun 06, 2012 at 06:27:05PM +0200, stefani@xxxxxxxxxxx wrote:
> > From: Stefani Seibold <stefani@xxxxxxxxxxx>
> >
> > this saves a litte bit of memory space in the driver devices structure
> >
> > Signed-off-by: Stefani Seibold <stefani@xxxxxxxxxxx>
> > ---
> > drivers/usb/usb-skeleton.c | 23 ++++++++++++-----------
> > 1 files changed, 12 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c
> > index 2f17991..f7fe32f 100644
> > --- a/drivers/usb/usb-skeleton.c
> > +++ b/drivers/usb/usb-skeleton.c
> > @@ -49,7 +49,6 @@ MODULE_DEVICE_TABLE(usb, skel_table);
> > /* Structure to hold all of our device specific stuff */
> > struct usb_skel {
> > struct usb_device *udev; /* the usb device for this device */
> > - struct usb_interface *interface; /* the interface for this device */
>
> No, that's the exact opposite of what I asked you to do.
>

I tried to implement your idea to kick away the usb_device pointer, but
i think it is impossible. The skel_delete() function needs the
usb_device pointer for calling usb_put, which is called from
skel_disconnect() or skel_release().

A call of interface_to_usbdev(dev->intf) results in a udev pointer, but
this pointer is only valid if it was called trough kref_put() from
skel_disconnect().

For an already opened devices, the call will come from skel_release()
and in this case the interface pointer could be already owned by an
other driver and no more longer handle by the skeleton driver.

So i think we need both.

HTH
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/