From: Ian Abbott Date: Mon, 8 Nov 2010 15:15:05 +0000 (+0000) Subject: More ugly PCMCIA changes for 2.6.37 kernel. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=326816672d64717271c82cfcf93cf3e081c043cc;p=comedi.git More ugly PCMCIA changes for 2.6.37 kernel. --- diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index e75616d6..0d2870e4 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -38,7 +38,9 @@ Status: experimental #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include @@ -755,8 +757,10 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) link->irq.Handler = NULL; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif cur_dev = link; @@ -782,6 +786,7 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) } /* das16cs_pcmcia_detach */ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -842,7 +847,17 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, return 0; } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void das16cs_pcmcia_config(struct pcmcia_device *link) { @@ -860,6 +875,11 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) DEBUG(0, "das16cs_pcmcia_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + /* Do we need to allocate an interrupt? */ + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_ret = pcmcia_loop_config(link, das16cs_pcmcia_config_loop, NULL); if (last_ret) { @@ -1010,7 +1030,12 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T @@ -1023,6 +1048,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -1053,6 +1079,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) printk(" & %pR", link->resource[1]); #endif printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -1104,9 +1131,13 @@ struct pcmcia_driver das16cs_driver = { .resume = das16cs_pcmcia_resume, .id_table = das16cs_id_table, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; static int __init init_das16cs_pcmcia_cs(void) diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index 66d2d5ae..b7ce994e 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -51,7 +51,9 @@ Command support does not exist, but could be added for this board. #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include @@ -210,6 +212,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) link->irq.Handler = NULL; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* General socket configuration defaults can go here. In this client, we assume very little, and rely on the CIS for almost @@ -219,6 +222,7 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) */ link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif cur_dev = link; @@ -264,6 +268,7 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) ======================================================================*/ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -323,7 +328,17 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, #endif return 0; } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void das08_pcmcia_config(struct pcmcia_device *link) { @@ -341,6 +356,11 @@ static void das08_pcmcia_config(struct pcmcia_device *link) DEBUG(0, "das08_pcmcia_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + /* Do we need to allocate an interrupt? */ + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_ret = pcmcia_loop_config(link, das08_pcmcia_config_loop, NULL); if (last_ret) { @@ -487,7 +507,12 @@ static void das08_pcmcia_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T @@ -500,6 +525,7 @@ static void das08_pcmcia_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -529,6 +555,7 @@ static void das08_pcmcia_config(struct pcmcia_device *link) printk(" & %pR", link->resource[1]); #endif printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -599,9 +626,13 @@ struct pcmcia_driver das08_cs_driver = { .resume = das08_pcmcia_resume, .id_table = das08_cs_id_table, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; static int __init init_das08_pcmcia_cs(void) diff --git a/comedi/drivers/ni_daq_700.c b/comedi/drivers/ni_daq_700.c index 07b7420b..f6fa4c1e 100644 --- a/comedi/drivers/ni_daq_700.c +++ b/comedi/drivers/ni_daq_700.c @@ -49,7 +49,9 @@ IRQ is assigned but not used. #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include #include @@ -439,8 +441,6 @@ static int dio700_detach(comedi_device * dev) return 0; }; -// PCMCIA crap - /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not define PCMCIA_DEBUG at all, all the debug code will be @@ -537,6 +537,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) link->irq.Handler = NULL; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* General socket configuration defaults can go here. In this client, we assume very little, and rely on the CIS for almost @@ -546,6 +547,7 @@ static int dio700_cs_attach(struct pcmcia_device *link) */ link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif pcmcia_cur_dev = link; @@ -593,6 +595,7 @@ static void dio700_cs_detach(struct pcmcia_device *link) ======================================================================*/ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -692,7 +695,17 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, /* If we got this far, we're cool! */ return 0; } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void dio700_config(struct pcmcia_device *link) { @@ -700,7 +713,9 @@ static void dio700_config(struct pcmcia_device *link) local_info_t *dev = link->priv; #endif int last_ret; +#ifdef CONFIG_COMEDI_HAVE_CS_H win_req_t req; +#endif #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; cisparse_t parse; @@ -716,8 +731,19 @@ static void dio700_config(struct pcmcia_device *link) DEBUG(0, "dio700_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | + CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE - last_ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, &req); + last_ret = pcmcia_loop_config(link, dio700_pcmcia_config_loop, +#ifdef CONFIG_COMEDI_HAVE_CS_H + &req +#else + NULL +#endif + ); if (last_ret) { dev_warn(&link->dev, "no configuration found\n"); goto cs_failed; @@ -897,9 +923,13 @@ static void dio700_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) { +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; - } #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* @@ -911,6 +941,7 @@ static void dio700_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -943,6 +974,7 @@ static void dio700_config(struct pcmcia_device *link) printk(", mem 0x%06lx-0x%06lx", req.Base, req.Base + req.Size - 1); printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -1009,9 +1041,13 @@ struct pcmcia_driver dio700_cs_driver = { .resume = dio700_cs_resume, .id_table = dio700_cs_ids, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; static int __init init_dio700_cs(void) diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index d8a53922..9c5d7ff4 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -3,7 +3,7 @@ Driver for National Instruments PCMCIA DAQ-Card DIO-24 Copyright (C) 2002 Daniel Vecino Castel - PCMCIA crap at end of file is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13 + PCMCIA stuff at end of file is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13 from the pcmcia package. The initial developer of the pcmcia dummy_cs.c code is David A. Hinds . Portions created by David A. Hinds @@ -50,7 +50,9 @@ the PCMCIA interface. #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include #include @@ -196,8 +198,6 @@ static int dio24_detach(comedi_device * dev) return 0; }; -// PCMCIA crap - /* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If you do not define PCMCIA_DEBUG at all, all the debug code will be @@ -294,6 +294,7 @@ static int dio24_cs_attach(struct pcmcia_device *link) link->irq.Handler = NULL; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* General socket configuration defaults can go here. In this client, we assume very little, and rely on the CIS for almost @@ -303,6 +304,7 @@ static int dio24_cs_attach(struct pcmcia_device *link) */ link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif pcmcia_cur_dev = link; @@ -350,6 +352,7 @@ static void dio24_cs_detach(struct pcmcia_device *link) ======================================================================*/ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -449,7 +452,17 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, /* If we got this far, we're cool! */ return 0; } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void dio24_config(struct pcmcia_device *link) { @@ -457,7 +470,9 @@ static void dio24_config(struct pcmcia_device *link) local_info_t *dev = link->priv; #endif int last_ret; +#ifdef CONFIG_COMEDI_HAVE_CS_H win_req_t req; +#endif #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; cisparse_t parse; @@ -473,8 +488,19 @@ static void dio24_config(struct pcmcia_device *link) DEBUG(0, "dio24_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_AUDIO | + CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE - last_ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, &req); + last_ret = pcmcia_loop_config(link, dio24_pcmcia_config_loop, +#ifdef CONFIG_COMEDI_HAVE_CS_H + &req +#else + NULL +#endif + ); if (last_ret) { dev_warn(&link->dev, "no configuration found\n"); goto cs_failed; @@ -654,9 +680,13 @@ static void dio24_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) { +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; - } #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* @@ -668,6 +698,7 @@ static void dio24_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -700,6 +731,7 @@ static void dio24_config(struct pcmcia_device *link) printk(", mem 0x%06lx-0x%06lx", req.Base, req.Base + req.Size - 1); printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -765,9 +797,13 @@ struct pcmcia_driver dio24_cs_driver = { .resume = dio24_cs_resume, .id_table = dio24_cs_ids, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; static int __init init_dio24_cs(void) diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index ddb4954b..18e6a438 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -3,7 +3,7 @@ Driver for National Instruments daqcard-1200 boards Copyright (C) 2001, 2002, 2003 Frank Mori Hess - PCMCIA crap is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13 + PCMCIA stuff is adapted from dummy_cs.c 1.31 2001/08/24 12:13:13 from the pcmcia package. The initial developer of the pcmcia dummy_cs.c code is David A. Hinds . Portions created by David A. Hinds @@ -75,7 +75,9 @@ NI manuals: #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include #include @@ -271,6 +273,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) link->irq.Handler = NULL; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* General socket configuration defaults can go here. In this client, we assume very little, and rely on the CIS for almost @@ -280,6 +283,7 @@ static int labpc_cs_attach(struct pcmcia_device *link) */ link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif pcmcia_cur_dev = link; @@ -330,6 +334,7 @@ static void labpc_cs_detach(struct pcmcia_device *link) ======================================================================*/ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -429,7 +434,17 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, /* If we got this far, we're cool! */ return 0; } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void labpc_config(struct pcmcia_device *link) { @@ -437,7 +452,9 @@ static void labpc_config(struct pcmcia_device *link) local_info_t *dev = link->priv; #endif int last_ret; +#ifdef CONFIG_COMEDI_HAVE_CS_H win_req_t req; +#endif #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; cisparse_t parse; @@ -451,8 +468,19 @@ static void labpc_config(struct pcmcia_device *link) DEBUG(0, "labpc_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + link->config_flags |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ | + CONF_AUTO_AUDIO | CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE - last_ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, &req); + last_ret = pcmcia_loop_config(link, labpc_pcmcia_config_loop, +#ifdef CONFIG_COMEDI_HAVE_CS_H + &req +#else + NULL +#endif + ); if (last_ret) { dev_warn(&link->dev, "no configuration found\n"); goto cs_failed; @@ -629,9 +657,13 @@ static void labpc_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf))) { +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; - } #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* @@ -643,6 +675,7 @@ static void labpc_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -675,6 +708,7 @@ static void labpc_config(struct pcmcia_device *link) printk(", mem 0x%06lx-0x%06lx", req.Base, req.Base + req.Size - 1); printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -739,9 +773,13 @@ struct pcmcia_driver labpc_cs_driver = { .resume = labpc_cs_resume, .id_table = labpc_cs_ids, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; static int __init init_labpc_cs(void) diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index 78d2e3e3..887f0781 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -52,7 +52,9 @@ See the notes in the ni_atmio.o driver. #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include @@ -275,6 +277,7 @@ static dev_node_t dev_node = { #endif static int cs_attach(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_CS_H #ifdef CONFIG_COMEDI_HAVE_CS_IO_REQ_T link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; link->io.NumPorts1 = 16; @@ -290,6 +293,7 @@ static int cs_attach(struct pcmcia_device *link) #endif link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; +#endif cur_dev = link; @@ -330,13 +334,16 @@ static int mio_cs_resume(struct pcmcia_device *link) #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, +#ifdef CONFIG_COMEDI_HAVE_CS_H cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, unsigned int vcc, +#endif void *priv_data) { int base, ret; +#ifdef CONFIG_COMEDI_HAVE_CS_H #ifdef CONFIG_COMEDI_HAVE_CS_IO_REQ_T p_dev->io.NumPorts1 = cfg->io.win[0].len; p_dev->io.IOAddrLines = cfg->io.flags & CISTPL_IO_LINES_MASK; @@ -345,6 +352,10 @@ static int mio_pcmcia_config_loop(struct pcmcia_device *p_dev, p_dev->resource[0]->end = cfg->io.win[0].len; p_dev->io_lines = cfg->io.flags & CISTPL_IO_LINES_MASK; #endif +#else + p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_16; +#endif for (base = 0x000; base < 0x400; base += 0x20) { #ifdef CONFIG_COMEDI_HAVE_CS_IO_REQ_T @@ -373,6 +384,10 @@ static void mio_cs_config(struct pcmcia_device *link) DPRINTK("mio_cs_config(link=%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE ret = pcmcia_loop_config(link, mio_pcmcia_config_loop, NULL); if (ret) { @@ -479,8 +494,12 @@ static void mio_cs_config(struct pcmcia_device *link) link->conf.ConfigIndex = 1; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H ret = pcmcia_request_configuration(link, &link->conf); //printk("RequestConfiguration %d\n",ret); +#else + ret = pcmcia_enable_device(link); +#endif #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T link->dev_node = &dev_node; @@ -625,9 +644,13 @@ struct pcmcia_driver ni_mio_cs_driver = { .resume = &mio_cs_resume, .id_table = ni_mio_cs_ids, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; int init_module(void) diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index d9ed1b8f..b9c1a541 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -54,7 +54,9 @@ Devices: [Quatech] DAQP-208 (daqp), DAQP-308 #ifdef CONFIG_COMEDI_HAVE_CS_TYPES_H #include #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H #include +#endif #include #include #include @@ -1124,6 +1126,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) #endif #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* General socket configuration defaults can go here. In this client, we assume very little, and rely on the CIS for almost @@ -1133,6 +1136,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) */ link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; +#endif daqp_cs_config(link); @@ -1178,6 +1182,7 @@ static void daqp_cs_detach(struct pcmcia_device *link) ======================================================================*/ #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE +#ifdef CONFIG_COMEDI_HAVE_CS_H static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -1239,7 +1244,17 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, return pcmcia_request_io(p_dev); #endif } -#endif +#else /* CONFIG_COMEDI_HAVE_CS_H */ +static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, + void *priv_data) +{ + if (p_dev->config_index == 0) + return -EINVAL; + + return pcmcia_request_io(p_dev); +} +#endif /* CONFIG_COMEDI_HAVE_CS_H */ +#endif /* CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE */ static void daqp_cs_config(struct pcmcia_device *link) { @@ -1256,6 +1271,11 @@ static void daqp_cs_config(struct pcmcia_device *link) DEBUG(0, "daqp_cs_config(0x%p)\n", link); +#ifndef CONFIG_COMEDI_HAVE_CS_H + /* Do we need to allocate an interrupt? */ + link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; +#endif + #ifdef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_ret = pcmcia_loop_config(link, daqp_pcmcia_config_loop, NULL); if (last_ret) { @@ -1412,9 +1432,13 @@ static void daqp_cs_config(struct pcmcia_device *link) #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestConfiguration; #endif - if ((last_ret = pcmcia_request_configuration(link, &link->conf))) { +#ifdef CONFIG_COMEDI_HAVE_CS_H + last_ret = pcmcia_request_configuration(link, &link->conf); +#else + last_ret = pcmcia_enable_device(link); +#endif + if (last_ret) goto cs_failed; - } #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* @@ -1430,6 +1454,7 @@ static void daqp_cs_config(struct pcmcia_device *link) link->dev_node = &dev->node; #endif +#ifdef CONFIG_COMEDI_HAVE_CS_H /* Finally, report what we've done */ #ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", @@ -1459,6 +1484,7 @@ static void daqp_cs_config(struct pcmcia_device *link) printk(" & %pR", link->resource[1]); #endif printk("\n"); +#endif /* CONFIG_COMEDI_HAVE_CS_H */ return; @@ -1525,9 +1551,13 @@ struct pcmcia_driver daqp_cs_driver = { .resume = daqp_cs_resume, .id_table = daqp_cs_id_table, .owner = THIS_MODULE, +#ifdef CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME + .name = devname, +#else .drv = { .name = devname, }, +#endif }; int __init init_module(void) diff --git a/configure.ac b/configure.ac index 2b518888..d2b6d4ed 100644 --- a/configure.ac +++ b/configure.ac @@ -87,7 +87,7 @@ else fi AM_CONDITIONAL([CONFIG_COMEDI_PCI],[test "$USE_PCI" = "yes"]) -COMEDI_CHECK_PCMCIA_PROBE([$LINUX_SRC_DIR], +COMEDI_CHECK_PCMCIA_DRIVER_PROBE([$LINUX_SRC_DIR], [AS_CHECK_LINUX_CONFIG_OPTION([CONFIG_PCMCIA], [HAVE_PCMCIA="yes"],[HAVE_PCMCIA="yes"],[HAVE_PCMCIA="no"])], [HAVE_PCMCIA="no"]) @@ -110,6 +110,12 @@ else fi AM_CONDITIONAL([CONFIG_COMEDI_PCMCIA],[test "$USE_PCMCIA" = "yes"]) +COMEDI_CHECK_PCMCIA_DRIVER_NAME([$LINUX_SRC_DIR], + [HAVE_PCMCIA_DRIVER_NAME="yes"], [HAVE_PCMCIA_DRIVER_NAME="no"]) +if test "$HAVE_PCMCIA_DRIVER_NAME" = "yes" ; then + AC_DEFINE([CONFIG_COMEDI_HAVE_PCMCIA_DRIVER_NAME],[true],[Define if Linux kernel source has name member in struct pcmcia_driver]) +fi + COMEDI_CHECK_PCMCIA_LOOP_TUPLE([$LINUX_SRC_DIR], [HAVE_PCMCIA_LOOP_TUPLE="yes"], [HAVE_PCMCIA_LOOP_TUPLE="no"]) if test "$HAVE_PCMCIA_LOOP_TUPLE" = "yes" ; then @@ -146,6 +152,12 @@ if test "$HAVE_CS_TYPES_H" = "yes" ; then AC_DEFINE([CONFIG_COMEDI_HAVE_CS_TYPES_H],[true],[Define if Linux kernel source has pcmcia/cs_types.h (removed in 2.6.36)]) fi +COMEDI_CHECK_HAVE_CS_H([$LINUX_SRC_DIR], + [HAVE_CS_H="yes"], [HAVE_CS_H="no"]) +if test "$HAVE_CS_TYPES_H" = "yes" ; then + AC_DEFINE([CONFIG_COMEDI_HAVE_CS_H],[true],[Define if Linux kernel source has pcmcia/cs.h (removed in 2.6.37)]) +fi + AS_CHECK_LINUX_CONFIG_OPTION([CONFIG_USB],[HAVE_USB="yes"],[HAVE_USB="yes"],[HAVE_USB="no"]) AM_CONDITIONAL([CONFIG_USB],[test "$HAVE_USB" = "yes"]) AC_ARG_ENABLE([usb],[ --disable-usb Disable support for USB devices], diff --git a/m4/as-linux.m4 b/m4/as-linux.m4 index fb8a68ee..17f7e69a 100644 --- a/m4/as-linux.m4 +++ b/m4/as-linux.m4 @@ -772,7 +772,7 @@ AC_DEFUN([COMEDI_CHECK_LINUX_KBUILD], # # Check if kernel pcmcia support is new enough to have a probe member in the pcmcia_driver # struct. -AC_DEFUN([COMEDI_CHECK_PCMCIA_PROBE], +AC_DEFUN([COMEDI_CHECK_PCMCIA_DRIVER_PROBE], [ AC_REQUIRE([AC_PROG_EGREP]) AC_MSG_CHECKING([$1 for probe in pcmcia_driver struct]) @@ -786,6 +786,25 @@ AC_DEFUN([COMEDI_CHECK_PCMCIA_PROBE], fi ]) +# COMEDI_CHECK_PCMCIA_DRIVER_NAME([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# Check if kernel pcmcia support is new enough to have a name member in the pcmcia_driver +# struct. +AC_DEFUN([COMEDI_CHECK_PCMCIA_DRIVER_NAME], +[ + AC_REQUIRE([AC_PROG_EGREP]) + AC_MSG_CHECKING([$1 for name in pcmcia_driver struct]) + cat "$1/include/pcmcia/ds.h" | tr \\n ' ' | [$EGREP "struct[[:space:]]+pcmcia_driver[[:space:]]*[{][^}]*name"] > /dev/null + if (($?)); then + AC_MSG_RESULT([no]) + $3 + else + AC_MSG_RESULT([yes]) + $2 + fi +]) + # COMEDI_CHECK_PCMCIA_LOOP_TUPLE([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------------------------- # @@ -887,6 +906,22 @@ AC_DEFUN([COMEDI_CHECK_HAVE_CS_TYPES_H], fi ]) +# COMEDI_CHECK_HAVE_CS_H([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# Check if kernel has file. +AC_DEFUN([COMEDI_CHECK_HAVE_CS_H], +[ + AC_MSG_CHECKING([$1 for include/pcmcia/cs.h (removed in 2.6.37)]) + if test -f "$1/include/pcmcia/cs.h"; then + AC_MSG_RESULT([yes]) + $2 + else + AC_MSG_RESULT([no]) + $3 + fi +]) + # COMEDI_CHECK_HAVE_MUTEX_H([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # ------------------------------------------------------------- #