Commit d8b6ca08 authored by Ian Abbott's avatar Ian Abbott Committed by Greg Kroah-Hartman

staging: comedi: pass usb interface to comedi_usb_auto_config

The comedi_usb_auto_config() and comedi_usb_auto_unconfig() functions
currently take a 'struct usb_device *'.  It makes more sense to pass a
'struct usb_interface *' to allow for composite USB devices.
Signed-off-by: default avatarIan Abbott <abbotti@mev.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent c43435d7
...@@ -460,10 +460,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s); ...@@ -460,10 +460,10 @@ void comedi_free_subdevice_minor(struct comedi_subdevice *s);
int comedi_pci_auto_config(struct pci_dev *pcidev, int comedi_pci_auto_config(struct pci_dev *pcidev,
struct comedi_driver *driver); struct comedi_driver *driver);
void comedi_pci_auto_unconfig(struct pci_dev *pcidev); void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
struct usb_device; /* forward declaration */ struct usb_interface; /* forward declaration */
int comedi_usb_auto_config(struct usb_device *usbdev, int comedi_usb_auto_config(struct usb_interface *intf,
struct comedi_driver *driver); struct comedi_driver *driver);
void comedi_usb_auto_unconfig(struct usb_device *usbdev); void comedi_usb_auto_unconfig(struct usb_interface *intf);
#ifdef CONFIG_COMEDI_PCI_DRIVERS #ifdef CONFIG_COMEDI_PCI_DRIVERS
#define CONFIG_COMEDI_PCI #define CONFIG_COMEDI_PCI
......
...@@ -880,17 +880,17 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev) ...@@ -880,17 +880,17 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
} }
EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig); EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig);
int comedi_usb_auto_config(struct usb_device *usbdev, int comedi_usb_auto_config(struct usb_interface *intf,
struct comedi_driver *driver) struct comedi_driver *driver)
{ {
BUG_ON(usbdev == NULL); BUG_ON(intf == NULL);
return comedi_auto_config(&usbdev->dev, driver->driver_name, NULL, 0); return comedi_auto_config(&intf->dev, driver->driver_name, NULL, 0);
} }
EXPORT_SYMBOL_GPL(comedi_usb_auto_config); EXPORT_SYMBOL_GPL(comedi_usb_auto_config);
void comedi_usb_auto_unconfig(struct usb_device *usbdev) void comedi_usb_auto_unconfig(struct usb_interface *intf)
{ {
BUG_ON(usbdev == NULL); BUG_ON(intf == NULL);
comedi_auto_unconfig(&usbdev->dev); comedi_auto_unconfig(&intf->dev);
} }
EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig); EXPORT_SYMBOL_GPL(comedi_usb_auto_unconfig);
...@@ -2306,11 +2306,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, ...@@ -2306,11 +2306,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
void *context) void *context)
{ {
struct usbduxsub *usbduxsub_tmp = context; struct usbduxsub *usbduxsub_tmp = context;
struct usb_device *usbdev = usbduxsub_tmp->usbdev; struct usb_interface *uinterf = usbduxsub_tmp->interface;
int ret; int ret;
if (fw == NULL) { if (fw == NULL) {
dev_err(&usbdev->dev, dev_err(&uinterf->dev,
"Firmware complete handler without firmware!\n"); "Firmware complete handler without firmware!\n");
return; return;
} }
...@@ -2322,11 +2322,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, ...@@ -2322,11 +2322,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
ret = firmwareUpload(usbduxsub_tmp, fw->data, fw->size); ret = firmwareUpload(usbduxsub_tmp, fw->data, fw->size);
if (ret) { if (ret) {
dev_err(&usbdev->dev, dev_err(&uinterf->dev,
"Could not upload firmware (err=%d)\n", ret); "Could not upload firmware (err=%d)\n", ret);
goto out; goto out;
} }
comedi_usb_auto_config(usbdev, &driver_usbdux); comedi_usb_auto_config(uinterf, &driver_usbdux);
out: out:
release_firmware(fw); release_firmware(fw);
} }
...@@ -2608,7 +2608,7 @@ static void usbduxsub_disconnect(struct usb_interface *intf) ...@@ -2608,7 +2608,7 @@ static void usbduxsub_disconnect(struct usb_interface *intf)
dev_err(&intf->dev, "comedi_: BUG! called with wrong ptr!!!\n"); dev_err(&intf->dev, "comedi_: BUG! called with wrong ptr!!!\n");
return; return;
} }
comedi_usb_auto_unconfig(udev); comedi_usb_auto_unconfig(intf);
down(&start_stop_sem); down(&start_stop_sem);
down(&usbduxsub_tmp->sem); down(&usbduxsub_tmp->sem);
tidy_up(usbduxsub_tmp); tidy_up(usbduxsub_tmp);
......
...@@ -1442,7 +1442,7 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware ...@@ -1442,7 +1442,7 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware
*fw, void *context) *fw, void *context)
{ {
struct usbduxfastsub_s *usbduxfastsub_tmp = context; struct usbduxfastsub_s *usbduxfastsub_tmp = context;
struct usb_device *usbdev = usbduxfastsub_tmp->usbdev; struct usb_interface *uinterf = usbduxfastsub_tmp->interface;
int ret; int ret;
if (fw == NULL) if (fw == NULL)
...@@ -1455,12 +1455,12 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware ...@@ -1455,12 +1455,12 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware
ret = firmwareUpload(usbduxfastsub_tmp, fw->data, fw->size); ret = firmwareUpload(usbduxfastsub_tmp, fw->data, fw->size);
if (ret) { if (ret) {
dev_err(&usbdev->dev, dev_err(&uinterf->dev,
"Could not upload firmware (err=%d)\n", ret); "Could not upload firmware (err=%d)\n", ret);
goto out; goto out;
} }
comedi_usb_auto_config(usbdev, &driver_usbduxfast); comedi_usb_auto_config(uinterf, &driver_usbduxfast);
out: out:
release_firmware(fw); release_firmware(fw);
} }
...@@ -1608,7 +1608,7 @@ static void usbduxfastsub_disconnect(struct usb_interface *intf) ...@@ -1608,7 +1608,7 @@ static void usbduxfastsub_disconnect(struct usb_interface *intf)
return; return;
} }
comedi_usb_auto_unconfig(udev); comedi_usb_auto_unconfig(intf);
down(&start_stop_sem); down(&start_stop_sem);
down(&udfs->sem); down(&udfs->sem);
......
...@@ -2314,11 +2314,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, ...@@ -2314,11 +2314,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
void *context) void *context)
{ {
struct usbduxsub *usbduxsub_tmp = context; struct usbduxsub *usbduxsub_tmp = context;
struct usb_device *usbdev = usbduxsub_tmp->usbdev; struct usb_interface *uinterf = usbduxsub_tmp->interface;
int ret; int ret;
if (fw == NULL) { if (fw == NULL) {
dev_err(&usbdev->dev, dev_err(&uinterf->dev,
"Firmware complete handler without firmware!\n"); "Firmware complete handler without firmware!\n");
return; return;
} }
...@@ -2330,11 +2330,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw, ...@@ -2330,11 +2330,11 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
ret = firmwareUpload(usbduxsub_tmp, fw->data, fw->size); ret = firmwareUpload(usbduxsub_tmp, fw->data, fw->size);
if (ret) { if (ret) {
dev_err(&usbdev->dev, dev_err(&uinterf->dev,
"Could not upload firmware (err=%d)\n", ret); "Could not upload firmware (err=%d)\n", ret);
goto out; goto out;
} }
comedi_usb_auto_config(usbdev, &driver_usbduxsigma); comedi_usb_auto_config(uinterf, &driver_usbduxsigma);
out: out:
release_firmware(fw); release_firmware(fw);
} }
...@@ -2625,7 +2625,7 @@ static void usbduxsigma_disconnect(struct usb_interface *intf) ...@@ -2625,7 +2625,7 @@ static void usbduxsigma_disconnect(struct usb_interface *intf)
if (usbduxsub_tmp->ao_cmd_running) if (usbduxsub_tmp->ao_cmd_running)
/* we are still running a command */ /* we are still running a command */
usbdux_ao_stop(usbduxsub_tmp, 1); usbdux_ao_stop(usbduxsub_tmp, 1);
comedi_usb_auto_unconfig(udev); comedi_usb_auto_unconfig(intf);
down(&start_stop_sem); down(&start_stop_sem);
down(&usbduxsub_tmp->sem); down(&usbduxsub_tmp->sem);
tidy_up(usbduxsub_tmp); tidy_up(usbduxsub_tmp);
......
...@@ -1484,7 +1484,7 @@ static int vmk80xx_probe(struct usb_interface *intf, ...@@ -1484,7 +1484,7 @@ static int vmk80xx_probe(struct usb_interface *intf,
mutex_unlock(&glb_mutex); mutex_unlock(&glb_mutex);
comedi_usb_auto_config(dev->udev, &driver_vmk80xx); comedi_usb_auto_config(intf, &driver_vmk80xx);
return 0; return 0;
error: error:
...@@ -1502,7 +1502,7 @@ static void vmk80xx_disconnect(struct usb_interface *intf) ...@@ -1502,7 +1502,7 @@ static void vmk80xx_disconnect(struct usb_interface *intf)
if (!dev) if (!dev)
return; return;
comedi_usb_auto_unconfig(dev->udev); comedi_usb_auto_unconfig(intf);
mutex_lock(&glb_mutex); mutex_lock(&glb_mutex);
down(&dev->limit_sem); down(&dev->limit_sem);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment