提交 4c093a6d 编写于 作者: I Ian Abbott 提交者: Greg Kroah-Hartman

staging: comedi: pass 'struct comedi_driver *' to comedi_..._auto_config

The comedi_pci_auto_config() and comedi_usb_auto_config() functions
currently take a board name parameter which is actually a driver name
parameter.  Replace it with a pointer to the struct comedi_driver.  This
will allow comedi_pci_auto_config() and comedi_usb_auto_config() to call
bus-type-specific auto-configuration hooks in the struct comedi_driver
if they exist (they don't yet).  The idea is that these
bus-type-specific auto-configuration hooks won't have to search the bus
for the device being auto-configured like 'attach()' hook has to.
Signed-off-by: NIan Abbott <abbotti@mev.co.uk>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 2e3c024d
......@@ -456,10 +456,12 @@ static inline void *comedi_aux_data(int options[], int n)
int comedi_alloc_subdevice_minor(struct comedi_device *dev,
struct comedi_subdevice *s);
void comedi_free_subdevice_minor(struct comedi_subdevice *s);
int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name);
int comedi_pci_auto_config(struct pci_dev *pcidev,
struct comedi_driver *driver);
void comedi_pci_auto_unconfig(struct pci_dev *pcidev);
struct usb_device; /* forward declaration */
int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name);
int comedi_usb_auto_config(struct usb_device *usbdev,
struct comedi_driver *driver);
void comedi_usb_auto_unconfig(struct usb_device *usbdev);
#ifdef CONFIG_COMEDI_PCI_DRIVERS
......
......@@ -874,7 +874,7 @@ static void comedi_auto_unconfig(struct device *hardware_device)
kfree(minor);
}
int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name)
int comedi_pci_auto_config(struct pci_dev *pcidev, struct comedi_driver *driver)
{
int options[2];
......@@ -883,7 +883,7 @@ int comedi_pci_auto_config(struct pci_dev *pcidev, const char *board_name)
/* pci slot */
options[1] = PCI_SLOT(pcidev->devfn);
return comedi_auto_config(&pcidev->dev, board_name,
return comedi_auto_config(&pcidev->dev, driver->driver_name,
options, ARRAY_SIZE(options));
}
EXPORT_SYMBOL_GPL(comedi_pci_auto_config);
......@@ -894,10 +894,11 @@ void comedi_pci_auto_unconfig(struct pci_dev *pcidev)
}
EXPORT_SYMBOL_GPL(comedi_pci_auto_unconfig);
int comedi_usb_auto_config(struct usb_device *usbdev, const char *board_name)
int comedi_usb_auto_config(struct usb_device *usbdev,
struct comedi_driver *driver)
{
BUG_ON(usbdev == NULL);
return comedi_auto_config(&usbdev->dev, board_name, NULL, 0);
return comedi_auto_config(&usbdev->dev, driver->driver_name, NULL, 0);
}
EXPORT_SYMBOL_GPL(comedi_usb_auto_config);
......
......@@ -2543,7 +2543,7 @@ static struct comedi_driver driver_addi = {
static int __devinit driver_addi_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_addi.driver_name);
return comedi_pci_auto_config(dev, &driver_addi);
}
static void __devexit driver_addi_pci_remove(struct pci_dev *dev)
......
......@@ -121,7 +121,7 @@ static struct comedi_driver driver_pci6208 = {
static int __devinit driver_pci6208_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pci6208.driver_name);
return comedi_pci_auto_config(dev, &driver_pci6208);
}
static void __devexit driver_pci6208_pci_remove(struct pci_dev *dev)
......
......@@ -196,7 +196,7 @@ static int __devinit driver_adl_pci7230_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_adl_pci7230.driver_name);
return comedi_pci_auto_config(dev, &driver_adl_pci7230);
}
static void __devexit driver_adl_pci7230_pci_remove(struct pci_dev *dev)
......
......@@ -176,7 +176,7 @@ static int __devinit driver_adl_pci7296_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_adl_pci7296.driver_name);
return comedi_pci_auto_config(dev, &driver_adl_pci7296);
}
static void __devexit driver_adl_pci7296_pci_remove(struct pci_dev *dev)
......
......@@ -209,7 +209,7 @@ static int __devinit driver_adl_pci7432_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_adl_pci7432.driver_name);
return comedi_pci_auto_config(dev, &driver_adl_pci7432);
}
static void __devexit driver_adl_pci7432_pci_remove(struct pci_dev *dev)
......
......@@ -388,7 +388,7 @@ static int __devinit driver_adl_pci8164_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_adl_pci8164.driver_name);
return comedi_pci_auto_config(dev, &driver_adl_pci8164);
}
static void __devexit driver_adl_pci8164_pci_remove(struct pci_dev *dev)
......
......@@ -364,7 +364,7 @@ static struct comedi_driver pci9111_driver = {
static int __devinit pci9111_driver_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, pci9111_driver.driver_name);
return comedi_pci_auto_config(dev, &pci9111_driver);
}
static void __devexit pci9111_driver_pci_remove(struct pci_dev *dev)
......
......@@ -292,7 +292,7 @@ static struct comedi_driver driver_pci9118 = {
static int __devinit driver_pci9118_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pci9118.driver_name);
return comedi_pci_auto_config(dev, &driver_pci9118);
}
static void __devexit driver_pci9118_pci_remove(struct pci_dev *dev)
......
......@@ -1612,7 +1612,7 @@ static int pci1710_detach(struct comedi_device *dev)
static int __devinit driver_pci1710_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pci1710.driver_name);
return comedi_pci_auto_config(dev, &driver_pci1710);
}
static void __devexit driver_pci1710_pci_remove(struct pci_dev *dev)
......
......@@ -498,7 +498,7 @@ static int pci1723_detach(struct comedi_device *dev)
static int __devinit driver_pci1723_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pci1723.driver_name);
return comedi_pci_auto_config(dev, &driver_pci1723);
}
static void __devexit driver_pci1723_pci_remove(struct pci_dev *dev)
......
......@@ -1319,7 +1319,7 @@ static int pci_dio_detach(struct comedi_device *dev)
static int __devinit driver_pci_dio_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pci_dio.driver_name);
return comedi_pci_auto_config(dev, &driver_pci_dio);
}
static void __devexit driver_pci_dio_pci_remove(struct pci_dev *dev)
......
......@@ -509,7 +509,7 @@ static int __devinit driver_amplc_dio200_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_amplc_dio200.driver_name);
return comedi_pci_auto_config(dev, &driver_amplc_dio200);
}
static void __devexit driver_amplc_dio200_pci_remove(struct pci_dev *dev)
......
......@@ -192,7 +192,7 @@ static int __devinit driver_amplc_pc236_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_amplc_pc236.driver_name);
return comedi_pci_auto_config(dev, &driver_amplc_pc236);
}
static void __devexit driver_amplc_pc236_pci_remove(struct pci_dev *dev)
......
......@@ -459,7 +459,7 @@ static int __devinit driver_amplc_pc263_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_amplc_pc263.driver_name);
return comedi_pci_auto_config(dev, &driver_amplc_pc263);
}
static void __devexit driver_amplc_pc263_pci_remove(struct pci_dev *dev)
......
......@@ -444,7 +444,7 @@ static int __devinit driver_amplc_pci224_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_amplc_pci224.driver_name);
return comedi_pci_auto_config(dev, &driver_amplc_pci224);
}
static void __devexit driver_amplc_pci224_pci_remove(struct pci_dev *dev)
......
......@@ -618,7 +618,7 @@ static int __devinit driver_amplc_pci230_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_amplc_pci230.driver_name);
return comedi_pci_auto_config(dev, &driver_amplc_pci230);
}
static void __devexit driver_amplc_pci230_pci_remove(struct pci_dev *dev)
......
......@@ -1925,7 +1925,7 @@ static int nvram_read(struct comedi_device *dev, unsigned int address,
static int __devinit driver_cb_pcidas_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_cb_pcidas.driver_name);
return comedi_pci_auto_config(dev, &driver_cb_pcidas);
}
static void __devexit driver_cb_pcidas_pci_remove(struct pci_dev *dev)
......
......@@ -1219,7 +1219,7 @@ static void load_ao_dma(struct comedi_device *dev,
static int __devinit driver_cb_pcidas_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_cb_pcidas.driver_name);
return comedi_pci_auto_config(dev, &driver_cb_pcidas);
}
static void __devexit driver_cb_pcidas_pci_remove(struct pci_dev *dev)
......
......@@ -850,7 +850,7 @@ static void cb_pcidda_calibrate(struct comedi_device *dev, unsigned int channel,
static int __devinit driver_cb_pcidda_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_cb_pcidda.driver_name);
return comedi_pci_auto_config(dev, &driver_cb_pcidda);
}
static void __devexit driver_cb_pcidda_pci_remove(struct pci_dev *dev)
......
......@@ -293,7 +293,7 @@ static int pcidio_detach(struct comedi_device *dev)
static int __devinit driver_cb_pcidio_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_cb_pcidio.driver_name);
return comedi_pci_auto_config(dev, &driver_cb_pcidio);
}
static void __devexit driver_cb_pcidio_pci_remove(struct pci_dev *dev)
......
......@@ -487,7 +487,7 @@ static int __devinit driver_cb_pcimdas_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_cb_pcimdas.driver_name);
return comedi_pci_auto_config(dev, &driver_cb_pcimdas);
}
static void __devexit driver_cb_pcimdas_pci_remove(struct pci_dev *dev)
......
......@@ -201,7 +201,7 @@ static int __devinit cb_pcimdda_driver_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, cb_pcimdda_driver.driver_name);
return comedi_pci_auto_config(dev, &cb_pcimdda_driver);
}
static void __devexit cb_pcimdda_driver_pci_remove(struct pci_dev *dev)
......
......@@ -231,7 +231,7 @@ static int contec_di_insn_bits(struct comedi_device *dev,
static int __devinit driver_contec_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_contec.driver_name);
return comedi_pci_auto_config(dev, &driver_contec);
}
static void __devexit driver_contec_pci_remove(struct pci_dev *dev)
......
......@@ -878,7 +878,7 @@ static int __devinit driver_daqboard2000_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, driver_daqboard2000.driver_name);
return comedi_pci_auto_config(dev, &driver_daqboard2000);
}
static void __devexit driver_daqboard2000_pci_remove(struct pci_dev *dev)
......
......@@ -1111,7 +1111,7 @@ EXPORT_SYMBOL_GPL(das08_common_detach);
static int __devinit driver_das08_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_das08.driver_name);
return comedi_pci_auto_config(dev, &driver_das08);
}
static void __devexit driver_das08_pci_remove(struct pci_dev *dev)
......
......@@ -289,7 +289,7 @@ static struct comedi_driver driver_dt3000 = {
static int __devinit driver_dt3000_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_dt3000.driver_name);
return comedi_pci_auto_config(dev, &driver_dt3000);
}
static void __devexit driver_dt3000_pci_remove(struct pci_dev *dev)
......
......@@ -421,7 +421,7 @@ static int dyna_pci10xx_detach(struct comedi_device *dev)
static int __devinit driver_dyna_pci10xx_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_dyna_pci10xx.driver_name);
return comedi_pci_auto_config(dev, &driver_dyna_pci10xx);
}
static void __devexit driver_dyna_pci10xx_pci_remove(struct pci_dev *dev)
......
......@@ -348,7 +348,7 @@ static struct comedi_driver driver_hpdi = {
static int __devinit driver_hpdi_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_hpdi.driver_name);
return comedi_pci_auto_config(dev, &driver_hpdi);
}
static void __devexit driver_hpdi_pci_remove(struct pci_dev *dev)
......
......@@ -977,7 +977,7 @@ static int jr3_pci_detach(struct comedi_device *dev)
static int __devinit driver_jr3_pci_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_jr3_pci.driver_name);
return comedi_pci_auto_config(dev, &driver_jr3_pci);
}
static void __devexit driver_jr3_pci_pci_remove(struct pci_dev *dev)
......
......@@ -97,7 +97,7 @@ static struct comedi_driver cnt_driver = {
static int __devinit cnt_driver_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, cnt_driver.driver_name);
return comedi_pci_auto_config(dev, &cnt_driver);
}
static void __devexit cnt_driver_pci_remove(struct pci_dev *dev)
......
......@@ -2427,7 +2427,7 @@ static int me4000_cnt_insn_write(struct comedi_device *dev,
static int __devinit driver_me4000_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_me4000.driver_name);
return comedi_pci_auto_config(dev, &driver_me4000);
}
static void __devexit driver_me4000_pci_remove(struct pci_dev *dev)
......
......@@ -257,7 +257,7 @@ static struct comedi_driver me_driver = {
static int __devinit me_driver_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, me_driver.driver_name);
return comedi_pci_auto_config(dev, &me_driver);
}
static void __devexit me_driver_pci_remove(struct pci_dev *dev)
......
......@@ -493,7 +493,7 @@ static int ni6527_find_device(struct comedi_device *dev, int bus, int slot)
static int __devinit driver_ni6527_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_ni6527.driver_name);
return comedi_pci_auto_config(dev, &driver_ni6527);
}
static void __devexit driver_ni6527_pci_remove(struct pci_dev *dev)
......
......@@ -837,7 +837,7 @@ static int ni_65xx_find_device(struct comedi_device *dev, int bus, int slot)
static int __devinit driver_ni_65xx_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_ni_65xx.driver_name);
return comedi_pci_auto_config(dev, &driver_ni_65xx);
}
static void __devexit driver_ni_65xx_pci_remove(struct pci_dev *dev)
......
......@@ -474,7 +474,7 @@ static struct comedi_driver driver_ni_660x = {
static int __devinit driver_ni_660x_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_ni_660x.driver_name);
return comedi_pci_auto_config(dev, &driver_ni_660x);
}
static void __devexit driver_ni_660x_pci_remove(struct pci_dev *dev)
......
......@@ -123,7 +123,7 @@ static struct comedi_driver driver_ni_670x = {
static int __devinit driver_ni_670x_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_ni_670x.driver_name);
return comedi_pci_auto_config(dev, &driver_ni_670x);
}
static void __devexit driver_ni_670x_pci_remove(struct pci_dev *dev)
......
......@@ -2141,7 +2141,7 @@ static void write_caldac(struct comedi_device *dev, unsigned int channel,
static int __devinit driver_labpc_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_labpc.driver_name);
return comedi_pci_auto_config(dev, &driver_labpc);
}
static void __devexit driver_labpc_pci_remove(struct pci_dev *dev)
......
......@@ -1359,7 +1359,7 @@ static int nidio_find_device(struct comedi_device *dev, int bus, int slot)
static int __devinit driver_pcidio_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pcidio.driver_name);
return comedi_pci_auto_config(dev, &driver_pcidio);
}
static void __devexit driver_pcidio_pci_remove(struct pci_dev *dev)
......
......@@ -1263,7 +1263,7 @@ static struct comedi_driver driver_pcimio = {
static int __devinit driver_pcimio_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_pcimio.driver_name);
return comedi_pci_auto_config(dev, &driver_pcimio);
}
static void __devexit driver_pcimio_pci_remove(struct pci_dev *dev)
......
......@@ -2355,7 +2355,7 @@ static int rtd_dio_insn_config(struct comedi_device *dev,
static int __devinit rtd520Driver_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, rtd520Driver.driver_name);
return comedi_pci_auto_config(dev, &rtd520Driver);
}
static void __devexit rtd520Driver_pci_remove(struct pci_dev *dev)
......
......@@ -227,7 +227,7 @@ static struct dio_private *dio_private_word[]={
static int __devinit driver_s626_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_s626.driver_name);
return comedi_pci_auto_config(dev, &driver_s626);
}
static void __devexit driver_s626_pci_remove(struct pci_dev *dev)
......
......@@ -623,7 +623,7 @@ static int skel_dio_insn_config(struct comedi_device *dev,
static int __devinit driver_skel_pci_probe(struct pci_dev *dev,
const struct pci_device_id *ent)
{
return comedi_pci_auto_config(dev, driver_skel.driver_name);
return comedi_pci_auto_config(dev, &driver_skel);
}
static void __devexit driver_skel_pci_remove(struct pci_dev *dev)
......
......@@ -317,6 +317,8 @@ static struct usbduxsub usbduxsub[NUMUSBDUX];
static DEFINE_SEMAPHORE(start_stop_sem);
static struct comedi_driver driver_usbdux; /* see below for initializer */
/*
* Stops the data acquision
* It should be safe to call this function from any context
......@@ -2324,7 +2326,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
"Could not upload firmware (err=%d)\n", ret);
goto out;
}
comedi_usb_auto_config(usbdev, BOARDNAME);
comedi_usb_auto_config(usbdev, &driver_usbdux);
out:
release_firmware(fw);
}
......
......@@ -201,6 +201,8 @@ static struct usbduxfastsub_s usbduxfastsub[NUMUSBDUXFAST];
static DEFINE_SEMAPHORE(start_stop_sem);
static struct comedi_driver driver_usbduxfast; /* see below for initializer */
/*
* bulk transfers to usbduxfast
*/
......@@ -1458,7 +1460,7 @@ static void usbduxfast_firmware_request_complete_handler(const struct firmware
goto out;
}
comedi_usb_auto_config(usbdev, BOARDNAME);
comedi_usb_auto_config(usbdev, &driver_usbduxfast);
out:
release_firmware(fw);
}
......
......@@ -267,6 +267,8 @@ static struct usbduxsub usbduxsub[NUMUSBDUX];
static DEFINE_SEMAPHORE(start_stop_sem);
static struct comedi_driver driver_usbduxsigma; /* see below for initializer */
/*
* Stops the data acquision
* It should be safe to call this function from any context
......@@ -2332,7 +2334,7 @@ static void usbdux_firmware_request_complete_handler(const struct firmware *fw,
"Could not upload firmware (err=%d)\n", ret);
goto out;
}
comedi_usb_auto_config(usbdev, BOARDNAME);
comedi_usb_auto_config(usbdev, &driver_usbduxsigma);
out:
release_firmware(fw);
}
......
......@@ -247,6 +247,8 @@ static struct vmk80xx_usb vmb[VMK80XX_MAX_BOARDS];
static DEFINE_MUTEX(glb_mutex);
static struct comedi_driver driver_vmk80xx; /* see below for initializer */
static void vmk80xx_tx_callback(struct urb *urb)
{
struct vmk80xx_usb *dev = urb->context;
......@@ -1482,7 +1484,7 @@ static int vmk80xx_probe(struct usb_interface *intf,
mutex_unlock(&glb_mutex);
comedi_usb_auto_config(dev->udev, BOARDNAME);
comedi_usb_auto_config(dev->udev, &driver_vmk80xx);
return 0;
error:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册