Skip to content

Commit

Permalink
staging: comedi: amplc_dio200: Remove forward function declarations
Browse files Browse the repository at this point in the history
Moved some functions and variables to avoid forward declarations.  Moved
PCI table closer to the struct pci_driver that refers to it.

Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Ian Abbott authored and Greg Kroah-Hartman committed Jun 5, 2012
1 parent d22e930 commit fd97962
Showing 1 changed file with 48 additions and 57 deletions.
105 changes: 48 additions & 57 deletions drivers/staging/comedi/drivers/amplc_dio200.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,20 +419,6 @@ static const struct dio200_layout_struct dio200_layouts[] = {
},
};

/*
* PCI driver table.
*/

#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)
static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
{0}
};

MODULE_DEVICE_TABLE(pci, dio200_pci_table);
#endif /* CONFIG_COMEDI_AMPLC_DIO200_PCI */

/*
* Useful for shorthand access to the particular board structure
*/
Expand Down Expand Up @@ -473,49 +459,6 @@ struct dio200_subdev_intr {
int continuous;
};

/*
* The struct comedi_driver structure tells the Comedi core module
* which functions to call to configure/deconfigure (attach/detach)
* the board, and also about the kernel module that contains
* the device code.
*/
static int dio200_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static void dio200_detach(struct comedi_device *dev);
static struct comedi_driver amplc_dio200_driver = {
.driver_name = DIO200_DRIVER_NAME,
.module = THIS_MODULE,
.attach = dio200_attach,
.detach = dio200_detach,
.board_name = &dio200_boards[0].name,
.offset = sizeof(struct dio200_board),
.num_names = ARRAY_SIZE(dio200_boards),
};

#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)
static int __devinit amplc_dio200_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, &amplc_dio200_driver);
}

static void __devexit amplc_dio200_pci_remove(struct pci_dev *dev)
{
comedi_pci_auto_unconfig(dev);
}

static struct pci_driver amplc_dio200_pci_driver = {
.name = DIO200_DRIVER_NAME,
.id_table = dio200_pci_table,
.probe = &amplc_dio200_pci_probe,
.remove = __devexit_p(&amplc_dio200_pci_remove)
};
module_comedi_pci_driver(amplc_dio200_driver, amplc_dio200_pci_driver);
#else
module_comedi_driver(amplc_dio200_driver);
#endif

/*
* This function looks for a PCI device matching the requested board name,
* bus and slot.
Expand Down Expand Up @@ -1488,6 +1431,54 @@ static void dio200_detach(struct comedi_device *dev)
}
}

/*
* The struct comedi_driver structure tells the Comedi core module
* which functions to call to configure/deconfigure (attach/detach)
* the board, and also about the kernel module that contains
* the device code.
*/
static struct comedi_driver amplc_dio200_driver = {
.driver_name = DIO200_DRIVER_NAME,
.module = THIS_MODULE,
.attach = dio200_attach,
.detach = dio200_detach,
.board_name = &dio200_boards[0].name,
.offset = sizeof(struct dio200_board),
.num_names = ARRAY_SIZE(dio200_boards),
};

#if IS_ENABLED(CONFIG_COMEDI_AMPLC_DIO200_PCI)
static DEFINE_PCI_DEVICE_TABLE(dio200_pci_table) = {
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI215) },
{ PCI_DEVICE(PCI_VENDOR_ID_AMPLICON, PCI_DEVICE_ID_AMPLICON_PCI272) },
{0}
};

MODULE_DEVICE_TABLE(pci, dio200_pci_table);

static int __devinit amplc_dio200_pci_probe(struct pci_dev *dev,
const struct pci_device_id
*ent)
{
return comedi_pci_auto_config(dev, &amplc_dio200_driver);
}

static void __devexit amplc_dio200_pci_remove(struct pci_dev *dev)
{
comedi_pci_auto_unconfig(dev);
}

static struct pci_driver amplc_dio200_pci_driver = {
.name = DIO200_DRIVER_NAME,
.id_table = dio200_pci_table,
.probe = &amplc_dio200_pci_probe,
.remove = __devexit_p(&amplc_dio200_pci_remove)
};
module_comedi_pci_driver(amplc_dio200_driver, amplc_dio200_pci_driver);
#else
module_comedi_driver(amplc_dio200_driver);
#endif

MODULE_AUTHOR("Comedi http://www.comedi.org");
MODULE_DESCRIPTION("Comedi low-level driver");
MODULE_LICENSE("GPL");

0 comments on commit fd97962

Please sign in to comment.