From fc301101034c06bf56a7f71bf682c48909e401a4 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 29 Jul 2010 16:19:39 +0200 Subject: pcmcia: simplify Status, ExtStatus register access The Status (CISREG_CCSR) and ExtStatus (CISREG_ESR) registers were only accessed to enable audio output for some drivers and IRQ for serial_cs.c. The former also required setting config_req_t.Attributes to CONF_ENABLE_SPKR; the latter can be simplified to setting this field to CONF_ENABLE_ESR. CC: netdev@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: linux-serial@vger.kernel.org CC: linux-scsi@vger.kernel.org Tested-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 2 +- drivers/pcmcia/pcmcia_resource.c | 28 +++++++++++++++++++--------- 2 files changed, 20 insertions(+), 10 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 9487340deaf0..7ef464d40e91 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -36,7 +36,7 @@ typedef struct config_t { unsigned int Attributes; unsigned int IntType; unsigned int ConfigBase; - unsigned char Status, Option, ExtStatus; + unsigned char Option; unsigned int CardValues; struct resource io[MAX_IO_WIN]; /* io ports */ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 28717eea7c57..8834bb415d38 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -441,6 +441,8 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, struct pcmcia_socket *s = p_dev->socket; config_t *c; pccard_io_map iomap; + unsigned char status = 0; + unsigned char ext_status = 0; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -476,12 +478,21 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, s->socket.flags |= SS_ZVCARD | SS_IOCARD; if (req->Attributes & CONF_ENABLE_DMA) s->socket.flags |= SS_DMA_MODE; - if (req->Attributes & CONF_ENABLE_SPKR) + if (req->Attributes & CONF_ENABLE_SPKR) { s->socket.flags |= SS_SPKR_ENA; + status = CCSR_AUDIO_ENA; + if (!(req->Present & PRESENT_STATUS)) + dev_warn(&p_dev->dev, "speaker requested, but " + "PRESENT_STATUS not set!\n"); + } if (req->Attributes & CONF_ENABLE_IRQ) s->socket.io_irq = s->pcmcia_irq; else s->socket.io_irq = 0; + if (req->Attributes & CONF_ENABLE_ESR) { + req->Present |= PRESENT_EXT_STATUS; + ext_status = ESR_REQ_ATTN_ENA; + } s->ops->set_socket(s, &s->socket); s->lock_count++; @@ -513,14 +524,13 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, pcmcia_write_cis_mem(s, 1, (base + CISREG_COR)>>1, 1, &c->Option); mdelay(40); } - if (req->Present & PRESENT_STATUS) { - c->Status = req->Status; - pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &c->Status); - } - if (req->Present & PRESENT_EXT_STATUS) { - c->ExtStatus = req->ExtStatus; - pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, &c->ExtStatus); - } + if (req->Present & PRESENT_STATUS) + pcmcia_write_cis_mem(s, 1, (base + CISREG_CCSR)>>1, 1, &status); + + if (req->Present & PRESENT_EXT_STATUS) + pcmcia_write_cis_mem(s, 1, (base + CISREG_ESR)>>1, 1, + &ext_status); + if (req->Present & PRESENT_IOBASE_0) { u8 b = c->io[0].start & 0xff; pcmcia_write_cis_mem(s, 1, (base + CISREG_IOBASE_0)>>1, 1, &b); -- cgit v1.2.1