staging: comedi: cleanup all the comedi_driver 'detach' functions

1. Change the return type from int to void

All the detach functions, except for the comedi usb drivers, simply
return success (0). Plus, the return code is never checked in the
comedi core.

The comedi usb drivers do return error codes but the conditions can
never happen.

The first check is:

	if (!dev)
		return -EFAULT;

This checks that the passed comedi_device pointer is valid. The detach
function itself is called using this pointer so it MUST always be valid
or there is a bug in the core:

	if (dev->driver)
		dev->driver->detach(dev);

And the second check:

	usb = dev->private;
	if (!usb)
		return -EFAULT;

The dev->private pointer is setup in the attach function to point to the
probed usb device. This value could be NULL if the attach fails. But,
since the comedi core is going to unload the driver anyway and does not
check for errors there is no gain by returning one.

After removing these checks from the comedi usb drivers the detach
functions required a bit of cleanup.

2. Remove all the printk noise in the detach functions

All of the printk output is really just noise. The user did a rmmod to
unload the driver, we really don't need to tell them about it.

Also, some of the messages are output using:

	dev_dbg(dev->hw_dev, ...
or
	dev_info(dev->hw_dev, ...

Unfortunately the hw_dev value is only used by drivers that are doing
DMA. For most drivers this variable is going to be NULL so the output
is not going to work as expected.

3. Refactor a couple static 'free_resource' functions into the detach
   functions.

The 'free_resource' function is only being called by the detach and it
makes more sense to just absorb the code.

4. Remove a couple unnecessary braces for single statements.

5. Remove unnecessary comments.

Most of the comedi drivers appear to be based on the comedi skel driver
and have the comments from that driver included. These comments make
sense in the skel driver for reference but they don't need to be in any
of the actual drivers.

6. Remove all the extra whitespace.

It's not needed to make the functions any more readable.

7. Remove the now unused 'attached_successfully' variable in the
   cb_pcimdda driver.

This variable was only used to conditionally output some driver noise
during the detach. Since all the printk's have been removed this
variable is no longer necessary.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Ian Abbott <abbotti@mev.co.uk>
Cc: Mori Hess <fmhess@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
H Hartley Sweeten 2012-05-17 17:11:14 -07:00 committed by Greg Kroah-Hartman
parent e3f7e1a5b1
commit 484ecc95d9
109 changed files with 235 additions and 992 deletions

View File

@ -189,7 +189,7 @@ struct comedi_driver {
const char *driver_name;
struct module *module;
int (*attach) (struct comedi_device *, struct comedi_devconfig *);
int (*detach) (struct comedi_device *);
void (*detach) (struct comedi_device *);
int (*attach_pci) (struct comedi_device *, struct pci_dev *);
int (*attach_usb) (struct comedi_device *, struct usb_interface *);

View File

@ -417,14 +417,12 @@ static int dev_8255_attach(struct comedi_device *dev,
return 0;
}
static int dev_8255_detach(struct comedi_device *dev)
static void dev_8255_detach(struct comedi_device *dev)
{
int i;
unsigned long iobase;
struct comedi_subdevice *s;
printk(KERN_INFO "comedi%d: 8255: remove\n", dev->minor);
for (i = 0; i < dev->n_subdevices; i++) {
s = dev->subdevices + i;
if (s->type != COMEDI_SUBD_UNUSED) {
@ -433,8 +431,6 @@ static int dev_8255_detach(struct comedi_device *dev)
}
subdev_8255_cleanup(dev, s);
}
return 0;
}
static struct comedi_driver dev_8255_driver = {

View File

@ -119,14 +119,10 @@ static int acl7225b_attach(struct comedi_device *dev,
return 0;
}
static int acl7225b_detach(struct comedi_device *dev)
static void acl7225b_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: acl7225b: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
return 0;
}
static const struct boardtype boardtypes[] = {

View File

@ -1839,50 +1839,22 @@ static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
/*
+----------------------------------------------------------------------------+
| Function name : static int i_ADDI_Detach(struct comedi_device *dev) |
| |
| |
+----------------------------------------------------------------------------+
| Task : Deallocates resources of the addi_common driver |
| Free the DMA buffers, unregister irq. |
| |
+----------------------------------------------------------------------------+
| Input Parameters : struct comedi_device *dev |
| |
| |
+----------------------------------------------------------------------------+
| Return Value : 0 |
| |
+----------------------------------------------------------------------------+
*/
static int i_ADDI_Detach(struct comedi_device *dev)
static void i_ADDI_Detach(struct comedi_device *dev)
{
if (dev->private) {
if (devpriv->b_ValidDriver) {
if (devpriv->b_ValidDriver)
i_ADDI_Reset(dev);
}
if (dev->irq) {
if (dev->irq)
free_irq(dev->irq, dev);
}
if ((this_board->pc_EepromChip == NULL)
|| (strcmp(this_board->pc_EepromChip,
ADDIDATA_9054) != 0)) {
if (devpriv->allocated) {
if ((this_board->pc_EepromChip == NULL) ||
(strcmp(this_board->pc_EepromChip, ADDIDATA_9054) != 0)) {
if (devpriv->allocated)
i_pci_card_free(devpriv->amcc);
}
if (devpriv->ul_DmaBufferVirtual[0]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[0],
devpriv->ui_DmaBufferPages[0]);
}
if (devpriv->ul_DmaBufferVirtual[1]) {
free_pages((unsigned long)devpriv->
ul_DmaBufferVirtual[1],
@ -1890,20 +1862,14 @@ static int i_ADDI_Detach(struct comedi_device *dev)
}
} else {
iounmap(devpriv->dw_AiBase);
if (devpriv->allocated) {
if (devpriv->allocated)
i_pci_card_free(devpriv->amcc);
}
}
if (pci_list_builded) {
/* v_pci_card_list_cleanup(PCI_VENDOR_ID_AMCC); */
v_pci_card_list_cleanup(this_board->i_VendorId);
pci_list_builded = 0;
}
}
return 0;
}
/*

View File

@ -416,7 +416,7 @@ static unsigned short pci_list_builded; /* set to 1 when list of card is known *
/* Function declarations */
static int i_ADDI_Attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int i_ADDI_Detach(struct comedi_device *dev);
static void i_ADDI_Detach(struct comedi_device *dev);
static int i_ADDI_Reset(struct comedi_device *dev);
static irqreturn_t v_ADDI_Interrupt(int irq, void *d);

View File

@ -330,17 +330,13 @@ static int pci6208_attach(struct comedi_device *dev,
return 1;
}
static int pci6208_detach(struct comedi_device *dev)
static void pci6208_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pci6208: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver adl_pci6208_driver = {

View File

@ -150,17 +150,13 @@ static int adl_pci7230_attach(struct comedi_device *dev,
return 1;
}
static int adl_pci7230_detach(struct comedi_device *dev)
static void adl_pci7230_detach(struct comedi_device *dev)
{
printk(KERN_DEBUG "comedi%d: pci7230: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver adl_pci7230_driver = {

View File

@ -134,25 +134,19 @@ static int adl_pci7296_attach(struct comedi_device *dev,
return -EIO;
}
static int adl_pci7296_detach(struct comedi_device *dev)
static void adl_pci7296_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pci7432: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
/* detach four 8255 digital io subdevices */
if (dev->subdevices) {
subdev_8255_cleanup(dev, dev->subdevices + 0);
subdev_8255_cleanup(dev, dev->subdevices + 1);
subdev_8255_cleanup(dev, dev->subdevices + 2);
subdev_8255_cleanup(dev, dev->subdevices + 3);
}
return 0;
}
static struct comedi_driver adl_pci7296_driver = {

View File

@ -161,17 +161,13 @@ static int adl_pci7432_attach(struct comedi_device *dev,
return -EIO;
}
static int adl_pci7432_detach(struct comedi_device *dev)
static void adl_pci7432_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pci7432: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver adl_pci7432_driver = {

View File

@ -314,17 +314,13 @@ static int adl_pci8164_attach(struct comedi_device *dev,
return -EIO;
}
static int adl_pci8164_detach(struct comedi_device *dev)
static void adl_pci8164_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pci8164: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver adl_pci8164_driver = {

View File

@ -1382,29 +1382,19 @@ found:
return 0;
}
/* Detach */
static int pci9111_detach(struct comedi_device *dev)
static void pci9111_detach(struct comedi_device *dev)
{
/* Reset device */
if (dev->private != NULL) {
if (dev_private->is_valid)
pci9111_reset(dev);
}
/* Release previously allocated irq */
if (dev->irq != 0)
free_irq(dev->irq, dev);
if (dev_private != NULL && dev_private->pci_device != NULL) {
if (dev->iobase)
comedi_pci_disable(dev_private->pci_device);
pci_dev_put(dev_private->pci_device);
}
return 0;
}
static struct comedi_driver adl_pci9111_driver = {

View File

@ -2353,7 +2353,7 @@ static int pci9118_attach(struct comedi_device *dev,
return 0;
}
static int pci9118_detach(struct comedi_device *dev)
static void pci9118_detach(struct comedi_device *dev)
{
if (dev->private) {
if (devpriv->valid)
@ -2373,8 +2373,6 @@ static int pci9118_detach(struct comedi_device *dev)
free_pages((unsigned long)devpriv->dmabuf_virt[1],
devpriv->dmabuf_pages[1]);
}
return 0;
}
static const struct boardtype boardtypes[] = {

View File

@ -324,16 +324,11 @@ static int adq12b_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int adq12b_detach(struct comedi_device *dev)
static void adq12b_detach(struct comedi_device *dev)
{
if (dev->iobase)
release_region(dev->iobase, ADQ12B_SIZE);
kfree(devpriv);
printk(KERN_INFO "comedi%d: adq12b: removed\n", dev->minor);
return 0;
}
static const struct adq12b_board adq12b_boards[] = {

View File

@ -1551,7 +1551,7 @@ static int pci1710_attach(struct comedi_device *dev,
return 0;
}
static int pci1710_detach(struct comedi_device *dev)
static void pci1710_detach(struct comedi_device *dev)
{
if (dev->private) {
if (devpriv->valid)
@ -1561,12 +1561,9 @@ static int pci1710_detach(struct comedi_device *dev)
if (devpriv->pcidev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pcidev);
pci_dev_put(devpriv->pcidev);
}
}
return 0;
}
static struct comedi_driver adv_pci1710_driver = {

View File

@ -431,22 +431,17 @@ static int pci1723_attach(struct comedi_device *dev,
return 0;
}
static int pci1723_detach(struct comedi_device *dev)
static void pci1723_detach(struct comedi_device *dev)
{
printk(KERN_ERR "comedi%d: pci1723: remove\n", dev->minor);
if (dev->private) {
if (devpriv->valid)
pci1723_reset(dev);
if (devpriv->pcidev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pcidev);
pci_dev_put(devpriv->pcidev);
}
}
return 0;
}
static struct comedi_driver adv_pci1723_driver = {

View File

@ -1210,7 +1210,7 @@ static int pci_dio_attach(struct comedi_device *dev,
return 0;
}
static int pci_dio_detach(struct comedi_device *dev)
static void pci_dio_detach(struct comedi_device *dev)
{
int i, j;
struct comedi_subdevice *s;
@ -1219,20 +1219,14 @@ static int pci_dio_detach(struct comedi_device *dev)
if (dev->private) {
if (devpriv->valid)
pci_dio_reset(dev);
/* This shows the silliness of using this kind of
* scheme for numbering subdevices. Don't do it. --ds */
subdev = 0;
for (i = 0; i < MAX_DI_SUBDEVS; i++) {
if (this_board->sdi[i].chans)
subdev++;
}
for (i = 0; i < MAX_DO_SUBDEVS; i++) {
if (this_board->sdo[i].chans)
subdev++;
}
for (i = 0; i < MAX_DIO_SUBDEVG; i++) {
for (j = 0; j < this_board->sdio[i].regs; j++) {
@ -1241,37 +1235,27 @@ static int pci_dio_detach(struct comedi_device *dev)
subdev++;
}
}
if (this_board->boardid.chans)
subdev++;
for (i = 0; i < MAX_8254_SUBDEVS; i++)
if (this_board->s8254[i].chans)
subdev++;
for (i = 0; i < dev->n_subdevices; i++) {
s = dev->subdevices + i;
s->private = NULL;
}
if (devpriv->pcidev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pcidev);
pci_dev_put(devpriv->pcidev);
}
if (devpriv->prev)
devpriv->prev->next = devpriv->next;
else
pci_priv = devpriv->next;
if (devpriv->next)
devpriv->next->prev = devpriv->prev;
}
return 0;
}
static struct comedi_driver adv_pci_dio_driver = {

View File

@ -209,12 +209,11 @@ static int aio_aio12_8_attach(struct comedi_device *dev,
return 0;
}
static int aio_aio12_8_detach(struct comedi_device *dev)
static void aio_aio12_8_detach(struct comedi_device *dev)
{
subdev_8255_cleanup(dev, &dev->subdevices[2]);
if (dev->iobase)
release_region(dev->iobase, 24);
return 0;
}
static struct comedi_driver aio_aio12_8_driver = {

View File

@ -149,14 +149,10 @@ static int aio_iiro_16_attach(struct comedi_device *dev,
return 1;
}
static int aio_iiro_16_detach(struct comedi_device *dev)
static void aio_iiro_16_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: aio_iiro_16: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, AIO_IIRO_16_SIZE);
return 0;
}
static struct comedi_driver aio_iiro_16_driver = {

View File

@ -493,7 +493,7 @@ struct dio200_subdev_intr {
*/
static int dio200_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int dio200_detach(struct comedi_device *dev);
static void dio200_detach(struct comedi_device *dev);
static struct comedi_driver driver_amplc_dio200 = {
.driver_name = DIO200_DRIVER_NAME,
.module = THIS_MODULE,
@ -1518,22 +1518,11 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int dio200_detach(struct comedi_device *dev)
static void dio200_detach(struct comedi_device *dev)
{
const struct dio200_layout_struct *layout;
unsigned n;
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
DIO200_DRIVER_NAME);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices) {
@ -1570,11 +1559,6 @@ static int dio200_detach(struct comedi_device *dev)
#endif
}
}
if (dev->board_name)
printk(KERN_INFO "comedi%d: %s removed\n",
dev->minor, dev->board_name);
return 0;
}
MODULE_AUTHOR("Comedi http://www.comedi.org");

View File

@ -176,7 +176,7 @@ struct pc236_private {
* the device code.
*/
static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int pc236_detach(struct comedi_device *dev);
static void pc236_detach(struct comedi_device *dev);
static struct comedi_driver driver_amplc_pc236 = {
.driver_name = PC236_DRIVER_NAME,
.module = THIS_MODULE,
@ -477,21 +477,10 @@ static int pc236_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int pc236_detach(struct comedi_device *dev)
static void pc236_detach(struct comedi_device *dev)
{
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
PC236_DRIVER_NAME);
if (devpriv)
pc236_intr_disable(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices)
@ -511,11 +500,6 @@ static int pc236_detach(struct comedi_device *dev)
#endif
}
}
if (dev->board_name) {
printk(KERN_INFO "comedi%d: %s removed\n",
dev->minor, dev->board_name);
}
return 0;
}
/*

View File

@ -141,7 +141,7 @@ struct pc263_private {
* the device code.
*/
static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int pc263_detach(struct comedi_device *dev);
static void pc263_detach(struct comedi_device *dev);
static struct comedi_driver driver_amplc_pc263 = {
.driver_name = PC263_DRIVER_NAME,
.module = THIS_MODULE,
@ -355,19 +355,8 @@ static int pc263_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int pc263_detach(struct comedi_device *dev)
static void pc263_detach(struct comedi_device *dev)
{
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor,
PC263_DRIVER_NAME);
#ifdef CONFIG_COMEDI_AMPLC_PC263_PCI
if (devpriv)
#endif
@ -386,11 +375,6 @@ static int pc263_detach(struct comedi_device *dev)
#endif
}
}
if (dev->board_name) {
printk(KERN_INFO "comedi%d: %s removed\n",
dev->minor, dev->board_name);
}
return 0;
}
/*

View File

@ -1522,13 +1522,10 @@ pci224_attach_pci(struct comedi_device *dev, struct pci_dev *pci_dev)
return pci224_attach_common(dev, pci_dev, NULL);
}
static int pci224_detach(struct comedi_device *dev)
static void pci224_detach(struct comedi_device *dev)
{
printk(KERN_DEBUG "comedi%d: %s: detach\n", dev->minor, DRIVER_NAME);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->subdevices) {
struct comedi_subdevice *s;
@ -1543,16 +1540,9 @@ static int pci224_detach(struct comedi_device *dev)
if (devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
}
if (dev->board_name) {
printk(KERN_INFO "comedi%d: %s removed\n",
dev->minor, dev->board_name);
}
return 0;
}
static struct comedi_driver amplc_pci224_driver = {

View File

@ -937,35 +937,19 @@ static int pci230_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int pci230_detach(struct comedi_device *dev)
static void pci230_detach(struct comedi_device *dev)
{
printk("comedi%d: amplc_pci230: remove\n", dev->minor);
if (dev->subdevices && thisboard->have_dio)
/* Clean up dio subdevice. */
subdev_8255_cleanup(dev, dev->subdevices + 2);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
if (devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
}
return 0;
}
static int get_resources(struct comedi_device *dev, unsigned int res_mask,

View File

@ -397,10 +397,6 @@ static void board_init(struct comedi_device *dev)
}
/* static void board_halt(struct comedi_device *dev) { */
/* C6X_pwmInit(dev->iobase); */
/* } */
/*
options[0] - I/O port
options[1] - irq
@ -490,22 +486,13 @@ static int c6xdigio_attach(struct comedi_device *dev,
return 0;
}
static int c6xdigio_detach(struct comedi_device *dev)
static void c6xdigio_detach(struct comedi_device *dev)
{
/* board_halt(dev); may not need this */
printk(KERN_DEBUG "comedi%d: c6xdigio: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, C6XDIGIO_SIZE);
/* Not using IRQ so I am not sure if I need this */
if (dev->irq)
free_irq(dev->irq, dev);
pnp_unregister_driver(&c6xdigio_pnp_driver);
return 0;
}
static struct comedi_driver c6xdigio_driver = {

View File

@ -91,7 +91,7 @@ struct das16cs_private {
static int das16cs_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int das16cs_detach(struct comedi_device *dev);
static void das16cs_detach(struct comedi_device *dev);
static struct comedi_driver driver_das16cs = {
.driver_name = "cb_das16_cs",
.module = THIS_MODULE,
@ -255,15 +255,10 @@ static int das16cs_attach(struct comedi_device *dev,
return 1;
}
static int das16cs_detach(struct comedi_device *dev)
static void das16cs_detach(struct comedi_device *dev)
{
dev_dbg(dev->hw_dev, "comedi%d: das16cs: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static irqreturn_t das16cs_interrupt(int irq, void *d)

View File

@ -726,26 +726,12 @@ found:
return 1;
}
/*
* cb_pcidas_detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int cb_pcidas_detach(struct comedi_device *dev)
static void cb_pcidas_detach(struct comedi_device *dev)
{
if (devpriv) {
if (devpriv->s5933_config) {
/* disable and clear interrupts on amcc s5933 */
outl(INTCSR_INBOX_INTR_STATUS,
devpriv->s5933_config + AMCC_OP_REG_INTCSR);
#ifdef CB_PCIDAS_DEBUG
dev_dbg(dev->hw_dev, "detaching, incsr is 0x%x\n",
inl(devpriv->s5933_config + AMCC_OP_REG_INTCSR));
#endif
}
}
if (dev->irq)
@ -757,8 +743,6 @@ static int cb_pcidas_detach(struct comedi_device *dev)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
/*

View File

@ -1790,15 +1790,7 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int detach(struct comedi_device *dev)
static void detach(struct comedi_device *dev)
{
unsigned int i;
@ -1860,8 +1852,6 @@ static int detach(struct comedi_device *dev)
}
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 4);
return 0;
}
static int ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s,

View File

@ -374,19 +374,8 @@ found:
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int cb_pcidda_detach(struct comedi_device *dev)
static void cb_pcidda_detach(struct comedi_device *dev)
{
/*
* Deallocate the I/O ports.
*/
if (devpriv) {
if (devpriv->pci_dev) {
if (devpriv->dac)
@ -394,13 +383,10 @@ static int cb_pcidda_detach(struct comedi_device *dev)
pci_dev_put(devpriv->pci_dev);
}
}
/* cleanup 8255 */
if (dev->subdevices) {
subdev_8255_cleanup(dev, dev->subdevices + 1);
subdev_8255_cleanup(dev, dev->subdevices + 2);
}
return 0;
}
/*

View File

@ -195,7 +195,7 @@ found:
return 1;
}
static int pcidio_detach(struct comedi_device *dev)
static void pcidio_detach(struct comedi_device *dev)
{
if (devpriv) {
if (devpriv->pci_dev) {
@ -209,7 +209,6 @@ static int pcidio_detach(struct comedi_device *dev)
for (i = 0; i < thisboard->n_8255; i++)
subdev_8255_cleanup(dev, dev->subdevices + i);
}
return 0;
}
static struct comedi_driver cb_pcidio_driver = {

View File

@ -310,29 +310,8 @@ found:
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int cb_pcimdas_detach(struct comedi_device *dev)
static void cb_pcimdas_detach(struct comedi_device *dev)
{
if (devpriv) {
dev_dbg(dev->hw_dev, "devpriv->BADR0 = 0x%lx\n",
devpriv->BADR0);
dev_dbg(dev->hw_dev, "devpriv->BADR1 = 0x%lx\n",
devpriv->BADR1);
dev_dbg(dev->hw_dev, "devpriv->BADR2 = 0x%lx\n",
devpriv->BADR2);
dev_dbg(dev->hw_dev, "devpriv->BADR3 = 0x%lx\n",
devpriv->BADR3);
dev_dbg(dev->hw_dev, "devpriv->BADR4 = 0x%lx\n",
devpriv->BADR4);
}
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
@ -342,8 +321,6 @@ static int cb_pcimdas_detach(struct comedi_device *dev)
pci_dev_put(devpriv->pci_dev);
}
}
return 0;
}
/*

View File

@ -150,7 +150,6 @@ struct board_private_struct {
unsigned long registers; /* set by probe */
unsigned long dio_registers;
char attached_to_8255; /* boolean */
char attached_successfully; /* boolean */
/* would be useful for a PCI device */
struct pci_dev *pci_dev;
@ -283,44 +282,24 @@ static int attach(struct comedi_device *dev, struct comedi_devconfig *it)
s->type = COMEDI_SUBD_UNUSED;
}
devpriv->attached_successfully = 1;
printk("attached\n");
return 1;
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int detach(struct comedi_device *dev)
static void detach(struct comedi_device *dev)
{
if (devpriv) {
if (dev->subdevices && devpriv->attached_to_8255) {
/* de-register us from the 8255 driver */
subdev_8255_cleanup(dev, dev->subdevices + 2);
devpriv->attached_to_8255 = 0;
}
if (devpriv->pci_dev) {
if (devpriv->registers)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
if (devpriv->attached_successfully && thisboard)
printk("comedi%d: %s: detached\n", dev->minor,
thisboard->name);
}
return 0;
}
static int ao_winsn(struct comedi_device *dev, struct comedi_subdevice *s,

View File

@ -332,30 +332,6 @@ static int doDevConfig(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static void doDevUnconfig(struct comedi_device *dev)
{
unsigned long devs_closed = 0;
if (devpriv) {
while (devpriv->ndevs-- && devpriv->devs) {
struct BondedDevice *bdev;
bdev = devpriv->devs[devpriv->ndevs];
if (!bdev)
continue;
if (!(devs_closed & (0x1 << bdev->minor))) {
comedi_close(bdev->dev);
devs_closed |= (0x1 << bdev->minor);
}
kfree(bdev);
}
kfree(devpriv->devs);
devpriv->devs = NULL;
kfree(devpriv);
dev->private = NULL;
}
}
static int bonding_attach(struct comedi_device *dev,
struct comedi_devconfig *it)
{
@ -406,11 +382,28 @@ static int bonding_attach(struct comedi_device *dev,
return 1;
}
static int bonding_detach(struct comedi_device *dev)
static void bonding_detach(struct comedi_device *dev)
{
LOG_MSG("comedi%d: remove\n", dev->minor);
doDevUnconfig(dev);
return 0;
unsigned long devs_closed = 0;
if (devpriv) {
while (devpriv->ndevs-- && devpriv->devs) {
struct BondedDevice *bdev;
bdev = devpriv->devs[devpriv->ndevs];
if (!bdev)
continue;
if (!(devs_closed & (0x1 << bdev->minor))) {
comedi_close(bdev->dev);
devs_closed |= (0x1 << bdev->minor);
}
kfree(bdev);
}
kfree(devpriv->devs);
devpriv->devs = NULL;
kfree(devpriv);
dev->private = NULL;
}
}
static const struct BondingBoard bondingBoards[] = {

View File

@ -372,17 +372,12 @@ static int parport_attach(struct comedi_device *dev,
return 1;
}
static int parport_detach(struct comedi_device *dev)
static void parport_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: parport: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, PARPORT_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static struct comedi_driver parport_driver = {

View File

@ -494,14 +494,10 @@ static int waveform_attach(struct comedi_device *dev,
return 1;
}
static int waveform_detach(struct comedi_device *dev)
static void waveform_detach(struct comedi_device *dev)
{
printk("comedi%d: comedi_test: remove\n", dev->minor);
if (dev->private)
waveform_ai_cancel(dev, dev->read_subdev);
return 0;
}
static const struct waveform_board waveform_boards[] = {

View File

@ -169,17 +169,13 @@ static int contec_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return -EIO;
}
static int contec_detach(struct comedi_device *dev)
static void contec_detach(struct comedi_device *dev)
{
printk("comedi%d: contec: remove\n", dev->minor);
if (devpriv && devpriv->pci_dev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver contec_pci_dio_driver = {

View File

@ -836,14 +836,12 @@ out:
return result;
}
static int daqboard2000_detach(struct comedi_device *dev)
static void daqboard2000_detach(struct comedi_device *dev)
{
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
if (devpriv->daq)
iounmap(devpriv->daq);
@ -855,7 +853,6 @@ static int daqboard2000_detach(struct comedi_device *dev)
pci_dev_put(devpriv->pci_dev);
}
}
return 0;
}
static struct comedi_driver daqboard2000_driver = {

View File

@ -1079,15 +1079,10 @@ static int das08_attach(struct comedi_device *dev, struct comedi_devconfig *it)
}
#endif /* DO_COMEDI_DRIVER_REGISTER */
int das08_common_detach(struct comedi_device *dev)
void das08_common_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: das08: remove\n", dev->minor);
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 4);
/* deallocate ioports for non-pcmcia, non-pci boards */
if ((thisboard->bustype != pcmcia) && (thisboard->bustype != pci)) {
if (dev->iobase)
release_region(dev->iobase, thisboard->iosize);
@ -1102,8 +1097,6 @@ int das08_common_detach(struct comedi_device *dev)
}
}
#endif
return 0;
}
EXPORT_SYMBOL_GPL(das08_common_detach);

View File

@ -74,6 +74,6 @@ struct das08_private_struct {
extern struct das08_board_struct das08_cs_boards[NUM_DAS08_CS_BOARDS];
int das08_common_attach(struct comedi_device *dev, unsigned long iobase);
int das08_common_detach(struct comedi_device *dev);
void das08_common_detach(struct comedi_device *dev);
#endif /* _DAS08_H */

View File

@ -1362,15 +1362,11 @@ static int das16_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int das16_detach(struct comedi_device *dev)
static void das16_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: das16: remove\n", dev->minor);
das16_reset(dev);
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 4);
if (devpriv) {
int i;
for (i = 0; i < 2; i++) {
@ -1385,10 +1381,8 @@ static int das16_detach(struct comedi_device *dev)
kfree(devpriv->user_ai_range_table);
kfree(devpriv->user_ao_range_table);
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase) {
if (thisboard->size < 0x400) {
release_region(dev->iobase, thisboard->size);
@ -1398,8 +1392,6 @@ static int das16_detach(struct comedi_device *dev)
thisboard->size & 0x3ff);
}
}
return 0;
}
static const struct das16_board das16_boards[] = {

View File

@ -703,23 +703,16 @@ static int das16m1_attach(struct comedi_device *dev,
return 0;
}
static int das16m1_detach(struct comedi_device *dev)
static void das16m1_detach(struct comedi_device *dev)
{
/* das16m1_reset(dev); */
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 3);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase) {
release_region(dev->iobase, DAS16M1_SIZE);
release_region(dev->iobase + DAS16M1_82C55, DAS16M1_SIZE2);
}
return 0;
}
static const struct das16m1_board das16m1_boards[] = {

View File

@ -767,9 +767,8 @@ static int das1800_attach(struct comedi_device *dev,
return 0;
};
static int das1800_detach(struct comedi_device *dev)
static void das1800_detach(struct comedi_device *dev)
{
/* only free stuff if it has been allocated by _attach */
if (dev->iobase)
release_region(dev->iobase, DAS1800_SIZE);
if (dev->irq)
@ -784,11 +783,6 @@ static int das1800_detach(struct comedi_device *dev)
kfree(devpriv->ai_buf0);
kfree(devpriv->ai_buf1);
}
dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor,
dev->driver->driver_name);
return 0;
};
/* probes and checks das-1800 series board type

View File

@ -327,14 +327,12 @@ static int das6402_attach(struct comedi_device *dev,
return 0;
}
static int das6402_detach(struct comedi_device *dev)
static void das6402_detach(struct comedi_device *dev)
{
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, DAS6402_SIZE);
return 0;
}
static struct comedi_driver das6402_driver = {

View File

@ -245,7 +245,7 @@ struct das800_private {
static int das800_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int das800_detach(struct comedi_device *dev);
static void das800_detach(struct comedi_device *dev);
static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s);
static struct comedi_driver driver_das800 = {
@ -556,16 +556,12 @@ static int das800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
};
static int das800_detach(struct comedi_device *dev)
static void das800_detach(struct comedi_device *dev)
{
dev_info(dev->hw_dev, "comedi%d: das800: remove\n", dev->minor);
/* only free stuff if it has been allocated by _attach */
if (dev->iobase)
release_region(dev->iobase, DAS800_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
};
static int das800_cancel(struct comedi_device *dev, struct comedi_subdevice *s)

View File

@ -224,7 +224,7 @@ struct dmm32at_private {
*/
static int dmm32at_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int dmm32at_detach(struct comedi_device *dev);
static void dmm32at_detach(struct comedi_device *dev);
static struct comedi_driver driver_dmm32at = {
.driver_name = "dmm32at",
.module = THIS_MODULE,
@ -450,23 +450,12 @@ static int dmm32at_attach(struct comedi_device *dev,
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int dmm32at_detach(struct comedi_device *dev)
static void dmm32at_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dmm32at: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, DMM32AT_MEMSIZE);
return 0;
}
/*

View File

@ -693,12 +693,10 @@ out:
return ret;
}
static int dt2801_detach(struct comedi_device *dev)
static void dt2801_detach(struct comedi_device *dev)
{
if (dev->iobase)
release_region(dev->iobase, DT2801_IOSIZE);
return 0;
}
static struct comedi_driver dt2801_driver = {

View File

@ -571,16 +571,12 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int dt2811_detach(struct comedi_device *dev)
static void dt2811_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dt2811: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, DT2811_SIZE);
return 0;
}
static const struct dt2811_board boardtypes[] = {

View File

@ -361,17 +361,12 @@ static int dt2814_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int dt2814_detach(struct comedi_device *dev)
static void dt2814_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dt2814: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, DT2814_SIZE);
return 0;
}
static struct comedi_driver dt2814_driver = {

View File

@ -227,21 +227,12 @@ static int dt2815_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static void dt2815_free_resources(struct comedi_device *dev)
static void dt2815_detach(struct comedi_device *dev)
{
if (dev->iobase)
release_region(dev->iobase, DT2815_SIZE);
}
static int dt2815_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dt2815: remove\n", dev->minor);
dt2815_free_resources(dev);
return 0;
}
static struct comedi_driver dt2815_driver = {
.driver_name = "dt2815",
.module = THIS_MODULE,

View File

@ -159,14 +159,10 @@ static int dt2817_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int dt2817_detach(struct comedi_device *dev)
static void dt2817_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dt2817: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, DT2817_SIZE);
return 0;
}
static struct comedi_driver dt2817_driver = {

View File

@ -1331,7 +1331,7 @@ static int dt282x_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static void free_resources(struct comedi_device *dev)
static void dt282x_detach(struct comedi_device *dev)
{
if (dev->irq)
free_irq(dev->irq, dev);
@ -1349,15 +1349,6 @@ static void free_resources(struct comedi_device *dev)
}
}
static int dt282x_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: dt282x: remove\n", dev->minor);
free_resources(dev);
return 0;
}
static const struct dt282x_board boardtypes[] = {
{
.name = "dt2821",

View File

@ -944,11 +944,10 @@ static int dt3000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int dt3000_detach(struct comedi_device *dev)
static void dt3000_detach(struct comedi_device *dev)
{
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
if (devpriv->pci_dev) {
if (devpriv->phys_addr)
@ -958,8 +957,6 @@ static int dt3000_detach(struct comedi_device *dev)
if (devpriv->io_addr)
iounmap(devpriv->io_addr);
}
return 0;
}
static struct comedi_driver dt3000_driver = {

View File

@ -1111,9 +1111,9 @@ static int dt9812_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int dt9812_detach(struct comedi_device *dev)
static void dt9812_detach(struct comedi_device *dev)
{
return 0;
/* Nothing to cleanup */
}
static struct comedi_driver dt9812_comedi_driver = {

View File

@ -387,14 +387,12 @@ found:
return 1;
}
static int dyna_pci10xx_detach(struct comedi_device *dev)
static void dyna_pci10xx_detach(struct comedi_device *dev)
{
if (devpriv && devpriv->pci_dev) {
comedi_pci_disable(devpriv->pci_dev);
mutex_destroy(&devpriv->mutex);
}
return 0;
}
static struct comedi_driver dyna_pci10xx_driver = {

View File

@ -174,12 +174,10 @@ static int fl512_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static int fl512_detach(struct comedi_device *dev)
static void fl512_detach(struct comedi_device *dev)
{
if (dev->iobase)
release_region(dev->iobase, FL512_SIZE);
printk(KERN_INFO "comedi%d: fl512: dummy i detach\n", dev->minor);
return 0;
}
static struct comedi_driver fl512_driver = {

View File

@ -664,12 +664,10 @@ static int hpdi_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return init_hpdi(dev);
}
static int hpdi_detach(struct comedi_device *dev)
static void hpdi_detach(struct comedi_device *dev)
{
unsigned int i;
printk(KERN_WARNING "comedi%d: gsc_hpdi: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if ((priv(dev)) && (priv(dev)->hw_dev)) {
@ -702,7 +700,6 @@ static int hpdi_detach(struct comedi_device *dev)
comedi_pci_disable(priv(dev)->hw_dev);
pci_dev_put(priv(dev)->hw_dev);
}
return 0;
}
static int dio_config_block_size(struct comedi_device *dev, unsigned int *data)

View File

@ -1007,25 +1007,19 @@ static int icp_multi_attach(struct comedi_device *dev,
return 0;
}
static int icp_multi_detach(struct comedi_device *dev)
static void icp_multi_detach(struct comedi_device *dev)
{
if (dev->private)
if (devpriv->valid)
icp_multi_reset(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->private && devpriv->io_addr)
iounmap(devpriv->io_addr);
if (dev->private && devpriv->card)
pci_card_free(devpriv->card);
if (--pci_list_builded == 0)
pci_card_list_cleanup(PCI_VENDOR_ID_ICP);
return 0;
}
static const struct boardtype boardtypes[] = {

View File

@ -264,11 +264,9 @@ static int pci20xxx_attach(struct comedi_device *dev,
return 1;
}
static int pci20xxx_detach(struct comedi_device *dev)
static void pci20xxx_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pci20xxx: remove\n", dev->minor);
return 0;
/* Nothing to cleanup */
}
/* pci20006m */

View File

@ -926,7 +926,7 @@ out:
return result;
}
static int jr3_pci_detach(struct comedi_device *dev)
static void jr3_pci_detach(struct comedi_device *dev)
{
int i;
struct jr3_pci_dev_private *devpriv = dev->private;
@ -938,16 +938,13 @@ static int jr3_pci_detach(struct comedi_device *dev)
for (i = 0; i < devpriv->n_channels; i++)
kfree(dev->subdevices[i].private);
}
if (devpriv->iobase)
iounmap((void *)devpriv->iobase);
if (devpriv->pci_enabled)
comedi_pci_disable(devpriv->pci_dev);
if (devpriv->pci_dev)
pci_dev_put(devpriv->pci_dev);
}
return 0;
}
static struct comedi_driver jr3_pci_driver = {

View File

@ -219,16 +219,13 @@ found:
return 0;
}
static int cnt_detach(struct comedi_device *dev)
static void cnt_detach(struct comedi_device *dev)
{
if (devpriv && devpriv->pcidev) {
if (dev->iobase)
comedi_pci_disable(devpriv->pcidev);
pci_dev_put(devpriv->pcidev);
}
printk(KERN_INFO "comedi%d: " CNT_DRIVER_NAME " remove\n",
dev->minor);
return 0;
}
static struct comedi_driver ke_counter_driver = {

View File

@ -2304,10 +2304,8 @@ static int me4000_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int me4000_detach(struct comedi_device *dev)
static void me4000_detach(struct comedi_device *dev)
{
CALL_PDEBUG("In me4000_detach()\n");
if (info) {
if (info->pci_dev_p) {
reset_board(dev);
@ -2316,8 +2314,6 @@ static int me4000_detach(struct comedi_device *dev)
pci_dev_put(info->pci_dev_p);
}
}
return 0;
}
static struct comedi_driver me4000_driver = {

View File

@ -806,7 +806,7 @@ found:
return 0;
}
static int me_detach(struct comedi_device *dev)
static void me_detach(struct comedi_device *dev)
{
if (dev_private) {
if (dev_private->me_regbase) {
@ -818,11 +818,9 @@ static int me_detach(struct comedi_device *dev)
if (dev_private->pci_device) {
if (dev_private->plx_regbase_size)
comedi_pci_disable(dev_private->pci_device);
pci_dev_put(dev_private->pci_device);
}
}
return 0;
}
static struct comedi_driver me_daq_driver = {

View File

@ -379,14 +379,10 @@ static int mpc624_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static int mpc624_detach(struct comedi_device *dev)
static void mpc624_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: mpc624: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, MPC624_SIZE);
return 0;
}
static struct comedi_driver mpc624_driver = {

View File

@ -148,11 +148,9 @@ static int mpc8260cpm_attach(struct comedi_device *dev,
return 1;
}
static int mpc8260cpm_detach(struct comedi_device *dev)
static void mpc8260cpm_detach(struct comedi_device *dev)
{
printk("comedi%d: mpc8260cpm: remove\n", dev->minor);
return 0;
/* Nothing to cleanup */
}
static struct comedi_driver mpc8260cpm_driver = {

View File

@ -315,16 +315,12 @@ static int multiq3_attach(struct comedi_device *dev,
return 0;
}
static int multiq3_detach(struct comedi_device *dev)
static void multiq3_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: multiq3: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, MULTIQ3_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static struct comedi_driver multiq3_driver = {

View File

@ -78,7 +78,7 @@ Updated: Sat, 25 Jan 2003 13:24:40 -0800
static int ni6527_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int ni6527_detach(struct comedi_device *dev);
static void ni6527_detach(struct comedi_device *dev);
static struct comedi_driver driver_ni6527 = {
.driver_name = "ni6527",
.module = THIS_MODULE,
@ -449,19 +449,15 @@ static int ni6527_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int ni6527_detach(struct comedi_device *dev)
static void ni6527_detach(struct comedi_device *dev)
{
if (devpriv && devpriv->mite && devpriv->mite->daq_io_addr)
writeb(0x00,
devpriv->mite->daq_io_addr + Master_Interrupt_Control);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv && devpriv->mite)
mite_unsetup(devpriv->mite);
return 0;
}
static int ni6527_find_device(struct comedi_device *dev, int bus, int slot)

View File

@ -111,7 +111,7 @@ static inline unsigned Filter_Enable(unsigned port)
static int ni_65xx_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int ni_65xx_detach(struct comedi_device *dev);
static void ni_65xx_detach(struct comedi_device *dev);
static struct comedi_driver driver_ni_65xx = {
.driver_name = "ni_65xx",
.module = THIS_MODULE,
@ -784,7 +784,7 @@ static int ni_65xx_attach(struct comedi_device *dev,
return 0;
}
static int ni_65xx_detach(struct comedi_device *dev)
static void ni_65xx_detach(struct comedi_device *dev)
{
if (private(dev) && private(dev)->mite
&& private(dev)->mite->daq_io_addr) {
@ -792,10 +792,8 @@ static int ni_65xx_detach(struct comedi_device *dev)
private(dev)->mite->daq_io_addr +
Master_Interrupt_Control);
}
if (dev->irq)
free_irq(dev->irq, dev);
if (private(dev)) {
unsigned i;
for (i = 0; i < dev->n_subdevices; ++i) {
@ -805,7 +803,6 @@ static int ni_65xx_detach(struct comedi_device *dev)
if (private(dev)->mite)
mite_unsetup(private(dev)->mite);
}
return 0;
}
static int ni_65xx_find_device(struct comedi_device *dev, int bus, int slot)

View File

@ -458,7 +458,7 @@ static inline const struct ni_660x_board *board(struct comedi_device *dev)
static int ni_660x_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int ni_660x_detach(struct comedi_device *dev);
static void ni_660x_detach(struct comedi_device *dev);
static void init_tio_chip(struct comedi_device *dev, int chipset);
static void ni_660x_select_pfi_output(struct comedi_device *dev,
unsigned pfi_channel,
@ -1188,14 +1188,10 @@ static int ni_660x_attach(struct comedi_device *dev,
return 0;
}
static int ni_660x_detach(struct comedi_device *dev)
static void ni_660x_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: ni_660x: remove\n", dev->minor);
/* Free irq */
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->private) {
if (private(dev)->counter_dev)
ni_gpct_device_destroy(private(dev)->counter_dev);
@ -1204,7 +1200,6 @@ static int ni_660x_detach(struct comedi_device *dev)
mite_unsetup(private(dev)->mite);
}
}
return 0;
}
static int

View File

@ -111,7 +111,7 @@ struct ni_670x_private {
static int ni_670x_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int ni_670x_detach(struct comedi_device *dev);
static void ni_670x_detach(struct comedi_device *dev);
static struct comedi_driver driver_ni_670x = {
.driver_name = "ni_670x",
@ -249,19 +249,13 @@ static int ni_670x_attach(struct comedi_device *dev,
return 1;
}
static int ni_670x_detach(struct comedi_device *dev)
static void ni_670x_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: ni_670x: remove\n", dev->minor);
kfree(dev->subdevices[0].range_table_list);
if (dev->private && devpriv->mite)
mite_unsetup(devpriv->mite);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static int ni_670x_ao_winsn(struct comedi_device *dev,

View File

@ -873,17 +873,12 @@ static int a2150_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
};
static int a2150_detach(struct comedi_device *dev)
static void a2150_detach(struct comedi_device *dev)
{
printk("comedi%d: %s: remove\n", dev->minor, dev->driver->driver_name);
/* only free stuff if it has been allocated by _attach */
if (dev->iobase) {
/* put board in power-down mode */
outw(APD_BIT | DPD_BIT, dev->iobase + CONFIG_REG);
release_region(dev->iobase, A2150_SIZE);
}
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
@ -891,8 +886,6 @@ static int a2150_detach(struct comedi_device *dev)
free_dma(devpriv->dma);
kfree(devpriv->dma_buffer);
}
return 0;
};
static struct comedi_driver ni_at_a2150_driver = {

View File

@ -406,14 +406,10 @@ static int atao_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int atao_detach(struct comedi_device *dev)
static void atao_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: atao: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, ATAO_SIZE);
return 0;
}
static const struct atao_board atao_boards[] = {

View File

@ -497,19 +497,15 @@ static int ni_atmio_attach(struct comedi_device *dev,
return 0;
}
static int ni_atmio_detach(struct comedi_device *dev)
static void ni_atmio_detach(struct comedi_device *dev)
{
mio_common_detach(dev);
if (dev->iobase)
release_region(dev->iobase, NI_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv->isapnp_dev)
pnp_device_detach(devpriv->isapnp_dev);
return 0;
}
static struct comedi_driver ni_atmio_driver = {

View File

@ -829,22 +829,15 @@ static int atmio16d_attach(struct comedi_device *dev,
return 0;
}
static int atmio16d_detach(struct comedi_device *dev)
static void atmio16d_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: atmio16d: remove\n", dev->minor);
if (dev->subdevices && boardtype->has_8255)
subdev_8255_cleanup(dev, dev->subdevices + 3);
if (dev->irq)
free_irq(dev->irq, dev);
reset_atmio16d(dev);
if (dev->iobase)
release_region(dev->iobase, ATMIO16D_SIZE);
return 0;
}
static const struct atmio16_board_t atmio16_boards[] = {

View File

@ -57,7 +57,7 @@ static struct pcmcia_device *pcmcia_cur_dev;
static int dio700_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int dio700_detach(struct comedi_device *dev);
static void dio700_detach(struct comedi_device *dev);
enum dio700_bustype { pcmcia_bustype };
@ -419,19 +419,14 @@ static int dio700_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
};
static int dio700_detach(struct comedi_device *dev)
static void dio700_detach(struct comedi_device *dev)
{
printk(KERN_ERR "comedi%d: ni_daq_700: cs-remove\n", dev->minor);
if (dev->subdevices)
subdev_700_cleanup(dev, dev->subdevices + 0);
if (thisboard->bustype != pcmcia_bustype && dev->iobase)
release_region(dev->iobase, DIO700_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
};
static void dio700_config(struct pcmcia_device *link);
@ -472,18 +467,12 @@ static int dio700_cs_attach(struct pcmcia_device *link)
static void dio700_cs_detach(struct pcmcia_device *link)
{
printk(KERN_INFO "ni_daq_700: cs-detach!\n");
dev_dbg(&link->dev, "dio700_cs_detach\n");
((struct local_info_t *)link->priv)->stop = 1;
dio700_release(link);
/* This points to the parent struct local_info_t struct */
kfree(link->priv);
} /* dio700_cs_detach */
}
static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)

View File

@ -57,7 +57,7 @@ static struct pcmcia_device *pcmcia_cur_dev;
#define DIO24_SIZE 4 /* size of io region used by board */
static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int dio24_detach(struct comedi_device *dev);
static void dio24_detach(struct comedi_device *dev);
enum dio24_bustype { pcmcia_bustype };
@ -168,19 +168,14 @@ static int dio24_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
};
static int dio24_detach(struct comedi_device *dev)
static void dio24_detach(struct comedi_device *dev)
{
dev_info(dev->hw_dev, "comedi%d: ni_daq_dio24: remove\n", dev->minor);
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 0);
if (thisboard->bustype != pcmcia_bustype && dev->iobase)
release_region(dev->iobase, DIO24_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
};
static void dio24_config(struct pcmcia_device *link);
@ -221,18 +216,12 @@ static int dio24_cs_attach(struct pcmcia_device *link)
static void dio24_cs_detach(struct pcmcia_device *link)
{
printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n");
dev_dbg(&link->dev, "dio24_cs_detach\n");
((struct local_info_t *)link->priv)->stop = 1;
dio24_release(link);
/* This points to the parent local_info_t struct */
kfree(link->priv);
} /* dio24_cs_detach */
}
static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)

View File

@ -805,13 +805,10 @@ static int labpc_find_device(struct comedi_device *dev, int bus, int slot)
}
#endif
int labpc_common_detach(struct comedi_device *dev)
void labpc_common_detach(struct comedi_device *dev)
{
printk(KERN_ERR "comedi%d: ni_labpc: detach\n", dev->minor);
if (dev->subdevices)
subdev_8255_cleanup(dev, dev->subdevices + 2);
#ifdef CONFIG_ISA_DMA_API
/* only free stuff if it has been allocated by _attach */
kfree(devpriv->dma_buffer);
@ -826,8 +823,6 @@ int labpc_common_detach(struct comedi_device *dev)
if (devpriv->mite)
mite_unsetup(devpriv->mite);
#endif
return 0;
};
EXPORT_SYMBOL_GPL(labpc_common_detach);

View File

@ -103,7 +103,7 @@ struct labpc_private {
int labpc_common_attach(struct comedi_device *dev, unsigned long iobase,
unsigned int irq, unsigned int dma);
int labpc_common_detach(struct comedi_device *dev);
void labpc_common_detach(struct comedi_device *dev);
extern const int labpc_1200_is_unipolar[];
extern const int labpc_1200_ai_gain_bits[];

View File

@ -188,21 +188,13 @@ static int labpc_cs_attach(struct pcmcia_device *link)
static void labpc_cs_detach(struct pcmcia_device *link)
{
dev_dbg(&link->dev, "labpc_cs_detach\n");
/*
If the device is currently configured and active, we won't
actually delete it yet. Instead, it is marked so that when
the release() function is called, that will trigger a proper
detach().
*/
((struct local_info_t *)link->priv)->stop = 1;
labpc_release(link);
/* This points to the parent local_info_t struct (may be null) */
kfree(link->priv);
} /* labpc_cs_detach */
}
static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
void *priv_data)

View File

@ -227,7 +227,7 @@ static uint16_t mio_cs_win_in(struct comedi_device *dev, int addr)
static int mio_cs_attach(struct comedi_device *dev,
struct comedi_devconfig *it);
static int mio_cs_detach(struct comedi_device *dev);
static void mio_cs_detach(struct comedi_device *dev);
static struct comedi_driver driver_ni_mio_cs = {
.driver_name = "ni_mio_cs",
.module = THIS_MODULE,
@ -240,18 +240,11 @@ static struct comedi_driver driver_ni_mio_cs = {
static int ni_getboardtype(struct comedi_device *dev,
struct pcmcia_device *link);
/* clean up allocated resources */
/* called when driver is removed */
static int mio_cs_detach(struct comedi_device *dev)
static void mio_cs_detach(struct comedi_device *dev)
{
mio_common_detach(dev);
/* PCMCIA layer frees the IO region */
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static void mio_cs_config(struct pcmcia_device *link);
@ -276,8 +269,6 @@ static void cs_release(struct pcmcia_device *link)
static void cs_detach(struct pcmcia_device *link)
{
DPRINTK("cs_detach(link=%p)\n", link);
cs_release(link);
}

View File

@ -1307,7 +1307,7 @@ static int nidio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int nidio_detach(struct comedi_device *dev)
static void nidio_detach(struct comedi_device *dev)
{
int i;
@ -1315,10 +1315,8 @@ static int nidio_detach(struct comedi_device *dev)
for (i = 0; i < this_board->n_8255; i++)
subdev_8255_cleanup(dev, dev->subdevices + i);
}
if (dev->irq)
free_irq(dev->irq, dev);
if (devpriv) {
if (devpriv->di_mite_ring) {
mite_free_ring(devpriv->di_mite_ring);
@ -1327,7 +1325,6 @@ static int nidio_detach(struct comedi_device *dev)
if (devpriv->mite)
mite_unsetup(devpriv->mite);
}
return 0;
}
static struct comedi_driver ni_pcidio_driver = {

View File

@ -1573,13 +1573,11 @@ static void init_6143(struct comedi_device *dev)
ni_writew(devpriv->ai_calib_source, Calibration_Channel_6143);
}
/* cleans up allocated resources */
static int pcimio_detach(struct comedi_device *dev)
static void pcimio_detach(struct comedi_device *dev)
{
mio_common_detach(dev);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->private) {
mite_free_ring(devpriv->ai_mite_ring);
mite_free_ring(devpriv->ao_mite_ring);
@ -1589,8 +1587,6 @@ static int pcimio_detach(struct comedi_device *dev)
if (devpriv->mite)
mite_unsetup(devpriv->mite);
}
return 0;
}
static int pcimio_attach(struct comedi_device *dev, struct comedi_devconfig *it)

View File

@ -591,17 +591,12 @@ static int pcl711_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcl711_detach(struct comedi_device *dev)
static void pcl711_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pcl711: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, PCL711_SIZE);
return 0;
}
static const struct pcl711_board boardtypes[] = {

View File

@ -177,23 +177,17 @@ static int pcl724_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcl724_detach(struct comedi_device *dev)
static void pcl724_detach(struct comedi_device *dev)
{
int i;
/* printk("comedi%d: pcl724: remove\n",dev->minor); */
for (i = 0; i < dev->n_subdevices; i++)
subdev_8255_cleanup(dev, dev->subdevices + i);
#ifdef PCL724_IRQ
if (dev->irq)
free_irq(dev->irq, dev);
#endif
release_region(dev->iobase, this_board->io_range);
return 0;
}
static const struct pcl724_board boardtypes[] = {

View File

@ -89,14 +89,10 @@ static int pcl725_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcl725_detach(struct comedi_device *dev)
static void pcl725_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pcl725: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, PCL725_SIZE);
return 0;
}
static struct comedi_driver pcl725_driver = {

View File

@ -350,19 +350,14 @@ static int pcl726_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcl726_detach(struct comedi_device *dev)
static void pcl726_detach(struct comedi_device *dev)
{
/* printk("comedi%d: pcl726: remove\n",dev->minor); */
#ifdef ACL6126_IRQ
if (dev->irq)
free_irq(dev->irq, dev);
#endif
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
return 0;
}
static struct comedi_driver pcl726_driver = {

View File

@ -134,14 +134,10 @@ static int pcl730_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcl730_detach(struct comedi_device *dev)
static void pcl730_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pcl730: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
return 0;
}
static const struct pcl730_board boardtypes[] = {

View File

@ -1614,14 +1614,9 @@ no_dma:
return 0;
}
static int pcl812_detach(struct comedi_device *dev)
static void pcl812_detach(struct comedi_device *dev)
{
#ifdef PCL812_EXTDEBUG
printk(KERN_DEBUG "comedi%d: pcl812: remove\n", dev->minor);
#endif
free_resources(dev);
return 0;
}
static const struct pcl812_board boardtypes[] = {

View File

@ -1026,40 +1026,6 @@ static int set_rtc_irq_bit(unsigned char bit)
}
#endif
/*
==============================================================================
Free any resources that we have claimed
*/
static void free_resources(struct comedi_device *dev)
{
/* printk("free_resource()\n"); */
if (dev->private) {
pcl816_ai_cancel(dev, devpriv->sub_ai);
pcl816_reset(dev);
if (devpriv->dma)
free_dma(devpriv->dma);
if (devpriv->dmabuf[0])
free_pages(devpriv->dmabuf[0], devpriv->dmapages[0]);
if (devpriv->dmabuf[1])
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused
if (devpriv->rtc_irq)
free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase,
devpriv->rtc_iosize);
}
#endif
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
/* printk("free_resource() end\n"); */
}
static int pcl816_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
int ret;
@ -1285,15 +1251,35 @@ case COMEDI_SUBD_DO:
return 0;
}
static int pcl816_detach(struct comedi_device *dev)
static void pcl816_detach(struct comedi_device *dev)
{
DEBUG(printk(KERN_INFO "comedi%d: pcl816: remove\n", dev->minor);)
free_resources(dev);
if (dev->private) {
pcl816_ai_cancel(dev, devpriv->sub_ai);
pcl816_reset(dev);
if (devpriv->dma)
free_dma(devpriv->dma);
if (devpriv->dmabuf[0])
free_pages(devpriv->dmabuf[0], devpriv->dmapages[0]);
if (devpriv->dmabuf[1])
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused
if (devpriv->rtc_irq)
free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase,
devpriv->rtc_iosize);
}
#endif
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
#ifdef unused
if (devpriv->dma_rtc)
RTC_lock--;
#endif
return 0;
}
static const struct pcl816_board boardtypes[] = {

View File

@ -1634,42 +1634,6 @@ static int rtc_setfreq_irq(int freq)
}
#endif
/*
==============================================================================
Free any resources that we have claimed
*/
static void free_resources(struct comedi_device *dev)
{
/* printk("free_resource()\n"); */
if (dev->private) {
pcl818_ai_cancel(dev, devpriv->sub_ai);
pcl818_reset(dev);
if (devpriv->dma)
free_dma(devpriv->dma);
if (devpriv->dmabuf[0])
free_pages(devpriv->dmabuf[0], devpriv->dmapages[0]);
if (devpriv->dmabuf[1])
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused
if (devpriv->rtc_irq)
free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase,
devpriv->rtc_iosize);
}
if (devpriv->dma_rtc)
RTC_lock--;
#endif
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, devpriv->io_range);
/* printk("free_resource() end\n"); */
}
static int pcl818_attach(struct comedi_device *dev, struct comedi_devconfig *it)
{
int ret;
@ -1960,11 +1924,33 @@ no_dma:
return 0;
}
static int pcl818_detach(struct comedi_device *dev)
static void pcl818_detach(struct comedi_device *dev)
{
/* printk("comedi%d: pcl818: remove\n", dev->minor); */
free_resources(dev);
return 0;
if (dev->private) {
pcl818_ai_cancel(dev, devpriv->sub_ai);
pcl818_reset(dev);
if (devpriv->dma)
free_dma(devpriv->dma);
if (devpriv->dmabuf[0])
free_pages(devpriv->dmabuf[0], devpriv->dmapages[0]);
if (devpriv->dmabuf[1])
free_pages(devpriv->dmabuf[1], devpriv->dmapages[1]);
#ifdef unused
if (devpriv->rtc_irq)
free_irq(devpriv->rtc_irq, dev);
if ((devpriv->dma_rtc) && (RTC_lock == 1)) {
if (devpriv->rtc_iobase)
release_region(devpriv->rtc_iobase,
devpriv->rtc_iosize);
}
if (devpriv->dma_rtc)
RTC_lock--;
#endif
}
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, devpriv->io_range);
}
static const struct pcl818_board boardtypes[] = {

View File

@ -273,7 +273,7 @@ static int pcm3724_attach(struct comedi_device *dev,
return 0;
}
static int pcm3724_detach(struct comedi_device *dev)
static void pcm3724_detach(struct comedi_device *dev)
{
int i;
@ -283,8 +283,6 @@ static int pcm3724_detach(struct comedi_device *dev)
}
if (dev->iobase)
release_region(dev->iobase, this_board->io_range);
return 0;
}
static const struct pcm3724_board boardtypes[] = {

View File

@ -133,14 +133,10 @@ static int pcm3730_attach(struct comedi_device *dev,
return 0;
}
static int pcm3730_detach(struct comedi_device *dev)
static void pcm3730_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pcm3730: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, PCM3730_SIZE);
return 0;
}
static struct comedi_driver pcm3730_driver = {

View File

@ -139,17 +139,12 @@ static int pcmad_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int pcmad_detach(struct comedi_device *dev)
static void pcmad_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: pcmad: remove\n", dev->minor);
if (dev->irq)
free_irq(dev->irq, dev);
if (dev->iobase)
release_region(dev->iobase, PCMAD_SIZE);
return 0;
}
static const struct pcmad_board_struct pcmad_boards[] = {

View File

@ -227,13 +227,10 @@ static int pcmda12_attach(struct comedi_device *dev,
return 1;
}
static int pcmda12_detach(struct comedi_device *dev)
static void pcmda12_detach(struct comedi_device *dev)
{
printk(KERN_INFO
"comedi%d: %s: remove\n", dev->minor, dev->driver->driver_name);
if (dev->iobase)
release_region(dev->iobase, IOSIZE);
return 0;
}
static const struct pcmda12_board pcmda12_boards[] = {

View File

@ -1223,24 +1223,18 @@ static int pcmmio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static int pcmmio_detach(struct comedi_device *dev)
static void pcmmio_detach(struct comedi_device *dev)
{
int i;
printk(KERN_INFO "comedi%d: %s: remove\n", dev->minor,
dev->driver->driver_name);
if (dev->iobase)
release_region(dev->iobase, thisboard->total_iosize);
for (i = 0; i < MAX_ASICS; ++i) {
if (devpriv && devpriv->asics[i].irq)
free_irq(devpriv->asics[i].irq, dev);
}
if (devpriv && devpriv->sprivs)
kfree(devpriv->sprivs);
return 0;
}
static const struct pcmmio_board pcmmio_boards[] = {

View File

@ -908,24 +908,18 @@ static int pcmuio_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static int pcmuio_detach(struct comedi_device *dev)
static void pcmuio_detach(struct comedi_device *dev)
{
int i;
dev_dbg(dev->hw_dev, "comedi%d: %s: remove\n", dev->minor,
dev->driver->driver_name);
if (dev->iobase)
release_region(dev->iobase, ASIC_IOSIZE * thisboard->num_asics);
for (i = 0; i < MAX_ASICS; ++i) {
if (devpriv->asics[i].irq)
free_irq(devpriv->asics[i].irq, dev);
}
if (devpriv && devpriv->sprivs)
kfree(devpriv->sprivs);
return 0;
}
static const struct pcmuio_board pcmuio_boards[] = {

View File

@ -181,15 +181,10 @@ static int poc_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int poc_detach(struct comedi_device *dev)
static void poc_detach(struct comedi_device *dev)
{
/* only free stuff if it has been allocated by _attach */
if (dev->iobase)
release_region(dev->iobase, this_board->iosize);
printk(KERN_INFO "comedi%d: dac02: remove\n", dev->minor);
return 0;
}
static const struct boarddef_struct boards[] = {

View File

@ -181,7 +181,7 @@ static const struct comedi_lrange range_daqp_ao = { 1, {BIP_RANGE(5)} };
/* comedi interface code */
static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it);
static int daqp_detach(struct comedi_device *dev);
static void daqp_detach(struct comedi_device *dev);
static struct comedi_driver driver_daqp = {
.driver_name = "quatech_daqp_cs",
.module = THIS_MODULE,
@ -922,15 +922,9 @@ static int daqp_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
/* daqp_detach (called from comedi_comdig) does nothing. If the PCMCIA
* card is removed, daqp_cs_detach() is called by the pcmcia subsystem.
*/
static int daqp_detach(struct comedi_device *dev)
static void daqp_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: detaching daqp\n", dev->minor);
return 0;
/* Nothing to cleanup */
}
/*====================================================================
@ -1010,8 +1004,6 @@ static void daqp_cs_detach(struct pcmcia_device *link)
{
struct local_info_t *dev = link->priv;
dev_dbg(&link->dev, "daqp_cs_detach\n");
dev->stop = 1;
daqp_cs_release(link);
@ -1019,7 +1011,7 @@ static void daqp_cs_detach(struct pcmcia_device *link)
dev_table[dev->table_index] = NULL;
kfree(dev);
} /* daqp_cs_detach */
}
static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, void *priv_data)
{

View File

@ -1081,30 +1081,12 @@ static int rtd_attach(struct comedi_device *dev, struct comedi_devconfig *it)
#endif
}
/*
* _detach is called to deconfigure a device. It should deallocate
* resources.
* This function is also called when _attach() fails, so it should be
* careful not to release resources that were not necessarily
* allocated by _attach(). dev->private and dev->subdevices are
* deallocated automatically by the core.
*/
static int rtd_detach(struct comedi_device *dev)
static void rtd_detach(struct comedi_device *dev)
{
#ifdef USE_DMA
int index;
#endif
DPRINTK("comedi%d: rtd520: removing (%ld ints)\n",
dev->minor, (devpriv ? devpriv->intCount : 0L));
if (devpriv && devpriv->lcfg) {
DPRINTK
("(int status 0x%x, overrun status 0x%x, fifo status 0x%x)...\n",
0xffff & RtdInterruptStatus(dev),
0xffff & RtdInterruptOverrunStatus(dev),
(0xffff & RtdFifoStatus(dev)) ^ 0x6666);
}
if (devpriv) {
/* Shut down any board ops by resetting it */
#ifdef USE_DMA
@ -1141,37 +1123,24 @@ static int rtd_detach(struct comedi_device *dev)
devpriv->dma0Chain = NULL;
}
#endif /* USE_DMA */
/* release IRQ */
if (dev->irq) {
/* disable interrupt controller */
RtdPlxInterruptWrite(dev, RtdPlxInterruptRead(dev)
& ~(ICS_PLIE | ICS_DMA0_E |
ICS_DMA1_E));
free_irq(dev->irq, dev);
}
/* release all regions that were allocated */
if (devpriv->las0)
iounmap(devpriv->las0);
if (devpriv->las1)
iounmap(devpriv->las1);
if (devpriv->lcfg)
iounmap(devpriv->lcfg);
if (devpriv->pci_dev) {
if (devpriv->got_regions)
comedi_pci_disable(devpriv->pci_dev);
pci_dev_put(devpriv->pci_dev);
}
}
printk(KERN_INFO "comedi%d: rtd520: removed.\n", dev->minor);
return 0;
}
/*

View File

@ -443,17 +443,12 @@ static int rti800_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int rti800_detach(struct comedi_device *dev)
static void rti800_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: rti800: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, RTI800_SIZE);
if (dev->irq)
free_irq(dev->irq, dev);
return 0;
}
static const struct rti800_board boardtypes[] = {

View File

@ -129,14 +129,10 @@ static int rti802_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 0;
}
static int rti802_detach(struct comedi_device *dev)
static void rti802_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: rti802: remove\n", dev->minor);
if (dev->iobase)
release_region(dev->iobase, RTI802_SIZE);
return 0;
}
static struct comedi_driver rti802_driver = {

View File

@ -938,14 +938,10 @@ static int s526_attach(struct comedi_device *dev, struct comedi_devconfig *it)
return 1;
}
static int s526_detach(struct comedi_device *dev)
static void s526_detach(struct comedi_device *dev)
{
printk(KERN_INFO "comedi%d: s526: remove\n", dev->minor);
if (dev->iobase > 0)
release_region(dev->iobase, S526_IOSIZE);
return 0;
}
static struct comedi_driver s526_driver = {

Some files were not shown because too many files have changed in this diff Show More