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
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
======================================================================*/
+#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, i;
+ 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;
link->conf.Vcc = 50;
link->conf.IntType = INT_MEMORY_AND_IO;
- /* Register with Card Services */
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);
}
return link;
+#endif
} /* das16cs_pcmcia_attach */
/*======================================================================
======================================================================*/
+#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);
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
- return;
+ return;
/*
If the device is currently configured and active, we won't
*/
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;
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
link->state |= DEV_STALE_CONFIG;
return;
}
+#endif
/* Unlink the device chain */
link->dev = NULL;
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 */
======================================================================*/
+#ifndef COMEDI_PCMCIA_2_6_16
static int das16cs_pcmcia_event(event_t event, int priority,
event_callback_args_t *args)
{
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);
+ local_info_t *local = link->priv;
+
+ link->state |= DEV_SUSPEND;
+ /* Mark the device as stopped, to block IO until later */
+ local->stop = 1;
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+} /* das16cs_pcmcia_suspend */
+
+static int das16cs_pcmcia_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+ local_info_t *local = link->priv;
+
+ link->state &= ~DEV_SUSPEND;
+ if (link->state & DEV_CONFIG)
+ pcmcia_request_configuration(link->handle, &link->conf);
+ 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 = "cb_das16_cs",
+ .name = dev_info,
},
};
#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
}
}
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
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
======================================================================*/
+#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, i;
+ 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;
link->conf.Vcc = 50;
link->conf.IntType = INT_MEMORY_AND_IO;
- /* Register with Card Services */
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)
}
return link;
+#endif
} /* das08_pcmcia_attach */
/*======================================================================
======================================================================*/
+#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);
for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
if (*linkp == link) break;
if (*linkp == NULL)
- return;
+ return;
/*
If the device is currently configured and active, we won't
*/
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;
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
link->state |= DEV_STALE_CONFIG;
return;
}
+#endif
/* Unlink the device chain */
link->dev = NULL;
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 */
======================================================================*/
+#ifndef COMEDI_PCMCIA_2_6_16
static int das08_pcmcia_event(event_t event, int priority,
event_callback_args_t *args)
{
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);
+ local_info_t *local = link->priv;
+
+ link->state |= DEV_SUSPEND;
+ /* Mark the device as stopped, to block IO until later */
+ local->stop = 1;
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+} /* das08_pcmcia_suspend */
+
+static int das08_pcmcia_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+ local_info_t *local = link->priv;
+
+ link->state &= ~DEV_SUSPEND;
+ if (link->state & DEV_CONFIG)
+ pcmcia_request_configuration(link->handle, &link->conf);
+ 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 = {
#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
}
}
}
static struct usb_driver dt9812_usb_driver = {
+#ifdef COMEDI_HAVE_USB_DRIVER_OWNER
.owner = THIS_MODULE,
+#endif
.name = "dt9812",
.probe = dt9812_probe,
.disconnect = dt9812_disconnect,
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
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
======================================================================*/
+#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, i;
+ int ret;
+#endif
+ int i;
printk(KERN_INFO "ni_daq_dio24: HOLA SOY YO - 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;
link->conf.Vcc = 50;
link->conf.IntType = INT_MEMORY_AND_IO;
- /* Register with Card Services */
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)
}
return link;
+#endif
} /* dio24_cs_attach */
/*======================================================================
======================================================================*/
+#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");
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;
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
link->state |= DEV_STALE_CONFIG;
return;
}
+#endif
/* Unlink the device chain */
link->dev = NULL;
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 */
======================================================================*/
+#ifndef COMEDI_PCMCIA_2_6_16
static int dio24_event(event_t event, int priority,
event_callback_args_t *args)
{
}
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);
+ local_info_t *local = link->priv;
+
+ link->state |= DEV_SUSPEND;
+ /* Mark the device as stopped, to block IO until later */
+ local->stop = 1;
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+} /* dio24_cs_suspend */
+
+static int dio24_cs_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+ local_info_t *local = link->priv;
+
+ link->state &= ~DEV_SUSPEND;
+ if (link->state & DEV_CONFIG)
+ pcmcia_request_configuration(link->handle, &link->conf);
+ 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 */
+ PCMCIA_DEVICE_MANF_CARD(0x010b, 0x475c), /* daqcard-dio24 */
+ PCMCIA_DEVICE_NULL
+};
+
+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 = "ni_daq_dio24",
+ .name = dev_info,
},
};
#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
}
}
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 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
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
======================================================================*/
+#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, i;
+ 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;
link->conf.Vcc = 50;
link->conf.IntType = INT_MEMORY_AND_IO;
- /* Register with Card Services */
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)
}
return link;
+#endif
} /* labpc_cs_attach */
/*======================================================================
======================================================================*/
+#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);
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;
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
link->state |= DEV_STALE_CONFIG;
return;
}
+#endif
/* Unlink the device chain */
link->dev = NULL;
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 */
======================================================================*/
+#ifndef COMEDI_PCMCIA_2_6_16
static int labpc_event(event_t event, int priority,
event_callback_args_t *args)
{
}
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);
+ local_info_t *local = link->priv;
+
+ link->state |= DEV_SUSPEND;
+ /* Mark the device as stopped, to block IO until later */
+ local->stop = 1;
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+} /* labpc_cs_suspend */
+
+static int labpc_cs_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+ local_info_t *local = link->priv;
+
+ link->state &= ~DEV_SUSPEND;
+ if (link->state & DEV_CONFIG)
+ pcmcia_request_configuration(link->handle, &link->conf);
+ local->stop = 0;
+ return 0;
+} /* labpc_cs_resume */
+#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 = "daqcard-1200",
+ .name = dev_info,
},
};
#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
}
}
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;
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->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)
}
return link;
+#endif
}
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);
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;
}
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);
+
+ DPRINTK("pm suspend\n");
+ link->state |= DEV_SUSPEND;
+ if(link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+}
+
+static int mio_cs_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+
+ DPRINTK("pm resume\n");
+ link->state &= ~DEV_SUSPEND;
+ if(DEV_OK(link))
+ pcmcia_request_configuration(link->handle, &link->conf);
+
+ return 0;
+}
+#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 = "ni_mio_cs",
+ .name = dev_info,
},
};
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);
}
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.
+
+ Kernel version 2.6.16 upwards uses suspend() and resume() functions
+ instead of an event() function.
*/
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
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
======================================================================*/
+#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, i;
+ int ret;
+#endif
+ int i;
DEBUG(0, "daqp_cs_attach()\n");
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;
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;
}
return link;
+#endif
} /* daqp_cs_attach */
/*======================================================================
======================================================================*/
+#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);
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;
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
link->state |= DEV_STALE_CONFIG;
return;
}
+#endif
/* Unlink the device chain */
link->dev = NULL;
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 */
======================================================================*/
+#ifndef COMEDI_PCMCIA_2_6_16
static int daqp_cs_event(event_t event, int priority,
event_callback_args_t *args)
{
}
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);
+ local_info_t *local = link->priv;
+
+ link->state |= DEV_SUSPEND;
+ /* Mark the device as stopped, to block IO until later */
+ local->stop = 1;
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+}
+
+static int daqp_cs_resume(struct pcmcia_device *p_dev)
+{
+ dev_link_t *link = dev_to_instance(p_dev);
+ local_info_t *local = link->priv;
+
+ link->state &= ~DEV_SUSPEND;
+ if (link->state & DEV_CONFIG)
+ pcmcia_request_configuration(link->handle, &link->conf);
+ local->stop = 0;
+
+ return 0;
+}
+#endif
/*====================================================================*/
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 = "quatech_daqp_cs",
+ .name = dev_info,
},
};
* a detach, which freed the memory, so make sure we don't
* do it again or oops()... that's why this test is here
*/
- if (dev_table[i])
+ 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
+ }
}
}
}
// The usbduxsub-driver
static struct usb_driver usbduxsub_driver = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19)
+#ifdef COMEDI_HAVE_USB_DRIVER_OWNER
owner: THIS_MODULE,
#endif
name: BOARDNAME,
// The usbduxfastsub-driver
static struct usb_driver usbduxfastsub_driver = {
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19)
+#ifdef COMEDI_HAVE_USB_DRIVER_OWNER
owner: THIS_MODULE,
#endif
name: BOARDNAME,
#define USB_BULK_MSG usb_bulk_msg
#endif
+/*
+ * Determine whether we need the "owner" member of struct usb_driver and
+ * define COMEDI_HAVE_USB_DRIVER_OWNER if we need it.
+ */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2,4,19) \
+ && LINUX_VERSION_CODE < KERNEL_VERSION(2,6,16)
+#define COMEDI_HAVE_USB_DRIVER_OWNER
+#endif
+
#endif