From: Ian Abbott Date: Thu, 30 Sep 2010 15:59:41 +0000 (+0000) Subject: PCMCIA support broke again with 2.6.35 kernel, so add yet more ugly hacks. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fd54da75d43838eb48f7bb0f8e315adf04759a7d;p=comedi.git PCMCIA support broke again with 2.6.35 kernel, so add yet more ugly hacks. --- diff --git a/comedi/drivers/cb_das16_cs.c b/comedi/drivers/cb_das16_cs.c index 4229d476..3e36fb46 100644 --- a/comedi/drivers/cb_das16_cs.c +++ b/comedi/drivers/cb_das16_cs.c @@ -193,12 +193,22 @@ static int das16cs_attach(comedi_device * dev, comedi_devconfig * it) } printk("\n"); - ret = comedi_request_irq(link->irq.AssignedIRQ, das16cs_interrupt, + ret = comedi_request_irq( +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ, +#else + link->irq, +#endif + das16cs_interrupt, IRQF_SHARED, "cb_das16_cs", dev); if (ret < 0) { return ret; } +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T dev->irq = link->irq.AssignedIRQ; +#else + dev->irq = link->irq; +#endif printk("irq=%u ", dev->irq); dev->board_ptr = das16cs_probe(dev, link); @@ -693,7 +703,9 @@ static dev_info_t dev_info = "cb_das16_cs"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; struct bus_operations *bus; } local_info_t; @@ -724,12 +736,14 @@ static int das16cs_pcmcia_attach(struct pcmcia_device *link) link->priv = local; /* Initialize the pcmcia_device structure */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_LEVEL_ID; #endif link->irq.Handler = NULL; +#endif link->conf.Attributes = 0; link->conf.IntType = INT_MEMORY_AND_IO; @@ -745,7 +759,10 @@ static void das16cs_pcmcia_detach(struct pcmcia_device *link) { DEBUG(0, "das16cs_pcmcia_detach(0x%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { ((local_info_t *) link->priv)->stop = 1; das16cs_pcmcia_release(link); } @@ -765,8 +782,12 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, return -EINVAL; /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) +#endif + { p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -795,7 +816,9 @@ static int das16cs_pcmcia_config_loop(struct pcmcia_device *p_dev, static void das16cs_pcmcia_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; @@ -871,8 +894,12 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) } */ /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) +#endif + { link->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -906,6 +933,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) } #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T /* Allocate an interrupt line. Note that this does not assign a handler to the interrupt, unless the 'Handler' member of the @@ -918,6 +946,11 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_irq(link, &link->irq)) != 0) goto cs_failed; } +#else + /* Check an interrupt line has been allocated. */ + if (!link->irq) + goto cs_failed; +#endif /* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping, and putting the @@ -929,6 +962,7 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) goto cs_failed; +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -936,12 +970,24 @@ static void das16cs_pcmcia_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "cb_das16_cs"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); + if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/comedi/drivers/das08_cs.c b/comedi/drivers/das08_cs.c index 70203075..f72df3ea 100644 --- a/comedi/drivers/das08_cs.c +++ b/comedi/drivers/das08_cs.c @@ -159,7 +159,9 @@ static const dev_info_t dev_info = "pcm-das08"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; struct bus_operations *bus; } local_info_t; @@ -189,12 +191,14 @@ static int das08_pcmcia_attach(struct pcmcia_device *link) local->link = link; link->priv = local; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_LEVEL_ID; #endif link->irq.Handler = NULL; +#endif /* General socket configuration defaults can go here. In this @@ -227,7 +231,10 @@ static void das08_pcmcia_detach(struct pcmcia_device *link) DEBUG(0, "das08_pcmcia_detach(0x%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { ((local_info_t *) link->priv)->stop = 1; das08_pcmcia_release(link); } @@ -257,8 +264,12 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) +#endif + { p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -286,7 +297,9 @@ static int das08_pcmcia_config_loop(struct pcmcia_device *p_dev, static void das08_pcmcia_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; @@ -362,8 +375,12 @@ static void das08_pcmcia_config(struct pcmcia_device *link) } */ /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) +#endif + { link->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -397,6 +414,7 @@ static void das08_pcmcia_config(struct pcmcia_device *link) } #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T if (link->conf.Attributes & CONF_ENABLE_IRQ) { #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestIRQ; @@ -404,6 +422,11 @@ static void das08_pcmcia_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_irq(link, &link->irq)) != 0) goto cs_failed; } +#else + /* Check an interrupt line has been allocated. */ + if (!link->irq) + goto cs_failed; +#endif /* This actually configures the PCMCIA socket -- setting up @@ -416,6 +439,7 @@ static void das08_pcmcia_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_configuration(link, &link->conf)) != 0) goto cs_failed; +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -423,12 +447,23 @@ static void das08_pcmcia_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "pcm-das08"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/comedi/drivers/ni_daq_700.c b/comedi/drivers/ni_daq_700.c index 44f16939..29701b85 100644 --- a/comedi/drivers/ni_daq_700.c +++ b/comedi/drivers/ni_daq_700.c @@ -372,7 +372,11 @@ static int dio700_attach(comedi_device * dev, comedi_devconfig * it) return -EIO; iobase = link->io.BasePort1; #ifdef incomplete +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T irq = link->irq.AssignedIRQ; +#else + irq = link->irq; +#endif #endif break; default: @@ -480,7 +484,9 @@ static const dev_info_t dev_info = "ni_daq_700"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; struct bus_operations *bus; } local_info_t; @@ -512,12 +518,14 @@ static int dio700_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_LEVEL_ID; #endif link->irq.Handler = NULL; +#endif /* General socket configuration defaults can go here. In this @@ -552,7 +560,10 @@ static void dio700_cs_detach(struct pcmcia_device *link) DEBUG(0, "dio700_cs_detach(0x%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { ((local_info_t *) link->priv)->stop = 1; dio700_release(link); } @@ -591,8 +602,12 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) +#endif + { p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -640,7 +655,9 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev, static void dio700_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; win_req_t req; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE @@ -724,8 +741,12 @@ static void dio700_config(struct pcmcia_device *link) } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) +#endif + { link->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -777,6 +798,7 @@ static void dio700_config(struct pcmcia_device *link) } #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T /* Allocate an interrupt line. Note that this does not assign a handler to the interrupt, unless the 'Handler' member of the @@ -789,6 +811,11 @@ static void dio700_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_irq(link, &link->irq)) != 0) { goto cs_failed; } +#else + /* Check an interrupt line has been allocated. */ + if (!link->irq) + goto cs_failed; +#endif /* This actually configures the PCMCIA socket -- setting up @@ -802,6 +829,7 @@ static void dio700_config(struct pcmcia_device *link) goto cs_failed; } +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -809,12 +837,23 @@ static void dio700_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "ni_daq_700"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/comedi/drivers/ni_daq_dio24.c b/comedi/drivers/ni_daq_dio24.c index 35755cc4..41e97845 100644 --- a/comedi/drivers/ni_daq_dio24.c +++ b/comedi/drivers/ni_daq_dio24.c @@ -129,7 +129,11 @@ static int dio24_attach(comedi_device * dev, comedi_devconfig * it) return -EIO; iobase = link->io.BasePort1; #ifdef incomplete +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T irq = link->irq.AssignedIRQ; +#else + irq = link->irq; +#endif #endif break; default: @@ -237,7 +241,9 @@ static const dev_info_t dev_info = "ni_daq_dio24"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; struct bus_operations *bus; } local_info_t; @@ -269,12 +275,14 @@ static int dio24_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_LEVEL_ID; #endif link->irq.Handler = NULL; +#endif /* General socket configuration defaults can go here. In this @@ -309,7 +317,10 @@ static void dio24_cs_detach(struct pcmcia_device *link) DEBUG(0, "dio24_cs_detach(0x%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { ((local_info_t *) link->priv)->stop = 1; dio24_release(link); } @@ -348,8 +359,12 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) +#endif + { p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -397,7 +412,9 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev, static void dio24_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; win_req_t req; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE @@ -481,8 +498,12 @@ static void dio24_config(struct pcmcia_device *link) } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) +#endif + { link->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -534,6 +555,7 @@ static void dio24_config(struct pcmcia_device *link) } #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T /* Allocate an interrupt line. Note that this does not assign a handler to the interrupt, unless the 'Handler' member of the @@ -546,6 +568,11 @@ static void dio24_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_irq(link, &link->irq)) != 0) { goto cs_failed; } +#else + /* Check an interrupt line has been allocated. */ + if (!link->irq) + goto cs_failed; +#endif /* This actually configures the PCMCIA socket -- setting up @@ -559,6 +586,7 @@ static void dio24_config(struct pcmcia_device *link) goto cs_failed; } +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -566,12 +594,23 @@ static void dio24_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "ni_daq_dio24"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/comedi/drivers/ni_labpc_cs.c b/comedi/drivers/ni_labpc_cs.c index 28c538c1..ab250e93 100644 --- a/comedi/drivers/ni_labpc_cs.c +++ b/comedi/drivers/ni_labpc_cs.c @@ -144,7 +144,11 @@ static int labpc_attach(comedi_device * dev, comedi_devconfig * it) if (!link) return -EIO; iobase = link->io.BasePort1; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T irq = link->irq.AssignedIRQ; +#else + irq = link->irq; +#endif break; default: printk("bug! couldn't determine board type\n"); @@ -216,7 +220,9 @@ static const dev_info_t dev_info = "daqcard-1200"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; struct bus_operations *bus; } local_info_t; @@ -246,12 +252,14 @@ static int labpc_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_FORCED_PULSE; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_INFO2_VALID | IRQ_PULSE_ID; #endif link->irq.Handler = NULL; +#endif /* General socket configuration defaults can go here. In this @@ -289,7 +297,10 @@ static void labpc_cs_detach(struct pcmcia_device *link) the release() function is called, that will trigger a proper detach(). */ - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { ((local_info_t *) link->priv)->stop = 1; labpc_release(link); } @@ -328,8 +339,12 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; +#else + p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; +#endif /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -377,7 +392,9 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev, static void labpc_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; win_req_t req; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE @@ -459,8 +476,12 @@ static void labpc_config(struct pcmcia_device *link) } /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) link->conf.Attributes |= CONF_ENABLE_IRQ; +#else + link->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ; +#endif /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -509,6 +530,7 @@ static void labpc_config(struct pcmcia_device *link) } #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T /* Allocate an interrupt line. Note that this does not assign a handler to the interrupt, unless the 'Handler' member of the @@ -521,6 +543,11 @@ static void labpc_config(struct pcmcia_device *link) if ((last_ret = pcmcia_request_irq(link, &link->irq))) { goto cs_failed; } +#else + /* Check an interrupt line has been allocated. */ + if (!link->irq) + goto cs_failed; +#endif /* This actually configures the PCMCIA socket -- setting up @@ -534,6 +561,7 @@ static void labpc_config(struct pcmcia_device *link) goto cs_failed; } +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -541,12 +569,23 @@ static void labpc_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "daqcard-1200"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %d", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/comedi/drivers/ni_mio_cs.c b/comedi/drivers/ni_mio_cs.c index 277f7580..58c9d045 100644 --- a/comedi/drivers/ni_mio_cs.c +++ b/comedi/drivers/ni_mio_cs.c @@ -260,18 +260,22 @@ static void cs_detach(struct pcmcia_device *); static struct pcmcia_device *cur_dev = NULL; static const dev_info_t dev_info = "ni_mio_cs"; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T static dev_node_t dev_node = { "ni_mio_cs", COMEDI_MAJOR, 0, NULL }; +#endif static int cs_attach(struct pcmcia_device *link) { link->io.Attributes1 = IO_DATA_PATH_WIDTH_16; link->io.NumPorts1 = 16; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.IRQInfo1 = IRQ_LEVEL_ID; +#endif #endif link->conf.Attributes = CONF_ENABLE_IRQ; link->conf.IntType = INT_MEMORY_AND_IO; @@ -292,7 +296,10 @@ static void cs_detach(struct pcmcia_device *link) { DPRINTK("cs_detach(link=%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { cs_release(link); } } @@ -423,11 +430,16 @@ static void mio_cs_config(struct pcmcia_device *link) link->irq.IRQInfo1 = parse.cftable_entry.irq.IRQInfo1; link->irq.IRQInfo2 = parse.cftable_entry.irq.IRQInfo2; #endif +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T ret = pcmcia_request_irq(link, &link->irq); if (ret) { printk("pcmcia_request_irq() returned error: %i\n", ret); } //printk("RequestIRQ 0x%02x\n",ret); +#else + if (!link->irq) + dev_info(&link->dev, "no IRQ available\n"); +#endif #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->conf.ConfigIndex = 1; @@ -436,7 +448,9 @@ static void mio_cs_config(struct pcmcia_device *link) ret = pcmcia_request_configuration(link, &link->conf); //printk("RequestConfiguration %d\n",ret); +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T link->dev_node = &dev_node; +#endif } static int mio_cs_attach(comedi_device * dev, comedi_devconfig * it) @@ -454,7 +468,11 @@ static int mio_cs_attach(comedi_device * dev, comedi_devconfig * it) dev->driver = &driver_ni_mio_cs; dev->iobase = link->io.BasePort1; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T irq = link->irq.AssignedIRQ; +#else + irq = link->irq; +#endif printk("comedi%d: %s: DAQCard: io 0x%04lx, irq %u, ", dev->minor, dev->driver->driver_name, dev->iobase, irq); diff --git a/comedi/drivers/quatech_daqp_cs.c b/comedi/drivers/quatech_daqp_cs.c index ceda71c6..c963ff41 100644 --- a/comedi/drivers/quatech_daqp_cs.c +++ b/comedi/drivers/quatech_daqp_cs.c @@ -79,7 +79,9 @@ static char *version = "quatech_daqp_cs.c 1.10 2003/04/21 (Brent Baccala)"; typedef struct local_info_t { struct pcmcia_device *link; +#ifdef COMEDI_HAVE_DS_DEV_NODE_T dev_node_t node; +#endif int stop; int table_index; char board_name[32]; @@ -1099,6 +1101,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) local->link = link; link->priv = local; +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T /* Interrupt setup */ link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING | IRQ_HANDLE_PRESENT; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE @@ -1107,6 +1110,7 @@ static int daqp_cs_attach(struct pcmcia_device *link) link->irq.Handler = daqp_interrupt; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE link->irq.Instance = local; +#endif #endif /* @@ -1139,7 +1143,10 @@ static void daqp_cs_detach(struct pcmcia_device *link) DEBUG(0, "daqp_cs_detach(0x%p)\n", link); - if (link->dev_node) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T + if (link->dev_node) +#endif + { dev->stop = 1; daqp_cs_release(link); } @@ -1170,8 +1177,12 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, return -ENODEV; /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) +#endif + { p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; @@ -1199,7 +1210,9 @@ static int daqp_pcmcia_config_loop(struct pcmcia_device *p_dev, static void daqp_cs_config(struct pcmcia_device *link) { +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T local_info_t *dev = link->priv; +#endif int last_ret; #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE tuple_t tuple; @@ -1273,8 +1286,12 @@ static void daqp_cs_config(struct pcmcia_device *link) link->conf.ConfigIndex = cfg->index; /* Do we need to allocate an interrupt? */ +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T if (cfg->irq.IRQInfo1 || dflt.irq.IRQInfo1) +#endif + { link->conf.Attributes |= CONF_ENABLE_IRQ; + } /* IO window settings */ link->io.NumPorts1 = link->io.NumPorts2 = 0; @@ -1315,13 +1332,21 @@ static void daqp_cs_config(struct pcmcia_device *link) handler to the interrupt, unless the 'Handler' member of the irq structure is initialized. */ +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T if (link->conf.Attributes & CONF_ENABLE_IRQ) +#endif + { #ifndef CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE last_fn = RequestIRQ; #endif - if ((last_ret = pcmcia_request_irq(link, &link->irq))) { +#ifdef COMEDI_HAVE_CS_IRQ_REQ_T + last_ret = pcmcia_request_irq(link, &link->irq); +#else + last_ret = pcmcia_request_irq(link, daqp_interrupt); +#endif + if (last_ret) goto cs_failed; - } + } /* This actually configures the PCMCIA socket -- setting up @@ -1335,6 +1360,7 @@ static void daqp_cs_config(struct pcmcia_device *link) goto cs_failed; } +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T /* At this point, the dev_node_t structure(s) need to be initialized and arranged in a linked list at link->dev. @@ -1346,12 +1372,23 @@ static void daqp_cs_config(struct pcmcia_device *link) sprintf(dev->node.dev_name, "quatech_daqp_cs"); dev->node.major = dev->node.minor = 0; link->dev_node = &dev->node; +#endif /* Finally, report what we've done */ +#ifdef CONFIG_COMEDI_HAVE_DS_DEV_NODE_T printk(KERN_INFO "%s: index 0x%02x", dev->node.dev_name, link->conf.ConfigIndex); +#else + dev_info(&link->dev, "index 0x%02x", link->conf.ConfigIndex); +#endif if (link->conf.Attributes & CONF_ENABLE_IRQ) - printk(", irq %u", link->irq.AssignedIRQ); + printk(", irq %u", +#ifdef CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T + link->irq.AssignedIRQ +#else + link->irq +#endif + ); if (link->io.NumPorts1) printk(", io 0x%04x-0x%04x", link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); diff --git a/configure.ac b/configure.ac index dc214f15..0a8f934b 100644 --- a/configure.ac +++ b/configure.ac @@ -116,6 +116,18 @@ if test "$HAVE_PCMCIA_LOOP_TUPLE" = "yes" ; then AC_DEFINE([CONFIG_COMEDI_HAVE_PCMCIA_LOOP_TUPLE],[true],[Define if Linux kernel source has pcmcia_loop_tuple function]) fi +COMEDI_CHECK_DS_DEV_NODE_T([$LINUX_SRC_DIR], + [HAVE_DS_DEV_NODE_T="yes"], [HAVE_DS_DEV_NODE_T="no"]) +if test "$HAVE_DS_DEV_NODE_T" = "yes" ; then + AC_DEFINE([CONFIG_COMEDI_HAVE_DS_DEV_NODE_T],[true],[Define if Linux kernel source has dev_node_t in pcmcia/ds.h (removed in 2.6.35)]) +fi + +COMEDI_CHECK_CS_IRQ_REQ_T([$LINUX_SRC_DIR], + [HAVE_CS_IRQ_REQ_T="yes"], [HAVE_CS_IRQ_REQ_T="no"]) +if test "$HAVE_CS_IRQ_REQ_T" = "yes" ; then + AC_DEFINE([CONFIG_COMEDI_HAVE_CS_IRQ_REQ_T],[true],[Define if Linux kernel source has irq_req_t in pcmcia/cs.h (removed in 2.6.35)]) +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 93490891..4e4f8ccf 100644 --- a/m4/as-linux.m4 +++ b/m4/as-linux.m4 @@ -803,6 +803,40 @@ AC_DEFUN([COMEDI_CHECK_PCMCIA_LOOP_TUPLE], fi ]) +# COMEDI_CHECK_DS_DEV_NODE_T([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# Check if kernel pcmcia support is old enough to have the dev_node_t type +# in pcmcia/ds.h. +AC_DEFUN([COMEDI_CHECK_DS_DEV_NODE_T], +[ + AC_MSG_CHECKING([$1 for dev_node_t in pcmcia/ds.h (removed in 2.6.35)]) + if [grep -q dev_node_t "$1/include/pcmcia/ds.h"] 2>/dev/null ; then + AC_MSG_RESULT([yes]) + $2 + else + AC_MSG_RESULT([no]) + $3 + fi +]) + +# COMEDI_CHECK_CS_IRQ_REQ_T([LINUX_SOURCE_PATH], [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ------------------------------------------------------------- +# +# Check if kernel pcmcia support is old enough to have the irq_req_t type +# in pcmcia/cs.h. +AC_DEFUN([COMEDI_CHECK_CS_IRQ_REQ_T], +[ + AC_MSG_CHECKING([$1 for irq_req_t in pcmcia/cs.h (removed in 2.6.35)]) + if [grep -q irq_req_t "$1/include/pcmcia/cs.h"] 2>/dev/null ; 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]) # ------------------------------------------------------------- #