aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/bluetooth/btuart_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-07-30 07:13:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-09-29 11:20:24 -0400
commit00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch)
tree189e0dd92860feba84231c66955749574cac5d6d /drivers/bluetooth/btuart_cs.c
parent440eed43e2a95bb842488755683716814da10f2b (diff)
pcmcia: use autoconfiguration feature for ioports and iomem
When CONF_AUTO_SET_IO or CONF_AUTO_SET_IOMEM are set, the corresponding fields in struct pcmcia_device *p_dev->resource[0,1,2] are set accordinly. Drivers wishing to override certain settings may do so in the callback function, but they no longer need to parse the CIS entries stored in cistpl_cftable_entry_t themselves. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-ide@vger.kernel.org CC: linux-usb@vger.kernel.org CC: laforge@gnumonks.org CC: linux-mtd@lists.infradead.org CC: linux-bluetooth@vger.kernel.org CC: alsa-devel@alsa-project.org CC: linux-serial@vger.kernel.org CC: Jiri Kosina <jkosina@suse.cz> CC: linux-scsi@vger.kernel.org Tested-by: Wolfram Sang <w.sang@pengutronix.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/bluetooth/btuart_cs.c')
-rw-r--r--drivers/bluetooth/btuart_cs.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c
index 8a6864fc8c38..9f9bb69dc0a2 100644
--- a/drivers/bluetooth/btuart_cs.c
+++ b/drivers/bluetooth/btuart_cs.c
@@ -585,10 +585,8 @@ static int btuart_probe(struct pcmcia_device *link)
585 info->p_dev = link; 585 info->p_dev = link;
586 link->priv = info; 586 link->priv = info;
587 587
588 link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; 588 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP |
589 link->resource[0]->end = 8; 589 CONF_AUTO_SET_IO;
590
591 link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP;
592 590
593 return btuart_config(link); 591 return btuart_config(link);
594} 592}
@@ -602,38 +600,41 @@ static void btuart_detach(struct pcmcia_device *link)
602 kfree(info); 600 kfree(info);
603} 601}
604 602
605static int btuart_check_config(struct pcmcia_device *p_dev, 603static int btuart_check_config(struct pcmcia_device *p_dev, void *priv_data)
606 cistpl_cftable_entry_t *cf,
607 cistpl_cftable_entry_t *dflt,
608 void *priv_data)
609{ 604{
610 int *try = priv_data; 605 int *try = priv_data;
611 p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK;
612 606
613 if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && 607 if (try == 0)
614 (cf->io.win[0].base != 0)) { 608 p_dev->io_lines = 16;
615 p_dev->resource[0]->start = cf->io.win[0].base; 609
616 if (!pcmcia_request_io(p_dev)) 610 if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0))
617 return 0; 611 return -EINVAL;
618 } 612
619 return -ENODEV; 613 p_dev->resource[0]->end = 8;
614 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
615 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
616
617 return pcmcia_request_io(p_dev);
620} 618}
621 619
622static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, 620static int btuart_check_config_notpicky(struct pcmcia_device *p_dev,
623 cistpl_cftable_entry_t *cf,
624 cistpl_cftable_entry_t *dflt,
625 void *priv_data) 621 void *priv_data)
626{ 622{
627 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; 623 static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
628 int j; 624 int j;
629 625
630 if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { 626 if (p_dev->io_lines > 3)
631 for (j = 0; j < 5; j++) { 627 return -ENODEV;
632 p_dev->resource[0]->start = base[j]; 628
633 p_dev->io_lines = base[j] ? 16 : 3; 629 p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH;
634 if (!pcmcia_request_io(p_dev)) 630 p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8;
635 return 0; 631 p_dev->resource[0]->end = 8;
636 } 632
633 for (j = 0; j < 5; j++) {
634 p_dev->resource[0]->start = base[j];
635 p_dev->io_lines = base[j] ? 16 : 3;
636 if (!pcmcia_request_io(p_dev))
637 return 0;
637 } 638 }
638 return -ENODEV; 639 return -ENODEV;
639} 640}