diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-30 07:13:46 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-09-29 11:20:24 -0400 |
commit | 00990e7ce0b0e596fe41d9c64d6933ea70084003 (patch) | |
tree | 189e0dd92860feba84231c66955749574cac5d6d /drivers/bluetooth/bt3c_cs.c | |
parent | 440eed43e2a95bb842488755683716814da10f2b (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/bt3c_cs.c')
-rw-r--r-- | drivers/bluetooth/bt3c_cs.c | 53 |
1 files changed, 27 insertions, 26 deletions
diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 97338a3aae1a..8b8be35fe312 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c | |||
@@ -656,10 +656,8 @@ static int bt3c_probe(struct pcmcia_device *link) | |||
656 | info->p_dev = link; | 656 | info->p_dev = link; |
657 | link->priv = info; | 657 | link->priv = info; |
658 | 658 | ||
659 | link->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | 659 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP | |
660 | link->resource[0]->end = 8; | 660 | CONF_AUTO_SET_IO; |
661 | |||
662 | link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_VPP; | ||
663 | 661 | ||
664 | return bt3c_config(link); | 662 | return bt3c_config(link); |
665 | } | 663 | } |
@@ -673,38 +671,41 @@ static void bt3c_detach(struct pcmcia_device *link) | |||
673 | kfree(info); | 671 | kfree(info); |
674 | } | 672 | } |
675 | 673 | ||
676 | static int bt3c_check_config(struct pcmcia_device *p_dev, | 674 | static int bt3c_check_config(struct pcmcia_device *p_dev, void *priv_data) |
677 | cistpl_cftable_entry_t *cf, | ||
678 | cistpl_cftable_entry_t *dflt, | ||
679 | void *priv_data) | ||
680 | { | 675 | { |
681 | unsigned long try = (unsigned long) priv_data; | 676 | int *try = priv_data; |
682 | p_dev->io_lines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; | ||
683 | 677 | ||
684 | if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && | 678 | if (try == 0) |
685 | (cf->io.win[0].base != 0)) { | 679 | p_dev->io_lines = 16; |
686 | p_dev->resource[0]->start = cf->io.win[0].base; | 680 | |
687 | if (!pcmcia_request_io(p_dev)) | 681 | if ((p_dev->resource[0]->end != 8) || (p_dev->resource[0]->start == 0)) |
688 | return 0; | 682 | return -EINVAL; |
689 | } | 683 | |
690 | return -ENODEV; | 684 | p_dev->resource[0]->end = 8; |
685 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; | ||
686 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
687 | |||
688 | return pcmcia_request_io(p_dev); | ||
691 | } | 689 | } |
692 | 690 | ||
693 | static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, | 691 | static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, |
694 | cistpl_cftable_entry_t *cf, | ||
695 | cistpl_cftable_entry_t *dflt, | ||
696 | void *priv_data) | 692 | void *priv_data) |
697 | { | 693 | { |
698 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; | 694 | static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; |
699 | int j; | 695 | int j; |
700 | 696 | ||
701 | if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { | 697 | if (p_dev->io_lines > 3) |
702 | for (j = 0; j < 5; j++) { | 698 | return -ENODEV; |
703 | p_dev->resource[0]->start = base[j]; | 699 | |
704 | p_dev->io_lines = base[j] ? 16 : 3; | 700 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
705 | if (!pcmcia_request_io(p_dev)) | 701 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
706 | return 0; | 702 | p_dev->resource[0]->end = 8; |
707 | } | 703 | |
704 | for (j = 0; j < 5; j++) { | ||
705 | p_dev->resource[0]->start = base[j]; | ||
706 | p_dev->io_lines = base[j] ? 16 : 3; | ||
707 | if (!pcmcia_request_io(p_dev)) | ||
708 | return 0; | ||
708 | } | 709 | } |
709 | return -ENODEV; | 710 | return -ENODEV; |
710 | } | 711 | } |