diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-07-29 02:38:55 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2008-08-22 19:21:27 -0400 |
commit | 5fcd4da0090828bd34a1956cb322a483c6bf163c (patch) | |
tree | b26a14ab9ea94bfdc7815d62aa59aad77a6a1817 /drivers/isdn/hardware | |
parent | 0e6f9d2708409cd8e864cdb94edbe599872a19d1 (diff) |
pcmcia: use pcmcia_loop_config in ISDN pcmcia drivers
Use the config loop helper in ISDN pcmcia drivers.
CC: Karsten Keil <kkeil@suse.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 80 |
1 files changed, 23 insertions, 57 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index a5b941c327f7..7a1ead117d11 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -154,78 +154,44 @@ static void avmcs_detach(struct pcmcia_device *link) | |||
154 | 154 | ||
155 | ======================================================================*/ | 155 | ======================================================================*/ |
156 | 156 | ||
157 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, | 157 | static int avmcs_configcheck(struct pcmcia_device *p_dev, |
158 | cisparse_t *parse) | 158 | cistpl_cftable_entry_t *cf, |
159 | void *priv_data) | ||
159 | { | 160 | { |
160 | int i = pcmcia_get_tuple_data(handle, tuple); | 161 | if (cf->io.nwin <= 0) |
161 | if (i != CS_SUCCESS) return i; | 162 | return -ENODEV; |
162 | return pcmcia_parse_tuple(handle, tuple, parse); | 163 | |
163 | } | 164 | p_dev->conf.ConfigIndex = cf->index; |
164 | 165 | p_dev->io.BasePort1 = cf->io.win[0].base; | |
165 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, | 166 | p_dev->io.NumPorts1 = cf->io.win[0].len; |
166 | cisparse_t *parse) | 167 | p_dev->io.NumPorts2 = 0; |
167 | { | 168 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", |
168 | int i = pcmcia_get_first_tuple(handle, tuple); | 169 | p_dev->io.BasePort1, |
169 | if (i != CS_SUCCESS) return i; | 170 | p_dev->io.BasePort1+p_dev->io.NumPorts1-1); |
170 | return get_tuple(handle, tuple, parse); | 171 | return pcmcia_request_io(p_dev, &p_dev->io); |
171 | } | ||
172 | |||
173 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, | ||
174 | cisparse_t *parse) | ||
175 | { | ||
176 | int i = pcmcia_get_next_tuple(handle, tuple); | ||
177 | if (i != CS_SUCCESS) return i; | ||
178 | return get_tuple(handle, tuple, parse); | ||
179 | } | 172 | } |
180 | 173 | ||
181 | static int avmcs_config(struct pcmcia_device *link) | 174 | static int avmcs_config(struct pcmcia_device *link) |
182 | { | 175 | { |
183 | tuple_t tuple; | ||
184 | cisparse_t parse; | ||
185 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | ||
186 | local_info_t *dev; | 176 | local_info_t *dev; |
187 | int i; | 177 | int i; |
188 | u_char buf[64]; | ||
189 | char devname[128]; | 178 | char devname[128]; |
190 | int cardtype; | 179 | int cardtype; |
191 | int (*addcard)(unsigned int port, unsigned irq); | 180 | int (*addcard)(unsigned int port, unsigned irq); |
192 | 181 | ||
193 | dev = link->priv; | 182 | dev = link->priv; |
194 | 183 | ||
195 | do { | 184 | devname[0] = 0; |
196 | devname[0] = 0; | 185 | if (link->prod_id[1]) |
197 | if (link->prod_id[1]) | 186 | strlcpy(devname, link->prod_id[1], sizeof(devname)); |
198 | strlcpy(devname, link->prod_id[1], sizeof(devname)); | ||
199 | |||
200 | /* | ||
201 | * find IO port | ||
202 | */ | ||
203 | tuple.TupleData = (cisdata_t *)buf; | ||
204 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | ||
205 | tuple.Attributes = 0; | ||
206 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | ||
207 | i = first_tuple(link, &tuple, &parse); | ||
208 | while (i == CS_SUCCESS) { | ||
209 | if (cf->io.nwin > 0) { | ||
210 | link->conf.ConfigIndex = cf->index; | ||
211 | link->io.BasePort1 = cf->io.win[0].base; | ||
212 | link->io.NumPorts1 = cf->io.win[0].len; | ||
213 | link->io.NumPorts2 = 0; | ||
214 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", | ||
215 | link->io.BasePort1, | ||
216 | link->io.BasePort1+link->io.NumPorts1-1); | ||
217 | i = pcmcia_request_io(link, &link->io); | ||
218 | if (i == CS_SUCCESS) goto found_port; | ||
219 | } | ||
220 | i = next_tuple(link, &tuple, &parse); | ||
221 | } | ||
222 | 187 | ||
223 | found_port: | 188 | /* |
224 | if (i != CS_SUCCESS) { | 189 | * find IO port |
225 | cs_error(link, RequestIO, i); | 190 | */ |
226 | break; | 191 | if (pcmcia_loop_config(link, avmcs_configcheck, NULL)) |
227 | } | 192 | return -ENODEV; |
228 | 193 | ||
194 | do { | ||
229 | /* | 195 | /* |
230 | * allocate an interrupt line | 196 | * allocate an interrupt line |
231 | */ | 197 | */ |