From: Frank Mori Hess Date: Sun, 11 Jun 2006 19:36:10 +0000 (+0000) Subject: Dropped support for pcmcia on kernels older than 2.6.16, on the X-Git-Tag: r0_7_71~33 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=dc84261023380706ae01a597e183a932acc1a88a;p=comedi.git Dropped support for pcmcia on kernels older than 2.6.16, on the basis that it would be too burdensome to expect people adding new pcmcia drivers to make them work on all the varying pcmcia interfaces provided by different kernels. --- diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index 52cf545a..deb30950 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -630,40 +630,10 @@ static char *version = /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ - -/* The old way: bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -static u_int irq_mask = 0xdeb8; -/* Newer, simpler way of listing specific interrupts */ -static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); -MODULE_PARM(irq_list, "1-4i"); - -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the das08_pcmcia - event handler. - - Kernel version 2.6.16 upwards uses suspend() and resume() functions - instead of an event() function. -*/ - static void das16cs_pcmcia_config(dev_link_t *link); static void das16cs_pcmcia_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev); static int das16cs_pcmcia_resume(struct pcmcia_device *p_dev); -#else -static int das16cs_pcmcia_event(event_t event, int priority, - event_callback_args_t *args); -#endif /* The attach() and detach() entry points are used to create and destroy @@ -671,13 +641,8 @@ static int das16cs_pcmcia_event(event_t event, int priority, needed to manage one actual PCMCIA card. */ -#ifdef COMEDI_PCMCIA_2_6_16 static int das16cs_pcmcia_attach(struct pcmcia_device *); static void das16cs_pcmcia_detach(struct pcmcia_device *); -#else -static dev_link_t *das16cs_pcmcia_attach(void); -static void das16cs_pcmcia_detach(dev_link_t *); -#endif /* You'll also need to prototype all the functions that will actually @@ -742,45 +707,23 @@ typedef struct local_info_t { ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static int das16cs_pcmcia_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *das16cs_pcmcia_attach(void) -#endif { local_info_t *local; dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif - int i; DEBUG(0, "das16cs_pcmcia_attach()\n"); /* Allocate space for private device-specific data */ local = kmalloc(sizeof(local_info_t), GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if (!local) return -ENOMEM; -#else - if (!local) return NULL; -#endif memset(local, 0, sizeof(local_info_t)); link = &local->link; link->priv = local; /* Initialize the dev_link_t structure */ -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - link->release.function = &das16cs_pcmcia_release; - link->release.data = (u_long)link; -#endif /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; - if (irq_list[0] == -1) - link->irq.IRQInfo2 = irq_mask; - else - for (i = 0; i < 4; i++) - link->irq.IRQInfo2 |= 1 << irq_list[i]; link->irq.Handler = NULL; /* @@ -797,35 +740,12 @@ static dev_link_t *das16cs_pcmcia_attach(void) link->next = dev_list; dev_list = link; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; das16cs_pcmcia_config(link); return 0; -#else - /* Register with Card Services */ - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &das16cs_pcmcia_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - das16cs_pcmcia_detach(link); - return NULL; - } - - return link; -#endif } /* das16cs_pcmcia_attach */ /*====================================================================== @@ -837,15 +757,9 @@ static dev_link_t *das16cs_pcmcia_attach(void) ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static void das16cs_pcmcia_detach(struct pcmcia_device *p_dev) -#else -static void das16cs_pcmcia_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif dev_link_t **linkp; DEBUG(0, "das16cs_pcmcia_detach(0x%p)\n", link); @@ -864,30 +778,13 @@ static void das16cs_pcmcia_detach(dev_link_t *link) */ if (link->state & DEV_CONFIG) { -#ifdef COMEDI_PCMCIA_2_6_16 ((local_info_t *)link->priv)->stop = 1; das16cs_pcmcia_release((u_long)link); -#else -#ifdef PCMCIA_DEBUG - printk(KERN_DEBUG "das16cs: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); -#endif - link->state |= DEV_STALE_LINK; - return; -#endif } - -#ifndef COMEDI_PCMCIA_2_6_16 - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); -#endif - /* Unlink device structure, and free it */ *linkp = link->next; /* This points to the parent local_info_t struct */ kfree(link->priv); - } /* das16cs_pcmcia_detach */ /*====================================================================== @@ -1088,21 +985,6 @@ static void das16cs_pcmcia_release(u_long arg) DEBUG(0, "das16cs_pcmcia_release(0x%p)\n", link); -#ifndef COMEDI_PCMCIA_2_6_16 - /* - If the device is currently in use, we won't release until it - is actually closed, because until then, we can't be sure that - no one will try to access the device or its data structures. - */ - if (link->open) - { - DEBUG(1, "das16cs: release postponed, '%s' still open\n", - link->dev->dev_name); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - /* Unlink the device chain */ link->dev = NULL; @@ -1120,84 +1002,8 @@ static void das16cs_pcmcia_release(u_long arg) if (link->irq.AssignedIRQ) pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; - -#ifndef COMEDI_PCMCIA_2_6_16 - if (link->state & DEV_STALE_LINK) - das16cs_pcmcia_detach(link); -#endif - } /* das16cs_pcmcia_release */ -/*====================================================================== - - The card status event handler. Mostly, this schedules other - stuff to run after an event is received. - - When a CARD_REMOVAL event is received, we immediately set a - private flag to block future accesses to this device. All the - functions that actually access the device should check this flag - to make sure the card is still present. - -======================================================================*/ - -#ifndef COMEDI_PCMCIA_2_6_16 -static int das16cs_pcmcia_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - local_info_t *dev = link->priv; - - DEBUG(1, "das16cs_pcmcia_event(0x%06x)\n", event); - - switch (event) - { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) - { - ((local_info_t *)link->priv)->stop = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - mod_timer(&link->release, jiffies + HZ/20); -#else - das16cs_pcmcia_release((u_long)link); -#endif - } - break; - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - dev->bus = args->bus; -#endif - das16cs_pcmcia_config(link); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - dev->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - dev->stop = 0; -/* -In a normal driver, additional code may go here to restore -the device state and restart IO. -*/ - break; - } - - return 0; -} /* das16cs_pcmcia_event */ -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int das16cs_pcmcia_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -1223,26 +1029,15 @@ static int das16cs_pcmcia_resume(struct pcmcia_device *p_dev) local->stop = 0; return 0; } /* das16cs_pcmcia_resume */ -#endif /*====================================================================*/ struct pcmcia_driver das16cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = das16cs_pcmcia_attach, .remove = das16cs_pcmcia_detach, .suspend = das16cs_pcmcia_suspend, .resume = das16cs_pcmcia_resume, -#else - .attach = das16cs_pcmcia_attach, - .detach = das16cs_pcmcia_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = das16cs_pcmcia_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = NULL, /* FIXME */ -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -1262,20 +1057,13 @@ static void __exit exit_das16cs_pcmcia_cs(void) pcmcia_unregister_driver(&das16cs_driver); while (dev_list != NULL) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - del_timer(&dev_list->release); -#endif if (dev_list->state & DEV_CONFIG) das16cs_pcmcia_release((u_long)dev_list); -#ifndef COMEDI_PCMCIA_2_6_16 - das16cs_pcmcia_detach(dev_list); -#else das16cs_pcmcia_detach(dev_list->handle); -#endif } } -int init_module(void) +int __init init_module(void) { int ret; @@ -1286,7 +1074,7 @@ int init_module(void) return comedi_driver_register(&driver_das16cs); } -void cleanup_module(void) +void __exit cleanup_module(void) { exit_das16cs_pcmcia_cs(); comedi_driver_unregister(&driver_das16cs); diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index a9f07cd0..3d6a30d3 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -138,41 +138,10 @@ static char *version = #endif /*====================================================================*/ - -/* Parameters that can be set with 'insmod' */ - -/* The old way: bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -static u_int irq_mask = 0xdeb8; -/* Newer, simpler way of listing specific interrupts */ -static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); -MODULE_PARM(irq_list, "1-4i"); - -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the das08_pcmcia - event handler. - - Kernel version 2.6.16 upwards uses suspend() and resume() functions - instead of an event() function. -*/ - static void das08_pcmcia_config(dev_link_t *link); static void das08_pcmcia_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static int das08_pcmcia_suspend(struct pcmcia_device *p_dev); static int das08_pcmcia_resume(struct pcmcia_device *p_dev); -#else -static int das08_pcmcia_event(event_t event, int priority, - event_callback_args_t *args); -#endif /* The attach() and detach() entry points are used to create and destroy @@ -180,13 +149,8 @@ static int das08_pcmcia_event(event_t event, int priority, needed to manage one actual PCMCIA card. */ -#ifdef COMEDI_PCMCIA_2_6_16 static int das08_pcmcia_attach(struct pcmcia_device *); static void das08_pcmcia_detach(struct pcmcia_device *); -#else -static dev_link_t *das08_pcmcia_attach(void); -static void das08_pcmcia_detach(dev_link_t *); -#endif /* You'll also need to prototype all the functions that will actually @@ -251,45 +215,22 @@ typedef struct local_info_t { ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static int das08_pcmcia_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *das08_pcmcia_attach(void) -#endif { local_info_t *local; dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif - int i; DEBUG(0, "das08_pcmcia_attach()\n"); /* Allocate space for private device-specific data */ local = kmalloc(sizeof(local_info_t), GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if (!local) return -ENOMEM; -#else - if (!local) return NULL; -#endif memset(local, 0, sizeof(local_info_t)); link = &local->link; link->priv = local; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - /* Initialize the dev_link_t structure */ - link->release.function = &das08_pcmcia_release; - link->release.data = (u_long)link; -#endif /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; - if (irq_list[0] == -1) - link->irq.IRQInfo2 = irq_mask; - else - for (i = 0; i < 4; i++) - link->irq.IRQInfo2 |= 1 << irq_list[i]; link->irq.Handler = NULL; /* @@ -306,35 +247,12 @@ static dev_link_t *das08_pcmcia_attach(void) link->next = dev_list; dev_list = link; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; das08_pcmcia_config(link); return 0; -#else - /* Register with Card Services */ - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &das08_pcmcia_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - das08_pcmcia_detach(link); - return NULL; - } - - return link; -#endif } /* das08_pcmcia_attach */ /*====================================================================== @@ -346,15 +264,9 @@ static dev_link_t *das08_pcmcia_attach(void) ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static void das08_pcmcia_detach(struct pcmcia_device *p_dev) -#else -static void das08_pcmcia_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif dev_link_t **linkp; DEBUG(0, "das08_pcmcia_detach(0x%p)\n", link); @@ -373,25 +285,10 @@ static void das08_pcmcia_detach(dev_link_t *link) */ if (link->state & DEV_CONFIG) { -#ifdef COMEDI_PCMCIA_2_6_16 ((local_info_t *)link->priv)->stop = 1; das08_pcmcia_release((u_long)link); -#else -#ifdef PCMCIA_DEBUG - printk(KERN_DEBUG "das08: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); -#endif - link->state |= DEV_STALE_LINK; - return; -#endif } -#ifndef COMEDI_PCMCIA_2_6_16 - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); -#endif - /* Unlink device structure, and free it */ *linkp = link->next; /* This points to the parent local_info_t struct */ @@ -598,21 +495,6 @@ static void das08_pcmcia_release(u_long arg) DEBUG(0, "das08_pcmcia_release(0x%p)\n", link); -#ifndef COMEDI_PCMCIA_2_6_16 - /* - If the device is currently in use, we won't release until it - is actually closed, because until then, we can't be sure that - no one will try to access the device or its data structures. - */ - if (link->open) - { - DEBUG(1, "das08: release postponed, '%s' still open\n", - link->dev->dev_name); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - /* Unlink the device chain */ link->dev = NULL; @@ -631,11 +513,6 @@ static void das08_pcmcia_release(u_long arg) pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; -#ifndef COMEDI_PCMCIA_2_6_16 - if (link->state & DEV_STALE_LINK) - das08_pcmcia_detach(link); -#endif - } /* das08_pcmcia_release */ /*====================================================================== @@ -650,64 +527,6 @@ static void das08_pcmcia_release(u_long arg) ======================================================================*/ -#ifndef COMEDI_PCMCIA_2_6_16 -static int das08_pcmcia_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - local_info_t *dev = link->priv; - - DEBUG(1, "das08_pcmcia_event(0x%06x)\n", event); - - switch (event) - { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) - { - ((local_info_t *)link->priv)->stop = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - mod_timer(&link->release, jiffies + HZ/20); -#else - das08_pcmcia_release((ulong)link); -#endif - } - break; - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - dev->bus = args->bus; -#endif - das08_pcmcia_config(link); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - dev->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - dev->stop = 0; -/* -In a normal driver, additional code may go here to restore -the device state and restart IO. -*/ - break; - } - - return 0; -} /* das08_pcmcia_event */ -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int das08_pcmcia_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -733,27 +552,16 @@ static int das08_pcmcia_resume(struct pcmcia_device *p_dev) local->stop = 0; return 0; } /* das08_pcmcia_resume */ -#endif /*====================================================================*/ struct pcmcia_driver das08_cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = das08_pcmcia_attach, .remove = das08_pcmcia_detach, .suspend = das08_pcmcia_suspend, .resume = das08_pcmcia_resume, -#else - .attach = &das08_pcmcia_attach, - .detach = &das08_pcmcia_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = &das08_pcmcia_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = NULL, /* FIXME */ -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -773,16 +581,9 @@ static void __exit exit_das08_pcmcia_cs(void) pcmcia_unregister_driver(&das08_cs_driver); while (dev_list != NULL) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - del_timer(&dev_list->release); -#endif if (dev_list->state & DEV_CONFIG) das08_pcmcia_release((u_long)dev_list); -#ifndef COMEDI_PCMCIA_2_6_16 - das08_pcmcia_detach(dev_list); -#else das08_pcmcia_detach(dev_list->handle); -#endif } } diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index f19b3f58..3263550c 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -220,40 +220,10 @@ static char *version = /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ - -/* The old way: bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -static u_int irq_mask = 0xdeb8; -/* Newer, simpler way of listing specific interrupts */ -static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); -MODULE_PARM(irq_list, "1-4i"); - -/*====================================================================*/ - -/* - The event() function is this driver's Card Services event handler. - It will be called by Card Services when an appropriate card status - event is received. The config() and release() entry points are - used to configure or release a socket, in response to card - insertion and ejection events. They are invoked from the dummy - event handler. - - Kernel version 2.6.16 upwards uses suspend() and resume() functions - instead of an event() function. -*/ - static void dio24_config(dev_link_t *link); static void dio24_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static int dio24_cs_suspend(struct pcmcia_device *p_dev); static int dio24_cs_resume(struct pcmcia_device *p_dev); -#else -static int dio24_event(event_t event, int priority, - event_callback_args_t *args); -#endif /* The attach() and detach() entry points are used to create and destroy @@ -261,13 +231,8 @@ static int dio24_event(event_t event, int priority, needed to manage one actual PCMCIA card. */ -#ifdef COMEDI_PCMCIA_2_6_16 static int dio24_cs_attach(struct pcmcia_device *); static void dio24_cs_detach(struct pcmcia_device *); -#else -static dev_link_t *dio24_cs_attach(void); -static void dio24_cs_detach(dev_link_t *); -#endif /* You'll also need to prototype all the functions that will actually @@ -332,19 +297,10 @@ typedef struct local_info_t { ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static int dio24_cs_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *dio24_cs_attach(void) -#endif { local_info_t *local; dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif - int i; printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - CS-attach!\n"); @@ -352,27 +308,13 @@ static dev_link_t *dio24_cs_attach(void) /* Allocate space for private device-specific data */ local = kmalloc(sizeof(local_info_t), GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if (!local) return -ENOMEM; -#else - if (!local) return NULL; -#endif memset(local, 0, sizeof(local_info_t)); link = &local->link; link->priv = local; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - /* Initialize the dev_link_t structure */ - link->release.function = &dio24_release; - link->release.data = (u_long)link; -#endif /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; - if (irq_list[0] == -1) - link->irq.IRQInfo2 = irq_mask; - else - for (i = 0; i < 4; i++) - link->irq.IRQInfo2 |= 1 << irq_list[i]; link->irq.Handler = NULL; /* @@ -389,35 +331,12 @@ static dev_link_t *dio24_cs_attach(void) link->next = pcmcia_dev_list; pcmcia_dev_list = link; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; dio24_config(link); return 0; -#else - /* Register with Card Services */ - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &dio24_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - dio24_cs_detach(link); - return NULL; - } - - return link; -#endif } /* dio24_cs_attach */ /*====================================================================== @@ -429,15 +348,9 @@ static dev_link_t *dio24_cs_attach(void) ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static void dio24_cs_detach(struct pcmcia_device *p_dev) -#else -static void dio24_cs_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif dev_link_t **linkp; printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - cs-detach!\n"); @@ -457,25 +370,10 @@ static void dio24_cs_detach(dev_link_t *link) detach(). */ if (link->state & DEV_CONFIG) { -#ifdef COMEDI_PCMCIA_2_6_16 ((local_info_t *)link->priv)->stop = 1; dio24_release((u_long)link); -#else -#ifdef PCMCIA_DEBUG - printk(KERN_DEBUG "ni_daq_dio24: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); -#endif - link->state |= DEV_STALE_LINK; - return; -#endif } -#ifndef COMEDI_PCMCIA_2_6_16 - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); -#endif - /* Unlink device structure, and free it */ *linkp = link->next; /* This points to the parent local_info_t struct */ @@ -733,20 +631,6 @@ static void dio24_release(u_long arg) DEBUG(0, "dio24_release(0x%p)\n", link); -#ifndef COMEDI_PCMCIA_2_6_16 - /* - If the device is currently in use, we won't release until it - is actually closed, because until then, we can't be sure that - no one will try to access the device or its data structures. - */ - if (link->open) { - DEBUG(1, "ni_dio24: release postponed, '%s' still open\n", - link->dev->dev_name); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - /* Unlink the device chain */ link->dev = NULL; @@ -765,11 +649,6 @@ static void dio24_release(u_long arg) pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; -#ifndef COMEDI_PCMCIA_2_6_16 - if (link->state & DEV_STALE_LINK) - dio24_cs_detach(link); -#endif - } /* dio24_release */ /*====================================================================== @@ -784,59 +663,7 @@ static void dio24_release(u_long arg) ======================================================================*/ -#ifndef COMEDI_PCMCIA_2_6_16 -static int dio24_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - local_info_t *dev = link->priv; - DEBUG(1, "dio24_event(0x%06x)\n", event); - - switch (event) { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) { - ((local_info_t *)link->priv)->stop = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - mod_timer(&link->release, jiffies + HZ/20); -#else - dio24_release((u_long)pcmcia_dev_list); -#endif - } - break; - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; -// dev->bus = args->bus; - dio24_config(link); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - dev->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - dev->stop = 0; - /* - In a normal driver, additional code may go here to restore - the device state and restart IO. - */ - break; - } - return 0; -} /* dio24_event */ -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int dio24_cs_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -862,11 +689,9 @@ static int dio24_cs_resume(struct pcmcia_device *p_dev) local->stop = 0; return 0; } /* dio24_cs_resume */ -#endif /*====================================================================*/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) static struct pcmcia_device_id dio24_cs_ids[] = { /* N.B. These IDs should match those in dio24_boards */ @@ -875,25 +700,14 @@ static struct pcmcia_device_id dio24_cs_ids[] = }; MODULE_DEVICE_TABLE(pcmcia, dio24_cs_ids); -#endif struct pcmcia_driver dio24_cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = dio24_cs_attach, .remove = dio24_cs_detach, .suspend = dio24_cs_suspend, .resume = dio24_cs_resume, -#else - .attach = &dio24_cs_attach, - .detach = &dio24_cs_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = &dio24_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = dio24_cs_ids, -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -913,16 +727,9 @@ static void __exit exit_dio24_cs(void) DEBUG(0, "ni_dio24: unloading\n"); pcmcia_unregister_driver(&dio24_cs_driver); while (pcmcia_dev_list != NULL) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - del_timer(&pcmcia_dev_list->release); -#endif if (pcmcia_dev_list->state & DEV_CONFIG) dio24_release((u_long)pcmcia_dev_list); -#ifndef COMEDI_PCMCIA_2_6_16 - dio24_cs_detach(pcmcia_dev_list); -#else dio24_cs_detach(pcmcia_dev_list->handle); -#endif } } diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index a2223cf5..31dc5a33 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -154,19 +154,6 @@ static char *version = /*====================================================================*/ -/* Parameters that can be set with 'insmod' */ - -/* The old way: bit map of interrupts to choose from */ -/* This means pick from 15, 14, 12, 11, 10, 9, 7, 5, 4, and 3 */ -static u_int irq_mask = 0xdeb8; -/* Newer, simpler way of listing specific interrupts */ -static int irq_list[4] = { -1 }; - -MODULE_PARM(irq_mask, "i"); -MODULE_PARM(irq_list, "1-4i"); - -/*====================================================================*/ - /* The event() function is this driver's Card Services event handler. It will be called by Card Services when an appropriate card status @@ -181,13 +168,8 @@ MODULE_PARM(irq_list, "1-4i"); static void labpc_config(dev_link_t *link); static void labpc_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static int labpc_cs_suspend(struct pcmcia_device *p_dev); static int labpc_cs_resume(struct pcmcia_device *p_dev); -#else -static int labpc_event(event_t event, int priority, - event_callback_args_t *args); -#endif /* The attach() and detach() entry points are used to create and destroy @@ -195,13 +177,8 @@ static int labpc_event(event_t event, int priority, needed to manage one actual PCMCIA card. */ -#ifdef COMEDI_PCMCIA_2_6_16 static int labpc_cs_attach(struct pcmcia_device *); static void labpc_cs_detach(struct pcmcia_device *); -#else -static dev_link_t *labpc_cs_attach(void); -static void labpc_cs_detach(dev_link_t *); -#endif /* You'll also need to prototype all the functions that will actually @@ -267,44 +244,22 @@ typedef struct local_info_t { ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static int labpc_cs_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *labpc_cs_attach(void) -#endif { local_info_t *local; dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif - int i; DEBUG(0, "labpc_cs_attach()\n"); /* Allocate space for private device-specific data */ local = kmalloc(sizeof(local_info_t), GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if (!local) return -ENOMEM; -#else - if (!local) return NULL; -#endif memset(local, 0, sizeof(local_info_t)); link = &local->link; link->priv = local; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - /* Initialize the dev_link_t structure */ - link->release.function = &labpc_release; - link->release.data = (u_long)link; -#endif /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_FORCED_PULSE; link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_PULSE_ID; - if (irq_list[0] == -1) - link->irq.IRQInfo2 = irq_mask; - else for (i = 0; i < 4; i++) - link->irq.IRQInfo2 |= 1 << irq_list[i]; link->irq.Handler = NULL; /* @@ -321,35 +276,12 @@ static dev_link_t *labpc_cs_attach(void) link->next = pcmcia_dev_list; pcmcia_dev_list = link; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; labpc_config(link); return 0; -#else - /* Register with Card Services */ - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &labpc_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - labpc_cs_detach(link); - return NULL; - } - - return link; -#endif } /* labpc_cs_attach */ /*====================================================================== @@ -361,15 +293,9 @@ static dev_link_t *labpc_cs_attach(void) ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static void labpc_cs_detach(struct pcmcia_device *p_dev) -#else -static void labpc_cs_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif dev_link_t **linkp; DEBUG(0, "labpc_cs_detach(0x%p)\n", link); @@ -387,25 +313,10 @@ static void labpc_cs_detach(dev_link_t *link) detach(). */ if (link->state & DEV_CONFIG) { -#ifdef COMEDI_PCMCIA_2_6_16 ((local_info_t *)link->priv)->stop = 1; labpc_release((u_long)link); -#else -#ifdef PCMCIA_DEBUG - printk(KERN_DEBUG "ni_labpc: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); -#endif - link->state |= DEV_STALE_LINK; - return; -#endif } -#ifndef COMEDI_PCMCIA_2_6_16 - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); -#endif - /* Unlink device structure, and free it */ *linkp = link->next; /* This points to the parent local_info_t struct */ @@ -657,20 +568,6 @@ static void labpc_release(u_long arg) DEBUG(0, "labpc_release(0x%p)\n", link); -#ifndef COMEDI_PCMCIA_2_6_16 - /* - If the device is currently in use, we won't release until it - is actually closed, because until then, we can't be sure that - no one will try to access the device or its data structures. - */ - if (link->open) { - DEBUG(1, "ni_labpc: release postponed, '%s' still open\n", - link->dev->dev_name); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - /* Unlink the device chain */ link->dev = NULL; @@ -689,11 +586,6 @@ static void labpc_release(u_long arg) pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; -#ifndef COMEDI_PCMCIA_2_6_16 - if (link->state & DEV_STALE_LINK) - labpc_cs_detach(link); -#endif - } /* labpc_release */ /*====================================================================== @@ -708,59 +600,6 @@ static void labpc_release(u_long arg) ======================================================================*/ -#ifndef COMEDI_PCMCIA_2_6_16 -static int labpc_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - local_info_t *dev = link->priv; - - DEBUG(1, "labpc_event(0x%06x)\n", event); - - switch (event) { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) { - ((local_info_t *)link->priv)->stop = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - mod_timer(&link->release, jiffies + HZ/20); -#else - labpc_release((ulong)link); -#endif - } - break; - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; -// dev->bus = args->bus; - labpc_config(link); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - dev->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - dev->stop = 0; - /* - In a normal driver, additional code may go here to restore - the device state and restart IO. - */ - break; - } - return 0; -} /* labpc_event */ -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int labpc_cs_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -786,11 +625,9 @@ static int labpc_cs_resume(struct pcmcia_device *p_dev) local->stop = 0; return 0; } /* labpc_cs_resume */ -#endif /*====================================================================*/ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) static struct pcmcia_device_id labpc_cs_ids[] = { /* N.B. These IDs should match those in labpc_cs_boards (ni_labpc.c) */ @@ -799,25 +636,14 @@ static struct pcmcia_device_id labpc_cs_ids[] = }; MODULE_DEVICE_TABLE(pcmcia, labpc_cs_ids); -#endif struct pcmcia_driver labpc_cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = labpc_cs_attach, .remove = labpc_cs_detach, .suspend = labpc_cs_suspend, .resume = labpc_cs_resume, -#else - .attach = labpc_cs_attach, - .detach = labpc_cs_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = &labpc_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = labpc_cs_ids, -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -836,16 +662,9 @@ static void __exit exit_labpc_cs(void) DEBUG(0, "ni_labpc: unloading\n"); pcmcia_unregister_driver(&labpc_cs_driver); while (pcmcia_dev_list != NULL) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - del_timer(&pcmcia_dev_list->release); -#endif if (pcmcia_dev_list->state & DEV_CONFIG) labpc_release((u_long)pcmcia_dev_list); -#ifndef COMEDI_PCMCIA_2_6_16 - labpc_cs_detach(pcmcia_dev_list); -#else labpc_cs_detach(pcmcia_dev_list->handle); -#endif } } diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index 9d35ac5d..4cb785d5 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -251,11 +251,7 @@ static int mio_cs_detach(comedi_device *dev) static void mio_cs_config(dev_link_t *link); static void cs_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static void cs_detach(struct pcmcia_device *); -#else -static void cs_detach(dev_link_t *); -#endif static int irq_mask; static dev_link_t *dev_list = NULL; @@ -265,34 +261,14 @@ static dev_node_t dev_node = { COMEDI_MAJOR,0, NULL }; -#ifndef COMEDI_PCMCIA_2_6_16 -static int mio_cs_event(event_t event, int priority, event_callback_args_t *args); -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int cs_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *cs_attach(void) -#endif { dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif link=kmalloc(sizeof(*link),GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if(!link)return -ENOMEM; -#else - if(!link)return NULL; -#endif memset(link,0,sizeof(*link)); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - link->release.function = &cs_release; - link->release.data = (u_long)link; -#endif link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; link->io.NumPorts1 = 16; link->irq.Attributes = IRQ_TYPE_EXCLUSIVE; @@ -305,35 +281,12 @@ static dev_link_t *cs_attach(void) link->next = dev_list; dev_list = link; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; mio_cs_config(link); return 0; -#else - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &mio_cs_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - printk("detaching...\n"); - cs_detach(link); - return NULL; - } - - return link; -#endif } static void cs_release(u_long arg) @@ -347,15 +300,9 @@ static void cs_release(u_long arg) link->state &= ~DEV_CONFIG; } -#ifdef COMEDI_PCMCIA_2_6_16 static void cs_detach(struct pcmcia_device *p_dev) -#else -static void cs_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif dev_link_t **linkp; DPRINTK("cs_detach(link=%p)\n",link); @@ -369,88 +316,19 @@ static void cs_detach(dev_link_t *link) //cli if (link->state & DEV_RELEASE_PENDING){ printk("dev release pending bug\n"); -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - del_timer(&link->release); -#endif link->state &= ~DEV_RELEASE_PENDING; } //restore_flags if(link->state & DEV_CONFIG) { cs_release((u_long)link); -#ifndef COMEDI_PCMCIA_2_6_16 - if(link->state & DEV_STALE_CONFIG) { - link->state |= DEV_STALE_LINK; - return; - } -#endif } -#ifndef COMEDI_PCMCIA_2_6_16 - if(link->handle){ - pcmcia_deregister_client(link->handle); - } -#endif - /* Unlink device structure, and free it */ *linkp = link->next; kfree(link); } -#ifndef COMEDI_PCMCIA_2_6_16 -static int mio_cs_event(event_t event, int priority, event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - - DPRINTK("mio_cs_event(event=%x,priority=%d,args=%p)\n",event,priority,args); - - switch(event){ - case CS_EVENT_CARD_REMOVAL: - DPRINTK("removal event\n"); - link->state &= ~DEV_PRESENT; - if(link->state & DEV_CONFIG) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - link->release.expires = jiffies+HZ/20; - link->state |= DEV_RELEASE_PENDING; - add_timer(&link->release); -#else - cs_release((ulong)link); -#endif - } - /* XXX disable irq here, to get rid of spurious interrupts */ - break; - case CS_EVENT_CARD_INSERTION: - DPRINTK("card insertion event\n"); - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - mio_cs_config(link); - break; - case CS_EVENT_PM_SUSPEND: - DPRINTK("pm suspend event\n"); - link->state |= DEV_SUSPEND; - /* fall through */ - case CS_EVENT_RESET_PHYSICAL: - DPRINTK("reset physical event\n"); - if(link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - DPRINTK("pm resume event\n"); - link->state &= ~DEV_SUSPEND; - /* fall through */ - case CS_EVENT_CARD_RESET: - DPRINTK("card reset event\n"); - if(DEV_OK(link)) - pcmcia_request_configuration(link->handle, &link->conf); - break; - default: - DPRINTK("unknown event (ignored)\n"); - } - return 0; -} -#endif - - -#ifdef COMEDI_PCMCIA_2_6_16 static int mio_cs_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -474,9 +352,6 @@ static int mio_cs_resume(struct pcmcia_device *p_dev) return 0; } -#endif - - static void mio_cs_config(dev_link_t *link) { @@ -679,7 +554,6 @@ static int ni_getboardtype(comedi_device *dev,dev_link_t *link) MODULE_LICENSE("GPL"); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) static struct pcmcia_device_id ni_mio_cs_ids[] = { PCMCIA_DEVICE_MANF_CARD(0x010b, 0x010d), /* DAQCard-ai-16xe-50 */ @@ -691,25 +565,14 @@ static struct pcmcia_device_id ni_mio_cs_ids[] = }; MODULE_DEVICE_TABLE(pcmcia, ni_mio_cs_ids); -#endif struct pcmcia_driver ni_mio_cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = &cs_attach, .remove = &cs_detach, .suspend = &mio_cs_suspend, .resume = &mio_cs_resume, -#else - .attach = &cs_attach, - .detach = &cs_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = &mio_cs_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = ni_mio_cs_ids, -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -728,11 +591,7 @@ void cleanup_module(void) pcmcia_unregister_driver(&ni_mio_cs_driver); #if 0 while(dev_list != NULL) -#ifndef COMEDI_PCMCIA_2_6_16 - cs_detach(dev_list); -#else cs_detach(dev_list->handle); -#endif #endif comedi_driver_unregister(&driver_ni_mio_cs); } diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index 611ee21a..f8389fe5 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -1061,13 +1061,8 @@ static int daqp_detach(comedi_device *dev) static void daqp_cs_config(dev_link_t *link); static void daqp_cs_release(u_long arg); -#ifdef COMEDI_PCMCIA_2_6_16 static int daqp_cs_suspend(struct pcmcia_device *p_dev); static int daqp_cs_resume(struct pcmcia_device *p_dev); -#else -static int daqp_cs_event(event_t event, int priority, - event_callback_args_t *args); -#endif /* The attach() and detach() entry points are used to create and destroy @@ -1075,13 +1070,8 @@ static int daqp_cs_event(event_t event, int priority, needed to manage one actual PCMCIA card. */ -#ifdef COMEDI_PCMCIA_2_6_16 static int daqp_cs_attach(struct pcmcia_device *); static void daqp_cs_detach(struct pcmcia_device *); -#else -static dev_link_t *daqp_cs_attach(void); -static void daqp_cs_detach(dev_link_t *); -#endif /* The dev_info variable is the "key" that is used to match up this @@ -1104,18 +1094,10 @@ static dev_info_t dev_info = "quatech_daqp_cs"; ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static int daqp_cs_attach(struct pcmcia_device *p_dev) -#else -static dev_link_t *daqp_cs_attach(void) -#endif { local_info_t *local; dev_link_t *link; -#ifndef COMEDI_PCMCIA_2_6_16 - client_reg_t client_reg; - int ret; -#endif int i; DEBUG(0, "daqp_cs_attach()\n"); @@ -1124,33 +1106,20 @@ static dev_link_t *daqp_cs_attach(void) if (dev_table[i] == NULL) break; if (i == MAX_DEV) { printk(KERN_NOTICE "daqp_cs: no devices available\n"); -#ifdef COMEDI_PCMCIA_2_6_16 return -ENODEV; -#else - return NULL; -#endif } /* Allocate space for private device-specific data */ local = kmalloc(sizeof(local_info_t), GFP_KERNEL); -#ifdef COMEDI_PCMCIA_2_6_16 if (!local) return -ENOMEM; -#else - if (!local) return NULL; -#endif memset(local, 0, sizeof(local_info_t)); local->table_index = i; dev_table[i] = local; link = &local->link; link->priv = local; - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - /* Initialize the dev_link_t structure */ - link->release.function = &daqp_cs_release; - link->release.data = (u_long)link; -#endif - /* Interrupt setup */ + + /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT; link->irq.IRQInfo1 = IRQ_INFO2_VALID|IRQ_LEVEL_ID; if (irq_list[0] == -1) @@ -1172,35 +1141,12 @@ static dev_link_t *daqp_cs_attach(void) link->conf.Vcc = 50; link->conf.IntType = INT_MEMORY_AND_IO; -#ifdef COMEDI_PCMCIA_2_6_16 link->handle = p_dev; p_dev->instance = link; link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; daqp_cs_config(link); return 0; -#else - /* Register with Card Services */ - client_reg.dev_info = &dev_info; - client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,13) - client_reg.EventMask = - CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL | - CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET | - CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME; - client_reg.event_handler = &daqp_cs_event; -#endif - client_reg.Version = 0x0210; - client_reg.event_callback_args.client_data = link; - ret = pcmcia_register_client(&link->handle, &client_reg); - if (ret != CS_SUCCESS) { - cs_error(link->handle, RegisterClient, ret); - daqp_cs_detach(link); - return NULL; - } - - return link; -#endif } /* daqp_cs_attach */ /*====================================================================== @@ -1212,15 +1158,9 @@ static dev_link_t *daqp_cs_attach(void) ======================================================================*/ -#ifdef COMEDI_PCMCIA_2_6_16 static void daqp_cs_detach(struct pcmcia_device *p_dev) -#else -static void daqp_cs_detach(dev_link_t *link) -#endif { -#ifdef COMEDI_PCMCIA_2_6_16 dev_link_t *link = dev_to_instance(p_dev); -#endif local_info_t *dev = link->priv; DEBUG(0, "daqp_cs_detach(0x%p)\n", link); @@ -1232,25 +1172,10 @@ static void daqp_cs_detach(dev_link_t *link) detach(). */ if (link->state & DEV_CONFIG) { -#ifdef COMEDI_PCMCIA_2_6_16 dev->stop = 1; daqp_cs_release((u_long)link); -#else -#ifdef PCMCIA_DEBUG - printk(KERN_DEBUG "daqp_cs: detach postponed, '%s' " - "still locked\n", link->dev->dev_name); -#endif - link->state |= DEV_STALE_LINK; - return; -#endif } -#ifndef COMEDI_PCMCIA_2_6_16 - /* Break the link with Card Services */ - if (link->handle) - pcmcia_deregister_client(link->handle); -#endif - /* Unlink device structure, and free it */ dev_table[dev->table_index] = NULL; kfree(dev); @@ -1470,20 +1395,6 @@ static void daqp_cs_release(u_long arg) DEBUG(0, "daqp_cs_release(0x%p)\n", link); -#ifndef COMEDI_PCMCIA_2_6_16 - /* - If the device is currently in use, we won't release until it - is actually closed, because until then, we can't be sure that - no one will try to access the device or its data structures. - */ - if (link->open) { - DEBUG(1, "daqp_cs: release postponed, '%s' still open\n", - link->dev->dev_name); - link->state |= DEV_STALE_CONFIG; - return; - } -#endif - /* Unlink the device chain */ link->dev = NULL; @@ -1501,11 +1412,6 @@ static void daqp_cs_release(u_long arg) pcmcia_release_irq(link->handle, &link->irq); link->state &= ~DEV_CONFIG; -#ifndef COMEDI_PCMCIA_2_6_16 - if (link->state & DEV_STALE_LINK) - daqp_cs_detach(link); -#endif - } /* daqp_cs_release */ /*====================================================================== @@ -1520,55 +1426,6 @@ static void daqp_cs_release(u_long arg) ======================================================================*/ -#ifndef COMEDI_PCMCIA_2_6_16 -static int daqp_cs_event(event_t event, int priority, - event_callback_args_t *args) -{ - dev_link_t *link = args->client_data; - local_info_t *dev = link->priv; - - DEBUG(1, "daqp_cs_event(0x%06x)\n", event); - - switch (event) { - case CS_EVENT_CARD_REMOVAL: - link->state &= ~DEV_PRESENT; - if (link->state & DEV_CONFIG) { - dev->stop = 1; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0) - link->release.expires = jiffies + HZ/20; - add_timer(&link->release); -#else - daqp_cs_release((ulong)link); -#endif - } - break; - case CS_EVENT_CARD_INSERTION: - link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; - daqp_cs_config(link); - break; - case CS_EVENT_PM_SUSPEND: - link->state |= DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_RESET_PHYSICAL: - /* Mark the device as stopped, to block IO until later */ - dev->stop = 1; - if (link->state & DEV_CONFIG) - pcmcia_release_configuration(link->handle); - break; - case CS_EVENT_PM_RESUME: - link->state &= ~DEV_SUSPEND; - /* Fall through... */ - case CS_EVENT_CARD_RESET: - if (link->state & DEV_CONFIG) - pcmcia_request_configuration(link->handle, &link->conf); - dev->stop = 0; - break; - } - return 0; -} /* daqp_cs_event */ -#endif - -#ifdef COMEDI_PCMCIA_2_6_16 static int daqp_cs_suspend(struct pcmcia_device *p_dev) { dev_link_t *link = dev_to_instance(p_dev); @@ -1595,7 +1452,6 @@ static int daqp_cs_resume(struct pcmcia_device *p_dev) return 0; } -#endif /*====================================================================*/ @@ -1603,21 +1459,11 @@ static int daqp_cs_resume(struct pcmcia_device *p_dev) struct pcmcia_driver daqp_cs_driver = { -#ifdef COMEDI_PCMCIA_2_6_16 .probe = daqp_cs_attach, .remove = daqp_cs_detach, .suspend = daqp_cs_suspend, .resume = daqp_cs_resume, -#else - .attach = daqp_cs_attach, - .detach = daqp_cs_detach, -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) - .event = daqp_cs_event, -#endif -#endif -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) .id_table = NULL, /* FIXME */ -#endif .owner = THIS_MODULE, .drv = { .name = dev_info, @@ -1649,11 +1495,7 @@ void cleanup_module(void) * do it again or oops()... that's why this test is here */ if (dev_table[i]) { -#ifndef COMEDI_PCMCIA_2_6_16 - daqp_cs_detach(&dev_table[i]->link); -#else daqp_cs_detach(dev_table[i]->link.handle); -#endif } } }