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/telephony/ixj_pcmcia.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/telephony/ixj_pcmcia.c')
-rw-r--r-- | drivers/telephony/ixj_pcmcia.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 670a76bf5164..76edd39525de 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c | |||
@@ -31,8 +31,6 @@ static int ixj_probe(struct pcmcia_device *p_dev) | |||
31 | { | 31 | { |
32 | dev_dbg(&p_dev->dev, "ixj_attach()\n"); | 32 | dev_dbg(&p_dev->dev, "ixj_attach()\n"); |
33 | /* Create new ixj device */ | 33 | /* Create new ixj device */ |
34 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; | ||
35 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; | ||
36 | p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); | 34 | p_dev->priv = kzalloc(sizeof(struct ixj_info_t), GFP_KERNEL); |
37 | if (!p_dev->priv) { | 35 | if (!p_dev->priv) { |
38 | return -ENOMEM; | 36 | return -ENOMEM; |
@@ -109,36 +107,28 @@ failed: | |||
109 | return; | 107 | return; |
110 | } | 108 | } |
111 | 109 | ||
112 | static int ixj_config_check(struct pcmcia_device *p_dev, | 110 | static int ixj_config_check(struct pcmcia_device *p_dev, void *priv_data) |
113 | cistpl_cftable_entry_t *cfg, | ||
114 | cistpl_cftable_entry_t *dflt, | ||
115 | void *priv_data) | ||
116 | { | 111 | { |
117 | if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { | 112 | p_dev->resource[0]->flags &= ~IO_DATA_PATH_WIDTH; |
118 | cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; | 113 | p_dev->resource[0]->flags |= IO_DATA_PATH_WIDTH_8; |
119 | p_dev->resource[0]->start = io->win[0].base; | 114 | p_dev->resource[1]->flags &= ~IO_DATA_PATH_WIDTH; |
120 | p_dev->resource[0]->end = io->win[0].len; | 115 | p_dev->resource[1]->flags |= IO_DATA_PATH_WIDTH_8; |
121 | p_dev->io_lines = 3; | 116 | p_dev->io_lines = 3; |
122 | if (io->nwin == 2) { | 117 | |
123 | p_dev->resource[1]->start = io->win[1].base; | 118 | return pcmcia_request_io(p_dev); |
124 | p_dev->resource[1]->end = io->win[1].len; | ||
125 | } | ||
126 | if (!pcmcia_request_io(p_dev)) | ||
127 | return 0; | ||
128 | } | ||
129 | return -ENODEV; | ||
130 | } | 119 | } |
131 | 120 | ||
132 | static int ixj_config(struct pcmcia_device * link) | 121 | static int ixj_config(struct pcmcia_device * link) |
133 | { | 122 | { |
134 | IXJ *j; | 123 | IXJ *j; |
135 | ixj_info_t *info; | 124 | ixj_info_t *info; |
136 | cistpl_cftable_entry_t dflt = { 0 }; | ||
137 | 125 | ||
138 | info = link->priv; | 126 | info = link->priv; |
139 | dev_dbg(&link->dev, "ixj_config\n"); | 127 | dev_dbg(&link->dev, "ixj_config\n"); |
140 | 128 | ||
141 | if (pcmcia_loop_config(link, ixj_config_check, &dflt)) | 129 | link->config_flags = CONF_AUTO_SET_IO; |
130 | |||
131 | if (pcmcia_loop_config(link, ixj_config_check, NULL)) | ||
142 | goto failed; | 132 | goto failed; |
143 | 133 | ||
144 | if (pcmcia_enable_device(link)) | 134 | if (pcmcia_enable_device(link)) |