staging: comedi/drivers: use auto_attach instead of attach_usb
Change the usbdux, usbduxfast and usbduxsigma drivers to use the new `auto_attach()` method instead of the `attach_usb()` method. I plan to remove the `attach_usb()` and `attach_pci()` methods from `struct comedi_driver` once nothing is using them. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5df28346f0
commit
807e65b0a8
@@ -2375,9 +2375,10 @@ static int usbdux_attach_common(struct comedi_device *dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbdux_attach_usb(struct comedi_device *dev,
|
static int usbdux_auto_attach(struct comedi_device *dev,
|
||||||
struct usb_interface *uinterf)
|
unsigned long context_unused)
|
||||||
{
|
{
|
||||||
|
struct usb_interface *uinterf = comedi_to_usb_interface(dev);
|
||||||
int ret;
|
int ret;
|
||||||
struct usbduxsub *this_usbduxsub;
|
struct usbduxsub *this_usbduxsub;
|
||||||
|
|
||||||
@@ -2387,11 +2388,11 @@ static int usbdux_attach_usb(struct comedi_device *dev,
|
|||||||
this_usbduxsub = usb_get_intfdata(uinterf);
|
this_usbduxsub = usb_get_intfdata(uinterf);
|
||||||
if (!this_usbduxsub || !this_usbduxsub->probed) {
|
if (!this_usbduxsub || !this_usbduxsub->probed) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"usbdux: error: attach_usb failed, not connected\n");
|
"usbdux: error: auto_attach failed, not connected\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else if (this_usbduxsub->attached) {
|
} else if (this_usbduxsub->attached) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"error: attach_usb failed, already attached\n");
|
"error: auto_attach failed, already attached\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else
|
} else
|
||||||
ret = usbdux_attach_common(dev, this_usbduxsub);
|
ret = usbdux_attach_common(dev, this_usbduxsub);
|
||||||
@@ -2415,7 +2416,7 @@ static void usbdux_detach(struct comedi_device *dev)
|
|||||||
static struct comedi_driver usbdux_driver = {
|
static struct comedi_driver usbdux_driver = {
|
||||||
.driver_name = "usbdux",
|
.driver_name = "usbdux",
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.attach_usb = usbdux_attach_usb,
|
.auto_attach = usbdux_auto_attach,
|
||||||
.detach = usbdux_detach,
|
.detach = usbdux_detach,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -1444,9 +1444,10 @@ static int usbduxfast_attach_common(struct comedi_device *dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbduxfast_attach_usb(struct comedi_device *dev,
|
static int usbduxfast_auto_attach(struct comedi_device *dev,
|
||||||
struct usb_interface *uinterf)
|
unsigned long context_unused)
|
||||||
{
|
{
|
||||||
|
struct usb_interface *uinterf = comedi_to_usb_interface(dev);
|
||||||
int ret;
|
int ret;
|
||||||
struct usbduxfastsub_s *udfs;
|
struct usbduxfastsub_s *udfs;
|
||||||
|
|
||||||
@@ -1455,11 +1456,11 @@ static int usbduxfast_attach_usb(struct comedi_device *dev,
|
|||||||
udfs = usb_get_intfdata(uinterf);
|
udfs = usb_get_intfdata(uinterf);
|
||||||
if (!udfs || !udfs->probed) {
|
if (!udfs || !udfs->probed) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"usbduxfast: error: attach_usb failed, not connected\n");
|
"usbduxfast: error: auto_attach failed, not connected\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else if (udfs->attached) {
|
} else if (udfs->attached) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"usbduxfast: error: attach_usb failed, already attached\n");
|
"usbduxfast: error: auto_attach failed, already attached\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else
|
} else
|
||||||
ret = usbduxfast_attach_common(dev, udfs);
|
ret = usbduxfast_attach_common(dev, udfs);
|
||||||
@@ -1485,7 +1486,7 @@ static void usbduxfast_detach(struct comedi_device *dev)
|
|||||||
static struct comedi_driver usbduxfast_driver = {
|
static struct comedi_driver usbduxfast_driver = {
|
||||||
.driver_name = "usbduxfast",
|
.driver_name = "usbduxfast",
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.attach_usb = usbduxfast_attach_usb,
|
.auto_attach = usbduxfast_auto_attach,
|
||||||
.detach = usbduxfast_detach,
|
.detach = usbduxfast_detach,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -2359,9 +2359,10 @@ static int usbduxsigma_attach_common(struct comedi_device *dev,
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int usbduxsigma_attach_usb(struct comedi_device *dev,
|
static int usbduxsigma_auto_attach(struct comedi_device *dev,
|
||||||
struct usb_interface *uinterf)
|
unsigned long context_unused)
|
||||||
{
|
{
|
||||||
|
struct usb_interface *uinterf = comedi_to_usb_interface(dev);
|
||||||
int ret;
|
int ret;
|
||||||
struct usbduxsub *uds;
|
struct usbduxsub *uds;
|
||||||
|
|
||||||
@@ -2370,11 +2371,11 @@ static int usbduxsigma_attach_usb(struct comedi_device *dev,
|
|||||||
uds = usb_get_intfdata(uinterf);
|
uds = usb_get_intfdata(uinterf);
|
||||||
if (!uds || !uds->probed) {
|
if (!uds || !uds->probed) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"usbduxsigma: error: attach_usb failed, not connected\n");
|
"usbduxsigma: error: auto_attach failed, not connected\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else if (uds->attached) {
|
} else if (uds->attached) {
|
||||||
dev_err(dev->class_dev,
|
dev_err(dev->class_dev,
|
||||||
"usbduxsigma: error: attach_usb failed, already attached\n");
|
"usbduxsigma: error: auto_attach failed, already attached\n");
|
||||||
ret = -ENODEV;
|
ret = -ENODEV;
|
||||||
} else
|
} else
|
||||||
ret = usbduxsigma_attach_common(dev, uds);
|
ret = usbduxsigma_attach_common(dev, uds);
|
||||||
@@ -2398,7 +2399,7 @@ static void usbduxsigma_detach(struct comedi_device *dev)
|
|||||||
static struct comedi_driver usbduxsigma_driver = {
|
static struct comedi_driver usbduxsigma_driver = {
|
||||||
.driver_name = "usbduxsigma",
|
.driver_name = "usbduxsigma",
|
||||||
.module = THIS_MODULE,
|
.module = THIS_MODULE,
|
||||||
.attach_usb = usbduxsigma_attach_usb,
|
.auto_attach = usbduxsigma_auto_attach,
|
||||||
.detach = usbduxsigma_detach,
|
.detach = usbduxsigma_detach,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user