提交 8f566937 编写于 作者: H H Hartley Sweeten 提交者: Greg Kroah-Hartman

staging: comedi: dt9812: remove 'interface' from usb private data

The usb_interface * is only used in the usb (*probe) and (*disconnect).
Remove the pointer to the 'interface' in the usb private data.

For aesthetic reasons, rename the variable 'interface' to simply
'intf' in the (*probe) and (*disconnect).
Signed-off-by: NH Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 135a0009
...@@ -265,7 +265,6 @@ static DEFINE_SEMAPHORE(dt9812_mutex); ...@@ -265,7 +265,6 @@ static DEFINE_SEMAPHORE(dt9812_mutex);
struct usb_dt9812 { struct usb_dt9812 {
struct slot_dt9812 *slot; struct slot_dt9812 *slot;
struct usb_device *udev; struct usb_device *udev;
struct usb_interface *interface;
u16 vendor; u16 vendor;
u16 product; u16 product;
u16 device; u16 device;
...@@ -832,7 +831,7 @@ static struct comedi_driver dt9812_comedi_driver = { ...@@ -832,7 +831,7 @@ static struct comedi_driver dt9812_comedi_driver = {
.detach = dt9812_detach, .detach = dt9812_detach,
}; };
static int dt9812_probe(struct usb_interface *interface, static int dt9812_probe(struct usb_interface *intf,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct slot_dt9812 *slot = NULL; struct slot_dt9812 *slot = NULL;
...@@ -870,14 +869,13 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -870,14 +869,13 @@ static int dt9812_probe(struct usb_interface *interface,
up(&dt9812_mutex); up(&dt9812_mutex);
dev->udev = usb_get_dev(interface_to_usbdev(interface)); dev->udev = usb_get_dev(interface_to_usbdev(intf));
dev->interface = interface;
/* Check endpoints */ /* Check endpoints */
host = interface->cur_altsetting; host = intf->cur_altsetting;
if (host->desc.bNumEndpoints != 5) { if (host->desc.bNumEndpoints != 5) {
dev_err(&interface->dev, "Wrong number of endpoints.\n"); dev_err(&intf->dev, "Wrong number of endpoints.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
...@@ -910,7 +908,7 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -910,7 +908,7 @@ static int dt9812_probe(struct usb_interface *interface,
break; break;
} }
if ((ep->bEndpointAddress & USB_DIR_IN) != direction) { if ((ep->bEndpointAddress & USB_DIR_IN) != direction) {
dev_err(&interface->dev, dev_err(&intf->dev,
"Endpoint has wrong direction.\n"); "Endpoint has wrong direction.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
...@@ -925,7 +923,7 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -925,7 +923,7 @@ static int dt9812_probe(struct usb_interface *interface,
for (i = 0; i < 10; i++) { for (i = 0; i < 10; i++) {
retval = dt9812_read_info(dev, 1, &fw, sizeof(fw)); retval = dt9812_read_info(dev, 1, &fw, sizeof(fw));
if (retval == 0) { if (retval == 0) {
dev_info(&interface->dev, dev_info(&intf->dev,
"usb_reset_configuration succeeded " "usb_reset_configuration succeeded "
"after %d iterations\n", i); "after %d iterations\n", i);
break; break;
...@@ -934,22 +932,22 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -934,22 +932,22 @@ static int dt9812_probe(struct usb_interface *interface,
} }
if (dt9812_read_info(dev, 1, &dev->vendor, sizeof(dev->vendor)) != 0) { if (dt9812_read_info(dev, 1, &dev->vendor, sizeof(dev->vendor)) != 0) {
dev_err(&interface->dev, "Failed to read vendor.\n"); dev_err(&intf->dev, "Failed to read vendor.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
if (dt9812_read_info(dev, 3, &dev->product, sizeof(dev->product)) != 0) { if (dt9812_read_info(dev, 3, &dev->product, sizeof(dev->product)) != 0) {
dev_err(&interface->dev, "Failed to read product.\n"); dev_err(&intf->dev, "Failed to read product.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
if (dt9812_read_info(dev, 5, &dev->device, sizeof(dev->device)) != 0) { if (dt9812_read_info(dev, 5, &dev->device, sizeof(dev->device)) != 0) {
dev_err(&interface->dev, "Failed to read device.\n"); dev_err(&intf->dev, "Failed to read device.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
if (dt9812_read_info(dev, 7, &dev->serial, sizeof(dev->serial)) != 0) { if (dt9812_read_info(dev, 7, &dev->serial, sizeof(dev->serial)) != 0) {
dev_err(&interface->dev, "Failed to read serial.\n"); dev_err(&intf->dev, "Failed to read serial.\n");
retval = -ENODEV; retval = -ENODEV;
goto error; goto error;
} }
...@@ -960,10 +958,10 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -960,10 +958,10 @@ static int dt9812_probe(struct usb_interface *interface,
dev->serial = le32_to_cpu(dev->serial); dev->serial = le32_to_cpu(dev->serial);
/* save our data pointer in this interface device */ /* save our data pointer in this interface device */
usb_set_intfdata(interface, dev); usb_set_intfdata(intf, dev);
/* let the user know what node this device is now attached to */ /* let the user know what node this device is now attached to */
dev_info(&interface->dev, "USB DT9812 (%4.4x.%4.4x.%4.4x) #0x%8.8x\n", dev_info(&intf->dev, "USB DT9812 (%4.4x.%4.4x.%4.4x) #0x%8.8x\n",
dev->vendor, dev->product, dev->device, dev->serial); dev->vendor, dev->product, dev->device, dev->serial);
return 0; return 0;
...@@ -974,24 +972,24 @@ static int dt9812_probe(struct usb_interface *interface, ...@@ -974,24 +972,24 @@ static int dt9812_probe(struct usb_interface *interface,
return retval; return retval;
} }
static void dt9812_disconnect(struct usb_interface *interface) static void dt9812_disconnect(struct usb_interface *intf)
{ {
struct usb_dt9812 *dev; struct usb_dt9812 *dev;
int minor = interface->minor; int minor = intf->minor;
down(&dt9812_mutex); down(&dt9812_mutex);
dev = usb_get_intfdata(interface); dev = usb_get_intfdata(intf);
if (dev->slot) { if (dev->slot) {
dev->slot->usb = NULL; dev->slot->usb = NULL;
dev->slot = NULL; dev->slot = NULL;
} }
usb_set_intfdata(interface, NULL); usb_set_intfdata(intf, NULL);
up(&dt9812_mutex); up(&dt9812_mutex);
/* queue final destruction */ /* queue final destruction */
kref_put(&dev->kref, dt9812_delete); kref_put(&dev->kref, dt9812_delete);
dev_info(&interface->dev, "USB Dt9812 #%d now disconnected\n", minor); dev_info(&intf->dev, "USB Dt9812 #%d now disconnected\n", minor);
} }
static const struct usb_device_id dt9812_table[] = { static const struct usb_device_id dt9812_table[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册