From 939491424cab9cef4761fbd2eee1dc6d9bcf2426 Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Tue, 20 Sep 2005 23:27:36 +0000 Subject: [PATCH] Deal with event callback getting moved into pcmcia_driver struct in 2.6.13 kernels. --- comedi/drivers/das08_cs.c | 20 +++++++++++++------- comedi/drivers/ni_daq_dio24.c | 20 +++++++++++++------- comedi/drivers/ni_labpc_cs.c | 32 +++++++++++++++++++------------- comedi/drivers/ni_mio_cs.c | 10 ++++++++-- comedi/drivers/quatech_daqp_cs.c | 16 +++++++++++----- 5 files changed, 64 insertions(+), 34 deletions(-) diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index 948a0fbe..f9af08fb 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -43,6 +43,7 @@ Command support does not exist, but could be added for this board. #include #include +#include #include "das08.h" @@ -284,11 +285,13 @@ static dev_link_t *das08_pcmcia_attach(void) dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - 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; +#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); @@ -655,8 +658,11 @@ the device state and restart IO. struct pcmcia_driver das08_cs_driver = { - .attach = das08_pcmcia_attach, - .detach = das08_pcmcia_detach, + .attach = &das08_pcmcia_attach, + .detach = &das08_pcmcia_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &das08_pcmcia_event, +#endif .owner = THIS_MODULE, .drv = { .name = dev_info, diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index 0180d42a..788e99eb 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -43,6 +43,7 @@ the PCMCIA interface. #include #include +#include #include "8255.h" @@ -367,11 +368,13 @@ static dev_link_t *dio24_cs_attach(void) pcmcia_dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - 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; +#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); @@ -784,8 +787,11 @@ static int dio24_event(event_t event, int priority, struct pcmcia_driver dio24_cs_driver = { - .attach = dio24_cs_attach, - .detach = dio24_cs_detach, + .attach = &dio24_cs_attach, + .detach = &dio24_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &dio24_event, +#endif .owner = THIS_MODULE, .drv = { .name = "ni_daq_dio24", diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index f34f69fe..3c22f3f7 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -64,6 +64,7 @@ NI manuals: #include #include +#include #include "8253.h" #include "8255.h" @@ -99,13 +100,13 @@ static int labpc_attach(comedi_device *dev,comedi_devconfig *it); static comedi_driver driver_labpc_cs = { - driver_name: "ni_labpc_cs", - module: THIS_MODULE, - attach: labpc_attach, - detach: labpc_common_detach, - num_names: sizeof(labpc_cs_boards) / sizeof(labpc_board), - board_name: (char **)labpc_cs_boards, - offset: sizeof(labpc_board), + .driver_name = "ni_labpc_cs", + .module = THIS_MODULE, + .attach = &labpc_attach, + .detach = &labpc_common_detach, + .num_names = sizeof(labpc_cs_boards) / sizeof(labpc_board), + .board_name = (char **)labpc_cs_boards, + .offset = sizeof(labpc_board), }; static int labpc_attach(comedi_device *dev, comedi_devconfig *it) @@ -299,12 +300,14 @@ static dev_link_t *labpc_cs_attach(void) pcmcia_dev_list = link; client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - 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; - client_reg.Version = 0x0210; +#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) { @@ -709,6 +712,9 @@ struct pcmcia_driver labpc_cs_driver = { .attach = labpc_cs_attach, .detach = labpc_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &labpc_event, +#endif .owner = THIS_MODULE, .drv = { .name = "daqcard-1200", diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index ad43d16c..1d309fcd 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -44,6 +44,7 @@ See the notes in the ni_atmio.o driver. #include #include +#include #include "ni_stc.h" #include "8255.h" @@ -289,11 +290,13 @@ static dev_link_t *cs_attach(void) 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); @@ -606,8 +609,11 @@ MODULE_LICENSE("GPL"); struct pcmcia_driver ni_mio_cs_driver = { - .attach = cs_attach, - .detach = cs_detach, + .attach = &cs_attach, + .detach = &cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = &mio_cs_event, +#endif .owner = THIS_MODULE, .drv = { .name = "ni_mio_cs", diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index 65d45348..6b0cebef 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -49,6 +49,7 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #include +#include #include #include #include @@ -1147,11 +1148,13 @@ static dev_link_t *daqp_cs_attach(void) /* Register with Card Services */ client_reg.dev_info = &dev_info; client_reg.Attributes = INFO_IO_CLIENT | INFO_CARD_SHARE; - 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; +#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); @@ -1517,6 +1520,9 @@ struct pcmcia_driver daqp_cs_driver = { .attach = daqp_cs_attach, .detach = daqp_cs_detach, +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,13) + .event = daqp_cs_event, +#endif .owner = THIS_MODULE, .drv = { .name = "quatech_daqp_cs", -- 2.26.2