aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-10-13 17:12:40 -0400
commit2be4ff2f084842839b041b793ed6237e8d1d315a (patch)
tree1d776ac1717edeff4ee7d59ab0aea2782cb86dba /drivers/isdn/hardware
parentcf2fa66055d718ae13e62451bb546505f63906a2 (diff)
parenta45b3fb19ba1e4dfc3fc53563a072612092930a9 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6: (49 commits) pcmcia: ioctl-internal definitions pcmcia: cistpl header cleanup pcmcia: remove unused argument to pcmcia_parse_tuple() pcmcia: card services header cleanup pcmcia: device_id header cleanup pcmcia: encapsulate ioaddr_t pcmcia: cleanup device driver header file pcmcia: cleanup socket services header file pcmcia: merge ds_internal.h into cs_internal.h pcmcia: cleanup cs_internal.h pcmcia: cs_internal.h is internal pcmcia: use dev_printk for cs_error() pcmcia: remove CS_ error codes alltogether pcmcia: deprecate CS_BAD_TUPLE pcmcia: deprecate CS_BAD_ARGS pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE pcmcia: deprecate CS_NO_MORE_ITEMS pcmcia: deprecate CS_IN_USE pcmcia: deprecate CS_CONFIGURATION_LOCKED ... Fix trivial conflict in drivers/pcmcia/ds.c manually
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c85
1 files changed, 26 insertions, 59 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index a5b941c327f7..c72565520e41 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -154,83 +154,50 @@ static void avmcs_detach(struct pcmcia_device *link)
154 154
155======================================================================*/ 155======================================================================*/
156 156
157static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, 157static int avmcs_configcheck(struct pcmcia_device *p_dev,
158 cisparse_t *parse) 158 cistpl_cftable_entry_t *cf,
159 cistpl_cftable_entry_t *dflt,
160 unsigned int vcc,
161 void *priv_data)
159{ 162{
160 int i = pcmcia_get_tuple_data(handle, tuple); 163 if (cf->io.nwin <= 0)
161 if (i != CS_SUCCESS) return i; 164 return -ENODEV;
162 return pcmcia_parse_tuple(handle, tuple, parse); 165
163} 166 p_dev->io.BasePort1 = cf->io.win[0].base;
164 167 p_dev->io.NumPorts1 = cf->io.win[0].len;
165static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, 168 p_dev->io.NumPorts2 = 0;
166 cisparse_t *parse) 169 printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n",
167{ 170 p_dev->io.BasePort1,
168 int i = pcmcia_get_first_tuple(handle, tuple); 171 p_dev->io.BasePort1+p_dev->io.NumPorts1-1);
169 if (i != CS_SUCCESS) return i; 172 return pcmcia_request_io(p_dev, &p_dev->io);
170 return get_tuple(handle, tuple, parse);
171}
172
173static 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} 173}
180 174
181static int avmcs_config(struct pcmcia_device *link) 175static int avmcs_config(struct pcmcia_device *link)
182{ 176{
183 tuple_t tuple;
184 cisparse_t parse;
185 cistpl_cftable_entry_t *cf = &parse.cftable_entry;
186 local_info_t *dev; 177 local_info_t *dev;
187 int i; 178 int i;
188 u_char buf[64];
189 char devname[128]; 179 char devname[128];
190 int cardtype; 180 int cardtype;
191 int (*addcard)(unsigned int port, unsigned irq); 181 int (*addcard)(unsigned int port, unsigned irq);
192 182
193 dev = link->priv; 183 dev = link->priv;
194 184
195 do { 185 devname[0] = 0;
196 devname[0] = 0; 186 if (link->prod_id[1])
197 if (link->prod_id[1]) 187 strlcpy(devname, link->prod_id[1], sizeof(devname));
198 strlcpy(devname, link->prod_id[1], sizeof(devname));
199 188
200 /* 189 /*
201 * find IO port 190 * find IO port
202 */ 191 */
203 tuple.TupleData = (cisdata_t *)buf; 192 if (pcmcia_loop_config(link, avmcs_configcheck, NULL))
204 tuple.TupleOffset = 0; tuple.TupleDataMax = 255; 193 return -ENODEV;
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
223found_port:
224 if (i != CS_SUCCESS) {
225 cs_error(link, RequestIO, i);
226 break;
227 }
228 194
195 do {
229 /* 196 /*
230 * allocate an interrupt line 197 * allocate an interrupt line
231 */ 198 */
232 i = pcmcia_request_irq(link, &link->irq); 199 i = pcmcia_request_irq(link, &link->irq);
233 if (i != CS_SUCCESS) { 200 if (i != 0) {
234 cs_error(link, RequestIRQ, i); 201 cs_error(link, RequestIRQ, i);
235 /* undo */ 202 /* undo */
236 pcmcia_disable_device(link); 203 pcmcia_disable_device(link);
@@ -241,7 +208,7 @@ found_port:
241 * configure the PCMCIA socket 208 * configure the PCMCIA socket
242 */ 209 */
243 i = pcmcia_request_configuration(link, &link->conf); 210 i = pcmcia_request_configuration(link, &link->conf);
244 if (i != CS_SUCCESS) { 211 if (i != 0) {
245 cs_error(link, RequestConfiguration, i); 212 cs_error(link, RequestConfiguration, i);
246 pcmcia_disable_device(link); 213 pcmcia_disable_device(link);
247 break; 214 break;