diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2006-03-31 10:21:06 -0500 |
commit | fba395eee7d3f342ca739c20f5b3ee635d0420a0 (patch) | |
tree | 5a73f68d3514aa795b0d8c500e4d72170651d762 /drivers/isdn/hardware | |
parent | fd238232cd0ff4840ae6946bb338502154096d88 (diff) |
[PATCH] pcmcia: remove dev_link_t and client_handle_t indirection
dev_link_t * and client_handle_t both mean struct pcmcai_device * by now.
Therefore, remove all such indirections.
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/isdn/hardware')
-rw-r--r-- | drivers/isdn/hardware/avm/avm_cs.c | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 3b7461ece505..c9c794e2926d 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c | |||
@@ -51,8 +51,8 @@ MODULE_LICENSE("GPL"); | |||
51 | handler. | 51 | handler. |
52 | */ | 52 | */ |
53 | 53 | ||
54 | static void avmcs_config(dev_link_t *link); | 54 | static void avmcs_config(struct pcmcia_device *link); |
55 | static void avmcs_release(dev_link_t *link); | 55 | static void avmcs_release(struct pcmcia_device *link); |
56 | 56 | ||
57 | /* | 57 | /* |
58 | The attach() and detach() entry points are used to create and destroy | 58 | The attach() and detach() entry points are used to create and destroy |
@@ -65,10 +65,10 @@ static void avmcs_detach(struct pcmcia_device *p_dev); | |||
65 | /* | 65 | /* |
66 | A linked list of "instances" of the skeleton device. Each actual | 66 | A linked list of "instances" of the skeleton device. Each actual |
67 | PCMCIA card corresponds to one device instance, and is described | 67 | PCMCIA card corresponds to one device instance, and is described |
68 | by one dev_link_t structure (defined in ds.h). | 68 | by one struct pcmcia_device structure (defined in ds.h). |
69 | 69 | ||
70 | You may not want to use a linked list for this -- for example, the | 70 | You may not want to use a linked list for this -- for example, the |
71 | memory card driver uses an array of dev_link_t pointers, where minor | 71 | memory card driver uses an array of struct pcmcia_device pointers, where minor |
72 | device numbers are used to derive the corresponding array index. | 72 | device numbers are used to derive the corresponding array index. |
73 | */ | 73 | */ |
74 | 74 | ||
@@ -78,7 +78,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev); | |||
78 | example, ethernet cards, modems). In other cases, there may be | 78 | example, ethernet cards, modems). In other cases, there may be |
79 | many actual or logical devices (SCSI adapters, memory cards with | 79 | many actual or logical devices (SCSI adapters, memory cards with |
80 | multiple partitions). The dev_node_t structures need to be kept | 80 | multiple partitions). The dev_node_t structures need to be kept |
81 | in a linked list starting at the 'dev' field of a dev_link_t | 81 | in a linked list starting at the 'dev' field of a struct pcmcia_device |
82 | structure. We allocate them in the card's private data structure, | 82 | structure. We allocate them in the card's private data structure, |
83 | because they generally can't be allocated dynamically. | 83 | because they generally can't be allocated dynamically. |
84 | */ | 84 | */ |
@@ -145,10 +145,8 @@ static int avmcs_attach(struct pcmcia_device *p_dev) | |||
145 | 145 | ||
146 | ======================================================================*/ | 146 | ======================================================================*/ |
147 | 147 | ||
148 | static void avmcs_detach(struct pcmcia_device *p_dev) | 148 | static void avmcs_detach(struct pcmcia_device *link) |
149 | { | 149 | { |
150 | dev_link_t *link = dev_to_instance(p_dev); | ||
151 | |||
152 | if (link->state & DEV_CONFIG) | 150 | if (link->state & DEV_CONFIG) |
153 | avmcs_release(link); | 151 | avmcs_release(link); |
154 | 152 | ||
@@ -163,7 +161,7 @@ static void avmcs_detach(struct pcmcia_device *p_dev) | |||
163 | 161 | ||
164 | ======================================================================*/ | 162 | ======================================================================*/ |
165 | 163 | ||
166 | static int get_tuple(client_handle_t handle, tuple_t *tuple, | 164 | static int get_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
167 | cisparse_t *parse) | 165 | cisparse_t *parse) |
168 | { | 166 | { |
169 | int i = pcmcia_get_tuple_data(handle, tuple); | 167 | int i = pcmcia_get_tuple_data(handle, tuple); |
@@ -171,7 +169,7 @@ static int get_tuple(client_handle_t handle, tuple_t *tuple, | |||
171 | return pcmcia_parse_tuple(handle, tuple, parse); | 169 | return pcmcia_parse_tuple(handle, tuple, parse); |
172 | } | 170 | } |
173 | 171 | ||
174 | static int first_tuple(client_handle_t handle, tuple_t *tuple, | 172 | static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
175 | cisparse_t *parse) | 173 | cisparse_t *parse) |
176 | { | 174 | { |
177 | int i = pcmcia_get_first_tuple(handle, tuple); | 175 | int i = pcmcia_get_first_tuple(handle, tuple); |
@@ -179,7 +177,7 @@ static int first_tuple(client_handle_t handle, tuple_t *tuple, | |||
179 | return get_tuple(handle, tuple, parse); | 177 | return get_tuple(handle, tuple, parse); |
180 | } | 178 | } |
181 | 179 | ||
182 | static int next_tuple(client_handle_t handle, tuple_t *tuple, | 180 | static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, |
183 | cisparse_t *parse) | 181 | cisparse_t *parse) |
184 | { | 182 | { |
185 | int i = pcmcia_get_next_tuple(handle, tuple); | 183 | int i = pcmcia_get_next_tuple(handle, tuple); |
@@ -187,9 +185,8 @@ static int next_tuple(client_handle_t handle, tuple_t *tuple, | |||
187 | return get_tuple(handle, tuple, parse); | 185 | return get_tuple(handle, tuple, parse); |
188 | } | 186 | } |
189 | 187 | ||
190 | static void avmcs_config(dev_link_t *link) | 188 | static void avmcs_config(struct pcmcia_device *link) |
191 | { | 189 | { |
192 | client_handle_t handle; | ||
193 | tuple_t tuple; | 190 | tuple_t tuple; |
194 | cisparse_t parse; | 191 | cisparse_t parse; |
195 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; | 192 | cistpl_cftable_entry_t *cf = &parse.cftable_entry; |
@@ -199,8 +196,7 @@ static void avmcs_config(dev_link_t *link) | |||
199 | char devname[128]; | 196 | char devname[128]; |
200 | int cardtype; | 197 | int cardtype; |
201 | int (*addcard)(unsigned int port, unsigned irq); | 198 | int (*addcard)(unsigned int port, unsigned irq); |
202 | 199 | ||
203 | handle = link->handle; | ||
204 | dev = link->priv; | 200 | dev = link->priv; |
205 | 201 | ||
206 | /* | 202 | /* |
@@ -209,19 +205,19 @@ static void avmcs_config(dev_link_t *link) | |||
209 | */ | 205 | */ |
210 | do { | 206 | do { |
211 | tuple.DesiredTuple = CISTPL_CONFIG; | 207 | tuple.DesiredTuple = CISTPL_CONFIG; |
212 | i = pcmcia_get_first_tuple(handle, &tuple); | 208 | i = pcmcia_get_first_tuple(link, &tuple); |
213 | if (i != CS_SUCCESS) break; | 209 | if (i != CS_SUCCESS) break; |
214 | tuple.TupleData = buf; | 210 | tuple.TupleData = buf; |
215 | tuple.TupleDataMax = 64; | 211 | tuple.TupleDataMax = 64; |
216 | tuple.TupleOffset = 0; | 212 | tuple.TupleOffset = 0; |
217 | i = pcmcia_get_tuple_data(handle, &tuple); | 213 | i = pcmcia_get_tuple_data(link, &tuple); |
218 | if (i != CS_SUCCESS) break; | 214 | if (i != CS_SUCCESS) break; |
219 | i = pcmcia_parse_tuple(handle, &tuple, &parse); | 215 | i = pcmcia_parse_tuple(link, &tuple, &parse); |
220 | if (i != CS_SUCCESS) break; | 216 | if (i != CS_SUCCESS) break; |
221 | link->conf.ConfigBase = parse.config.base; | 217 | link->conf.ConfigBase = parse.config.base; |
222 | } while (0); | 218 | } while (0); |
223 | if (i != CS_SUCCESS) { | 219 | if (i != CS_SUCCESS) { |
224 | cs_error(link->handle, ParseTuple, i); | 220 | cs_error(link, ParseTuple, i); |
225 | link->state &= ~DEV_CONFIG_PENDING; | 221 | link->state &= ~DEV_CONFIG_PENDING; |
226 | return; | 222 | return; |
227 | } | 223 | } |
@@ -238,7 +234,7 @@ static void avmcs_config(dev_link_t *link) | |||
238 | tuple.DesiredTuple = CISTPL_VERS_1; | 234 | tuple.DesiredTuple = CISTPL_VERS_1; |
239 | 235 | ||
240 | devname[0] = 0; | 236 | devname[0] = 0; |
241 | if( !first_tuple(handle, &tuple, &parse) && parse.version_1.ns > 1 ) { | 237 | if( !first_tuple(link, &tuple, &parse) && parse.version_1.ns > 1 ) { |
242 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], | 238 | strlcpy(devname,parse.version_1.str + parse.version_1.ofs[1], |
243 | sizeof(devname)); | 239 | sizeof(devname)); |
244 | } | 240 | } |
@@ -249,7 +245,7 @@ static void avmcs_config(dev_link_t *link) | |||
249 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; | 245 | tuple.TupleOffset = 0; tuple.TupleDataMax = 255; |
250 | tuple.Attributes = 0; | 246 | tuple.Attributes = 0; |
251 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; | 247 | tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; |
252 | i = first_tuple(handle, &tuple, &parse); | 248 | i = first_tuple(link, &tuple, &parse); |
253 | while (i == CS_SUCCESS) { | 249 | while (i == CS_SUCCESS) { |
254 | if (cf->io.nwin > 0) { | 250 | if (cf->io.nwin > 0) { |
255 | link->conf.ConfigIndex = cf->index; | 251 | link->conf.ConfigIndex = cf->index; |
@@ -259,36 +255,36 @@ static void avmcs_config(dev_link_t *link) | |||
259 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", | 255 | printk(KERN_INFO "avm_cs: testing i/o %#x-%#x\n", |
260 | link->io.BasePort1, | 256 | link->io.BasePort1, |
261 | link->io.BasePort1+link->io.NumPorts1-1); | 257 | link->io.BasePort1+link->io.NumPorts1-1); |
262 | i = pcmcia_request_io(link->handle, &link->io); | 258 | i = pcmcia_request_io(link, &link->io); |
263 | if (i == CS_SUCCESS) goto found_port; | 259 | if (i == CS_SUCCESS) goto found_port; |
264 | } | 260 | } |
265 | i = next_tuple(handle, &tuple, &parse); | 261 | i = next_tuple(link, &tuple, &parse); |
266 | } | 262 | } |
267 | 263 | ||
268 | found_port: | 264 | found_port: |
269 | if (i != CS_SUCCESS) { | 265 | if (i != CS_SUCCESS) { |
270 | cs_error(link->handle, RequestIO, i); | 266 | cs_error(link, RequestIO, i); |
271 | break; | 267 | break; |
272 | } | 268 | } |
273 | 269 | ||
274 | /* | 270 | /* |
275 | * allocate an interrupt line | 271 | * allocate an interrupt line |
276 | */ | 272 | */ |
277 | i = pcmcia_request_irq(link->handle, &link->irq); | 273 | i = pcmcia_request_irq(link, &link->irq); |
278 | if (i != CS_SUCCESS) { | 274 | if (i != CS_SUCCESS) { |
279 | cs_error(link->handle, RequestIRQ, i); | 275 | cs_error(link, RequestIRQ, i); |
280 | /* undo */ | 276 | /* undo */ |
281 | pcmcia_disable_device(link->handle); | 277 | pcmcia_disable_device(link); |
282 | break; | 278 | break; |
283 | } | 279 | } |
284 | 280 | ||
285 | /* | 281 | /* |
286 | * configure the PCMCIA socket | 282 | * configure the PCMCIA socket |
287 | */ | 283 | */ |
288 | i = pcmcia_request_configuration(link->handle, &link->conf); | 284 | i = pcmcia_request_configuration(link, &link->conf); |
289 | if (i != CS_SUCCESS) { | 285 | if (i != CS_SUCCESS) { |
290 | cs_error(link->handle, RequestConfiguration, i); | 286 | cs_error(link, RequestConfiguration, i); |
291 | pcmcia_disable_device(link->handle); | 287 | pcmcia_disable_device(link); |
292 | break; | 288 | break; |
293 | } | 289 | } |
294 | 290 | ||
@@ -351,10 +347,10 @@ found_port: | |||
351 | 347 | ||
352 | ======================================================================*/ | 348 | ======================================================================*/ |
353 | 349 | ||
354 | static void avmcs_release(dev_link_t *link) | 350 | static void avmcs_release(struct pcmcia_device *link) |
355 | { | 351 | { |
356 | b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); | 352 | b1pcmcia_delcard(link->io.BasePort1, link->irq.AssignedIRQ); |
357 | pcmcia_disable_device(link->handle); | 353 | pcmcia_disable_device(link); |
358 | } /* avmcs_release */ | 354 | } /* avmcs_release */ |
359 | 355 | ||
360 | 356 | ||