diff options
author | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-07-29 12:35:47 -0400 |
---|---|---|
committer | Dominik Brodowski <linux@dominikbrodowski.net> | 2010-09-29 11:20:22 -0400 |
commit | 7feabb6412ea23edd298c0fa90e5aa6733eb4a42 (patch) | |
tree | bfafe961aeb5449a71fbb389172b3a6c68b56e7c /drivers/pcmcia | |
parent | 37979e1546a790c44adbc7f27a85569944480ebc (diff) |
pcmcia: move config_{base,index,regs} to struct pcmcia_device
Several drivers prefer to explicitly set config_{base,index,regs},
formerly known as ConfigBase, ConfigIndex and Present. Instead of
passing these values inside config_req_t, store it in struct
pcmcia_device.
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: alsa-devel@alsa-project.org
CC: linux-serial@vger.kernel.org
CC: Jiri Kosina <jkosina@suse.cz>
CC: linux-scsi@vger.kernel.org
Acked-by: Gustavo F. Padovan <padovan@profusion.mobi> (for drivers/bluetooth)
Tested-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
Diffstat (limited to 'drivers/pcmcia')
-rw-r--r-- | drivers/pcmcia/cs_internal.h | 3 | ||||
-rw-r--r-- | drivers/pcmcia/ds.c | 8 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_cis.c | 2 | ||||
-rw-r--r-- | drivers/pcmcia/pcmcia_resource.c | 38 |
4 files changed, 24 insertions, 27 deletions
diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index a0c5adb37b5f..42eef437afd4 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h | |||
@@ -34,9 +34,6 @@ typedef struct config_t { | |||
34 | struct kref ref; | 34 | struct kref ref; |
35 | unsigned int state; | 35 | unsigned int state; |
36 | unsigned int Attributes; | 36 | unsigned int Attributes; |
37 | unsigned int ConfigBase; | ||
38 | unsigned char Option; | ||
39 | unsigned int CardValues; | ||
40 | 37 | ||
41 | struct resource io[MAX_IO_WIN]; /* io ports */ | 38 | struct resource io[MAX_IO_WIN]; /* io ports */ |
42 | struct resource mem[MAX_WIN]; /* mem areas */ | 39 | struct resource mem[MAX_WIN]; /* mem areas */ |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 55570d9e1e4c..00db60053f93 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -276,13 +276,13 @@ static int pcmcia_device_probe(struct device *dev) | |||
276 | ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, | 276 | ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, |
277 | &cis_config); | 277 | &cis_config); |
278 | if (!ret) { | 278 | if (!ret) { |
279 | p_dev->conf.ConfigBase = cis_config.base; | 279 | p_dev->config_base = cis_config.base; |
280 | p_dev->conf.Present = cis_config.rmask[0]; | 280 | p_dev->config_regs = cis_config.rmask[0]; |
281 | } else { | 281 | } else { |
282 | dev_printk(KERN_INFO, dev, | 282 | dev_printk(KERN_INFO, dev, |
283 | "pcmcia: could not parse base and rmask0 of CIS\n"); | 283 | "pcmcia: could not parse base and rmask0 of CIS\n"); |
284 | p_dev->conf.ConfigBase = 0; | 284 | p_dev->config_base = 0; |
285 | p_dev->conf.Present = 0; | 285 | p_dev->config_regs = 0; |
286 | } | 286 | } |
287 | 287 | ||
288 | ret = p_drv->probe(p_dev); | 288 | ret = p_drv->probe(p_dev); |
diff --git a/drivers/pcmcia/pcmcia_cis.c b/drivers/pcmcia/pcmcia_cis.c index 0ac54da15885..ac47cc4e20e8 100644 --- a/drivers/pcmcia/pcmcia_cis.c +++ b/drivers/pcmcia/pcmcia_cis.c | |||
@@ -151,7 +151,7 @@ static int pcmcia_do_loop_config(tuple_t *tuple, cisparse_t *parse, void *priv) | |||
151 | struct pcmcia_cfg_mem *cfg_mem = priv; | 151 | struct pcmcia_cfg_mem *cfg_mem = priv; |
152 | 152 | ||
153 | /* default values */ | 153 | /* default values */ |
154 | cfg_mem->p_dev->conf.ConfigIndex = cfg->index; | 154 | cfg_mem->p_dev->config_index = cfg->index; |
155 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) | 155 | if (cfg->flags & CISTPL_CFTABLE_DEFAULT) |
156 | cfg_mem->dflt = *cfg; | 156 | cfg_mem->dflt = *cfg; |
157 | 157 | ||
diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 6210e1c2b432..a1fb0dc1a71f 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c | |||
@@ -168,7 +168,7 @@ static int pcmcia_access_config(struct pcmcia_device *p_dev, | |||
168 | return -EACCES; | 168 | return -EACCES; |
169 | } | 169 | } |
170 | 170 | ||
171 | addr = (c->ConfigBase + where) >> 1; | 171 | addr = (p_dev->config_base + where) >> 1; |
172 | 172 | ||
173 | ret = accessf(s, 1, addr, 1, val); | 173 | ret = accessf(s, 1, addr, 1, val); |
174 | 174 | ||
@@ -443,6 +443,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
443 | pccard_io_map iomap; | 443 | pccard_io_map iomap; |
444 | unsigned char status = 0; | 444 | unsigned char status = 0; |
445 | unsigned char ext_status = 0; | 445 | unsigned char ext_status = 0; |
446 | unsigned char option = 0; | ||
446 | 447 | ||
447 | if (!(s->state & SOCKET_PRESENT)) | 448 | if (!(s->state & SOCKET_PRESENT)) |
448 | return -ENODEV; | 449 | return -ENODEV; |
@@ -473,7 +474,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
473 | if (req->Attributes & CONF_ENABLE_SPKR) { | 474 | if (req->Attributes & CONF_ENABLE_SPKR) { |
474 | s->socket.flags |= SS_SPKR_ENA; | 475 | s->socket.flags |= SS_SPKR_ENA; |
475 | status = CCSR_AUDIO_ENA; | 476 | status = CCSR_AUDIO_ENA; |
476 | if (!(req->Present & PRESENT_STATUS)) | 477 | if (!(p_dev->config_regs & PRESENT_STATUS)) |
477 | dev_warn(&p_dev->dev, "speaker requested, but " | 478 | dev_warn(&p_dev->dev, "speaker requested, but " |
478 | "PRESENT_STATUS not set!\n"); | 479 | "PRESENT_STATUS not set!\n"); |
479 | } | 480 | } |
@@ -482,54 +483,53 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, | |||
482 | else | 483 | else |
483 | s->socket.io_irq = 0; | 484 | s->socket.io_irq = 0; |
484 | if (req->Attributes & CONF_ENABLE_ESR) { | 485 | if (req->Attributes & CONF_ENABLE_ESR) { |
485 | req->Present |= PRESENT_EXT_STATUS; | 486 | p_dev->config_regs |= PRESENT_EXT_STATUS; |
486 | ext_status = ESR_REQ_ATTN_ENA; | 487 | ext_status = ESR_REQ_ATTN_ENA; |
487 | } | 488 | } |
488 | s->ops->set_socket(s, &s->socket); | 489 | s->ops->set_socket(s, &s->socket); |
489 | s->lock_count++; | 490 | s->lock_count++; |
490 | 491 | ||
491 | /* Set up CIS configuration registers */ | 492 | /* Set up CIS configuration registers */ |
492 | base = c->ConfigBase = req->ConfigBase; | 493 | base = p_dev->config_base; |
493 | c->CardValues = req->Present; | 494 | if (p_dev->config_regs & PRESENT_COPY) { |
494 | if (req->Present & PRESENT_COPY) { | ||
495 | u16 tmp = 0; | 495 | u16 tmp = 0; |
496 | dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); | 496 | dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); |
497 | pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); | 497 | pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); |
498 | } | 498 | } |
499 | if (req->Present & PRESENT_PIN_REPLACE) { | 499 | if (p_dev->config_regs & PRESENT_PIN_REPLACE) { |
500 | u16 tmp = 0; | 500 | u16 tmp = 0; |
501 | dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); | 501 | dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); |
502 | pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); | 502 | pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); |
503 | } | 503 | } |
504 | if (req->Present & PRESENT_OPTION) { | 504 | if (p_dev->config_regs & PRESENT_OPTION) { |
505 | if (s->functions == 1) { | 505 | if (s->functions == 1) { |
506 | c->Option = req->ConfigIndex & COR_CONFIG_MASK; | 506 | option = p_dev->config_index & COR_CONFIG_MASK; |
507 | } else { | 507 | } else { |
508 | c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; | 508 | option = p_dev->config_index & COR_MFC_CONFIG_MASK; |
509 | c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; | 509 | option |= COR_FUNC_ENA|COR_IREQ_ENA; |
510 | if (req->Present & PRESENT_IOBASE_0) | 510 | if (p_dev->config_regs & PRESENT_IOBASE_0) |
511 | c->Option |= COR_ADDR_DECODE; | 511 | option |= COR_ADDR_DECODE; |
512 | } | 512 | } |
513 | if ((req->Attributes & CONF_ENABLE_IRQ) && | 513 | if ((req->Attributes & CONF_ENABLE_IRQ) && |
514 | !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) | 514 | !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) |
515 | c->Option |= COR_LEVEL_REQ; | 515 | option |= COR_LEVEL_REQ; |
516 | pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); | 516 | pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option); |
517 | mdelay(40); | 517 | mdelay(40); |
518 | } | 518 | } |
519 | if (req->Present & PRESENT_STATUS) | 519 | if (p_dev->config_regs & PRESENT_STATUS) |
520 | pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); | 520 | pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); |
521 | 521 | ||
522 | if (req->Present & PRESENT_EXT_STATUS) | 522 | if (p_dev->config_regs & PRESENT_EXT_STATUS) |
523 | pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, | 523 | pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, |
524 | &ext_status); | 524 | &ext_status); |
525 | 525 | ||
526 | if (req->Present & PRESENT_IOBASE_0) { | 526 | if (p_dev->config_regs & PRESENT_IOBASE_0) { |
527 | u8 b = c->io[0].start & 0xff; | 527 | u8 b = c->io[0].start & 0xff; |
528 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); | 528 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); |
529 | b = (c->io[0].start >> 8) & 0xff; | 529 | b = (c->io[0].start >> 8) & 0xff; |
530 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); | 530 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); |
531 | } | 531 | } |
532 | if (req->Present & PRESENT_IOSIZE) { | 532 | if (p_dev->config_regs & PRESENT_IOSIZE) { |
533 | u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; | 533 | u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; |
534 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); | 534 | pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); |
535 | } | 535 | } |