--- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -757,7 +757,11 @@ goto out; /* Now actually get the IRQ */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) ret = request_irq(card->p_dev->irq, if_cs_interrupt, +#else + ret = request_irq(card->p_dev->irq.AssignedIRQ, if_cs_interrupt, +#endif IRQF_SHARED, DRV_NAME, card); if (ret) { pr_err("error in request_irq\n"); @@ -775,7 +779,11 @@ priv->fw_ready = 1; if (lbs_start_card(priv) != 0) { pr_err("could not activate card\n"); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) free_irq(card->p_dev->irq, card); +#else + free_irq(card->p_dev->irq.AssignedIRQ, card); +#endif } out: @@ -824,7 +832,11 @@ lbs_deb_enter(LBS_DEB_CS); +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) free_irq(p_dev->irq, card); +#else + free_irq(p_dev->irq.AssignedIRQ, card); +#endif pcmcia_disable_device(p_dev); if (card->iobase) ioport_unmap(card->iobase); @@ -832,7 +844,7 @@ lbs_deb_leave(LBS_DEB_CS); } - +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) static int if_cs_ioprobe(struct pcmcia_device *p_dev, void *priv_data) { p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; @@ -842,9 +854,39 @@ pr_err("wrong CIS (check number of IO windows)\n"); return -ENODEV; } +#else +static int if_cs_ioprobe(struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + unsigned int vcc, + void *priv_data) +{ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) + p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_AUTO; + p_dev->resource[0]->start = cfg->io.win[0].base; + p_dev->resource[0]->end = cfg->io.win[0].len; +#else + p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; + p_dev->io.BasePort1 = cfg->io.win[0].base; + p_dev->io.NumPorts1 = cfg->io.win[0].len; +#endif + + /* Do we need to allocate an interrupt? */ + p_dev->conf.Attributes |= CONF_ENABLE_IRQ; + + /* IO window settings */ + if (cfg->io.nwin != 1) { + pr_err("wrong CIS (check number of IO windows)\n"); + return -ENODEV; + } +#endif /* This reserves IO space but doesn't actually enable it */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) return pcmcia_request_io(p_dev); +#else + return pcmcia_request_io(p_dev, &p_dev->io); +#endif } static int if_cs_probe(struct pcmcia_device *p_dev) @@ -863,7 +905,16 @@ card->p_dev = p_dev; p_dev->priv = card; +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) p_dev->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO; +#else +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35)) + p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; + p_dev->irq.Handler = NULL; +#endif + p_dev->conf.Attributes = 0; + p_dev->conf.IntType = INT_MEMORY_AND_IO; +#endif if (pcmcia_loop_config(p_dev, if_cs_ioprobe, NULL)) { pr_err("error in pcmcia_loop_config\n"); @@ -875,12 +926,26 @@ * a handler to the interrupt, unless the 'Handler' member of * the irq structure is initialized. */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) if (!p_dev->irq) goto out1; +#else + if (p_dev->conf.Attributes & CONF_ENABLE_IRQ) { + ret = pcmcia_request_irq(p_dev, &p_dev->irq); + if (ret) { + pr_err("error in pcmcia_request_irq\n"); + goto out1; + } + } +#endif /* Initialize io access */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) card->iobase = ioport_map(p_dev->resource[0]->start, resource_size(p_dev->resource[0])); +#else + card->iobase = ioport_map(p_dev->io.BasePort1, p_dev->io.NumPorts1); +#endif if (!card->iobase) { pr_err("error in ioport_map\n"); ret = -EIO; @@ -894,7 +959,17 @@ } /* Finally, report what we've done */ +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,36)) lbs_deb_cs("irq %d, io %pR", p_dev->irq, p_dev->resource[0]); +#elif (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,35)) + lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", + p_dev->irq, p_dev->io.BasePort1, + p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); +#else + lbs_deb_cs("irq %d, io 0x%04x-0x%04x\n", + p_dev->irq.AssignedIRQ, p_dev->io.BasePort1, + p_dev->io.BasePort1 + p_dev->io.NumPorts1 - 1); +#endif /* * Most of the libertas cards can do unaligned register access, but some @@ -1001,7 +1076,13 @@ static struct pcmcia_driver lbs_driver = { .owner = THIS_MODULE, +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,37)) .name = DRV_NAME, +#else + .drv = { + .name = DRV_NAME, + }, +#endif .probe = if_cs_probe, .remove = if_cs_detach, .id_table = if_cs_ids,