aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/pcmcia_ioctl.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2008-08-02 11:00:46 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2008-08-22 20:16:05 -0400
commit64f346425175ad33812cd693fbca48cd512dab63 (patch)
tree3ee3b0927b515de000d2c33fdc68bf9a9f4d4b12 /drivers/pcmcia/pcmcia_ioctl.c
parentef313e36d8896a42fc567a83a5d4b86821634e8d (diff)
pcmcia: move pccard_get_configuration_info to ioctl
With the PCMCIA ioctl being the only remaining user of _get_configuration_info, move the function to pcmcia_ioctl.c Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia/pcmcia_ioctl.c')
-rw-r--r--drivers/pcmcia/pcmcia_ioctl.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c
index f555a505214f..53dadc111002 100644
--- a/drivers/pcmcia/pcmcia_ioctl.c
+++ b/drivers/pcmcia/pcmcia_ioctl.c
@@ -287,6 +287,78 @@ static int pccard_get_status(struct pcmcia_socket *s,
287 return CS_SUCCESS; 287 return CS_SUCCESS;
288} /* pccard_get_status */ 288} /* pccard_get_status */
289 289
290int pccard_get_configuration_info(struct pcmcia_socket *s,
291 struct pcmcia_device *p_dev,
292 config_info_t *config)
293{
294 config_t *c;
295
296 if (!(s->state & SOCKET_PRESENT))
297 return CS_NO_CARD;
298
299
300#ifdef CONFIG_CARDBUS
301 if (s->state & SOCKET_CARDBUS) {
302 memset(config, 0, sizeof(config_info_t));
303 config->Vcc = s->socket.Vcc;
304 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
305 config->Option = s->cb_dev->subordinate->number;
306 if (s->state & SOCKET_CARDBUS_CONFIG) {
307 config->Attributes = CONF_VALID_CLIENT;
308 config->IntType = INT_CARDBUS;
309 config->AssignedIRQ = s->irq.AssignedIRQ;
310 if (config->AssignedIRQ)
311 config->Attributes |= CONF_ENABLE_IRQ;
312 if (s->io[0].res) {
313 config->BasePort1 = s->io[0].res->start;
314 config->NumPorts1 = s->io[0].res->end -
315 config->BasePort1 + 1;
316 }
317 }
318 return CS_SUCCESS;
319 }
320#endif
321
322 if (p_dev) {
323 c = p_dev->function_config;
324 config->Function = p_dev->func;
325 } else {
326 c = NULL;
327 config->Function = 0;
328 }
329
330 if ((c == NULL) || !(c->state & CONFIG_LOCKED)) {
331 config->Attributes = 0;
332 config->Vcc = s->socket.Vcc;
333 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
334 return CS_SUCCESS;
335 }
336
337 config->Attributes = c->Attributes | CONF_VALID_CLIENT;
338 config->Vcc = s->socket.Vcc;
339 config->Vpp1 = config->Vpp2 = s->socket.Vpp;
340 config->IntType = c->IntType;
341 config->ConfigBase = c->ConfigBase;
342 config->Status = c->Status;
343 config->Pin = c->Pin;
344 config->Copy = c->Copy;
345 config->Option = c->Option;
346 config->ExtStatus = c->ExtStatus;
347 config->Present = config->CardValues = c->CardValues;
348 config->IRQAttributes = c->irq.Attributes;
349 config->AssignedIRQ = s->irq.AssignedIRQ;
350 config->BasePort1 = c->io.BasePort1;
351 config->NumPorts1 = c->io.NumPorts1;
352 config->Attributes1 = c->io.Attributes1;
353 config->BasePort2 = c->io.BasePort2;
354 config->NumPorts2 = c->io.NumPorts2;
355 config->Attributes2 = c->io.Attributes2;
356 config->IOAddrLines = c->io.IOAddrLines;
357
358 return CS_SUCCESS;
359} /* pccard_get_configuration_info */
360
361
290/*====================================================================== 362/*======================================================================
291 363
292 These manage a ring buffer of events pending for one user process 364 These manage a ring buffer of events pending for one user process