From 7feabb6412ea23edd298c0fa90e5aa6733eb4a42 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 29 Jul 2010 18:35:47 +0200 Subject: 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 CC: linux-scsi@vger.kernel.org Acked-by: Gustavo F. Padovan (for drivers/bluetooth) Tested-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 3 --- drivers/pcmcia/ds.c | 8 ++++---- drivers/pcmcia/pcmcia_cis.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 38 +++++++++++++++++++------------------- 4 files changed, 24 insertions(+), 27 deletions(-) (limited to 'drivers/pcmcia') 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 { struct kref ref; unsigned int state; unsigned int Attributes; - unsigned int ConfigBase; - unsigned char Option; - unsigned int CardValues; struct resource io[MAX_IO_WIN]; /* io ports */ 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) ret = pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_CONFIG, &cis_config); if (!ret) { - p_dev->conf.ConfigBase = cis_config.base; - p_dev->conf.Present = cis_config.rmask[0]; + p_dev->config_base = cis_config.base; + p_dev->config_regs = cis_config.rmask[0]; } else { dev_printk(KERN_INFO, dev, "pcmcia: could not parse base and rmask0 of CIS\n"); - p_dev->conf.ConfigBase = 0; - p_dev->conf.Present = 0; + p_dev->config_base = 0; + p_dev->config_regs = 0; } 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) struct pcmcia_cfg_mem *cfg_mem = priv; /* default values */ - cfg_mem->p_dev->conf.ConfigIndex = cfg->index; + cfg_mem->p_dev->config_index = cfg->index; if (cfg->flags & CISTPL_CFTABLE_DEFAULT) cfg_mem->dflt = *cfg; 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, return -EACCES; } - addr = (c->ConfigBase + where) >> 1; + addr = (p_dev->config_base + where) >> 1; ret = accessf(s, 1, addr, 1, val); @@ -443,6 +443,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, pccard_io_map iomap; unsigned char status = 0; unsigned char ext_status = 0; + unsigned char option = 0; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -473,7 +474,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, if (req->Attributes & CONF_ENABLE_SPKR) { s->socket.flags |= SS_SPKR_ENA; status = CCSR_AUDIO_ENA; - if (!(req->Present & PRESENT_STATUS)) + if (!(p_dev->config_regs & PRESENT_STATUS)) dev_warn(&p_dev->dev, "speaker requested, but " "PRESENT_STATUS not set!\n"); } @@ -482,54 +483,53 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, else s->socket.io_irq = 0; if (req->Attributes & CONF_ENABLE_ESR) { - req->Present |= PRESENT_EXT_STATUS; + p_dev->config_regs |= PRESENT_EXT_STATUS; ext_status = ESR_REQ_ATTN_ENA; } s->ops->set_socket(s, &s->socket); s->lock_count++; /* Set up CIS configuration registers */ - base = c->ConfigBase = req->ConfigBase; - c->CardValues = req->Present; - if (req->Present & PRESENT_COPY) { + base = p_dev->config_base; + if (p_dev->config_regs & PRESENT_COPY) { u16 tmp = 0; dev_dbg(&p_dev->dev, "clearing CISREG_SCR\n"); pcmcia_write_cis_mem(s, 1, (base + CISREG_SCR)>>1, 1, &tmp); } - if (req->Present & PRESENT_PIN_REPLACE) { + if (p_dev->config_regs & PRESENT_PIN_REPLACE) { u16 tmp = 0; dev_dbg(&p_dev->dev, "clearing CISREG_PRR\n"); pcmcia_write_cis_mem(s, 1, (base + CISREG_PRR)>>1, 1, &tmp); } - if (req->Present & PRESENT_OPTION) { + if (p_dev->config_regs & PRESENT_OPTION) { if (s->functions == 1) { - c->Option = req->ConfigIndex & COR_CONFIG_MASK; + option = p_dev->config_index & COR_CONFIG_MASK; } else { - c->Option = req->ConfigIndex & COR_MFC_CONFIG_MASK; - c->Option |= COR_FUNC_ENA|COR_IREQ_ENA; - if (req->Present & PRESENT_IOBASE_0) - c->Option |= COR_ADDR_DECODE; + option = p_dev->config_index & COR_MFC_CONFIG_MASK; + option |= COR_FUNC_ENA|COR_IREQ_ENA; + if (p_dev->config_regs & PRESENT_IOBASE_0) + option |= COR_ADDR_DECODE; } if ((req->Attributes & CONF_ENABLE_IRQ) && !(req->Attributes & CONF_ENABLE_PULSE_IRQ)) - c->Option |= COR_LEVEL_REQ; - pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); + option |= COR_LEVEL_REQ; + pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &option); mdelay(40); } - if (req->Present & PRESENT_STATUS) + if (p_dev->config_regs & PRESENT_STATUS) pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); - if (req->Present & PRESENT_EXT_STATUS) + if (p_dev->config_regs & PRESENT_EXT_STATUS) pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &ext_status); - if (req->Present & PRESENT_IOBASE_0) { + if (p_dev->config_regs & PRESENT_IOBASE_0) { u8 b = c->io[0].start & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); b = (c->io[0].start >> 8) & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_1)>>1, 1, &b); } - if (req->Present & PRESENT_IOSIZE) { + if (p_dev->config_regs & PRESENT_IOSIZE) { u8 b = resource_size(&c->io[0]) + resource_size(&c->io[1]) - 1; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOSIZE)>>1, 1, &b); } -- cgit v1.2.3