On Fri, 8 Jun 2012, Stefani Seibold wrote: > Hi, > > what do you think about this solution for removing the usb_device > pointer from the struct usb_skel in the usb_skeleton driver? There's nothing wrong with keeping the pointer there. Why do you want to remove it? > @@ -73,9 +73,12 @@ static struct usb_driver skel_driver; > static void skel_delete(struct kref *kref) > { > struct usb_skel *dev = to_skel_dev(kref); > + struct usb_interface *interface = dev->interface; > + struct usb_device *udev = usb_get_dev(interface_to_usbdev(interface)); > > usb_free_urb(dev->bulk_in_urb); > - usb_put_dev(dev->udev); > + usb_put_dev(udev); On the other hand, this usb_put_dev call is useless. Why do you want to keep it? > + usb_put_intf(interface); If you get rid of the usb_put_dev then this call is also useless. > kfree(dev->bulk_in_buffer); > kfree(dev); > } > @@ -128,7 +131,7 @@ static int skel_release(struct inode *inode, struct file *file) > > /* allow the device to be autosuspended */ > mutex_lock(&dev->io_mutex); > - if (dev->interface) > + if (dev->connected) There's nothing really wrong with adding a "disconnected" flag. But setting dev->interface to NULL works just as well, in my opinion. It's a matter of taste. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html