]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
pcmcia: simplify Status, ExtStatus register access
authorDominik Brodowski <linux@dominikbrodowski.net>
Thu, 29 Jul 2010 14:19:39 +0000 (16:19 +0200)
committerDominik Brodowski <linux@dominikbrodowski.net>
Wed, 29 Sep 2010 15:20:22 +0000 (17:20 +0200)
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 <w.sang@pengutronix.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
16 files changed:
drivers/isdn/hisax/sedlbauer_cs.c
drivers/net/pcmcia/axnet_cs.c
drivers/net/pcmcia/pcnet_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/wireless/airo_cs.c
drivers/net/wireless/atmel_cs.c
drivers/net/wireless/hostap/hostap_cs.c
drivers/pcmcia/cs_internal.h
drivers/pcmcia/pcmcia_resource.c
drivers/scsi/pcmcia/nsp_cs.c
drivers/serial/serial_cs.c
drivers/staging/comedi/drivers/ni_daq_700.c
drivers/staging/comedi/drivers/ni_daq_dio24.c
drivers/staging/comedi/drivers/ni_labpc_cs.c
include/pcmcia/cs.h

index ad07d61dc09b5dfd097cee20b836d7d00870be3f..40001ad9f6142921ec386e5b8f41f854bd43aa2b 100644 (file)
@@ -175,10 +175,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
index 5f05ffb240cc899eb79537ffe8074ceb97d3da11..8734ed8f174df854e40eeda759e8ef6890cb0021 100644 (file)
@@ -334,10 +334,8 @@ static int axnet_config(struct pcmcia_device *link)
     if (!link->irq)
            goto failed;
     
-    if (resource_size(link->resource[1]) == 8) {
+    if (resource_size(link->resource[1]) == 8)
        link->conf.Attributes |= CONF_ENABLE_SPKR;
-       link->conf.Status = CCSR_AUDIO_ENA;
-    }
     
     ret = pcmcia_request_configuration(link, &link->conf);
     if (ret)
index aa6ee6b264cde0988552b609619e28320f7fae0a..f3d7a149070aef68deff5bbdedd228e8d7cb1403 100644 (file)
@@ -560,10 +560,9 @@ static hw_info_t *pcnet_try_config(struct pcmcia_device *link,
        if (!link->irq)
                return NULL;
 
-       if (resource_size(link->resource[1]) == 8) {
+       if (resource_size(link->resource[1]) == 8)
                link->conf.Attributes |= CONF_ENABLE_SPKR;
-               link->conf.Status = CCSR_AUDIO_ENA;
-       }
+
        if ((link->manf_id == MANFID_IBM) &&
            (link->card_id == PRODID_IBM_HOME_AND_AWAY))
                link->conf.ConfigIndex |= 0x10;
index 395e586d7c0a2963a83b9a5b8312ccd83890c059..2031a27253d1a97985d31df3694e7853bfc4929a 100644 (file)
@@ -446,7 +446,6 @@ static int mhz_mfc_config(struct pcmcia_device *link)
     int i;
 
     link->conf.Attributes |= CONF_ENABLE_SPKR;
-    link->conf.Status = CCSR_AUDIO_ENA;
     link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
     link->resource[1]->end = 8;
 
@@ -640,7 +639,6 @@ static int osi_config(struct pcmcia_device *link)
     int i, j;
 
     link->conf.Attributes |= CONF_ENABLE_SPKR;
-    link->conf.Status = CCSR_AUDIO_ENA;
     link->resource[0]->end = 64;
     link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
     link->resource[1]->end = 8;
index 4308bda0e96de9c9400b811d9482156943f37513..59398a6f134419ac7f9dbf26a1d9394ae9c93f5e 100644 (file)
@@ -812,10 +812,9 @@ xirc2ps_config(struct pcmcia_device * link)
     if (local->modem) {
        int pass;
 
-       if (do_sound) {
+       if (do_sound)
            link->conf.Attributes |= CONF_ENABLE_SPKR;
-           link->conf.Status |= CCSR_AUDIO_ENA;
-       }
+
        link->resource[1]->end = 8;
        link->resource[1]->flags |= IO_DATA_PATH_WIDTH_8;
        if (local->dingo) {
index 488e7b45d54b2145461ee9cbaa503741226180cc..ab60f1084716b7755700327cee6ee87ce83fe41b 100644 (file)
@@ -158,10 +158,8 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
index 479f5084bac13b783acd3e79b720a8c2c2b2387d..d6d585cb992ac4397133d7c5da3056ced192161a 100644 (file)
@@ -175,10 +175,8 @@ static int atmel_config_check(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
index 3f35dd4438ca6ddc1acd57303bdc3c5e992c5625..3fa285b1bdd3bde141fd9901d0f90e49e6119a58 100644 (file)
@@ -484,10 +484,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev,
               "(default 0x%02X)\n", cfg->index, dflt->index);
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
index 9487340deaf00b03d4e474f2ad0a6772f78d72f2..7ef464d40e91607d72e009bb22185587f8a4ab41 100644 (file)
@@ -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 */
index 28717eea7c574e8830af10d219e166d0a5f4d0cf..8834bb415d38d8851db7e480ba1b331b1eb26ece 100644 (file)
@@ -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);
index 50574e86941832bc1a9387d06907a9dca47c0397..b90cade36746dcf4367796673af1338746725e00 100644 (file)
@@ -1608,10 +1608,8 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Use power settings for Vcc and Vpp if present */
        /*  Note that the CIS values need to be rescaled */
index 9597442a0ac1e5059fe3982f62afe1c1299b5633..0460c0882b70e3fd6816891705269ae4bbef140a 100644 (file)
@@ -183,10 +183,8 @@ static void quirk_config_socket(struct pcmcia_device *link)
 {
        struct serial_info *info = link->priv;
 
-       if (info->multi) {
-               link->conf.Present |= PRESENT_EXT_STATUS;
-               link->conf.ExtStatus = ESR_REQ_ATTN_ENA;
-       }
+       if (info->multi)
+               link->conf.Attributes |= CONF_ENABLE_ESR;
 }
 
 static const struct serial_quirk quirks[] = {
@@ -336,10 +334,9 @@ static int serial_probe(struct pcmcia_device *link)
        link->priv = info;
 
        link->conf.Attributes = CONF_ENABLE_IRQ;
-       if (do_sound) {
+       if (do_sound)
                link->conf.Attributes |= CONF_ENABLE_SPKR;
-               link->conf.Status = CCSR_AUDIO_ENA;
-       }
+
        link->conf.IntType = INT_MEMORY_AND_IO;
 
        return serial_config(link);
index cc15666e5cc195391d5fd5093dc90f4c30169943..8cf56cb0a3ff7c856f387d0910968afe52c4df9a 100644 (file)
@@ -550,10 +550,8 @@ static int dio700_pcmcia_config_loop(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Do we need to allocate an interrupt? */
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
index 773ae2044e0ee8a52435f14879563dd37597d6f4..ba693435963e5173479f076549d3f9fbe8f6a954 100644 (file)
@@ -302,10 +302,8 @@ static int dio24_pcmcia_config_loop(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Do we need to allocate an interrupt? */
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ;
index 68c4ecbd93ae83728c422f00da13e273a13d63a1..5d5f11f2b5c39c917ad4c206cb3f9b8777635607 100644 (file)
@@ -281,10 +281,8 @@ static int labpc_pcmcia_config_loop(struct pcmcia_device *p_dev,
                return -ENODEV;
 
        /* Does this card need audio output? */
-       if (cfg->flags & CISTPL_CFTABLE_AUDIO) {
+       if (cfg->flags & CISTPL_CFTABLE_AUDIO)
                p_dev->conf.Attributes |= CONF_ENABLE_SPKR;
-               p_dev->conf.Status = CCSR_AUDIO_ENA;
-       }
 
        /* Do we need to allocate an interrupt? */
        p_dev->conf.Attributes |= CONF_ENABLE_IRQ | CONF_ENABLE_PULSE_IRQ;
index e656abee1741e8c181f27e1fc977648b5134530d..29d693f72ba95f3b279303ed2065f27ea537a1c0 100644 (file)
@@ -24,7 +24,6 @@ typedef struct config_req_t {
     u_int      Attributes;
     u_int      IntType;
     u_int      ConfigBase;
-    u_char     Status, ExtStatus;
     u_char     ConfigIndex;
     u_int      Present;
 } config_req_t;
@@ -34,6 +33,7 @@ typedef struct config_req_t {
 #define CONF_ENABLE_DMA                0x02
 #define CONF_ENABLE_SPKR       0x04
 #define CONF_ENABLE_PULSE_IRQ  0x08
+#define CONF_ENABLE_ESR                0x10
 #define CONF_VALID_CLIENT      0x100
 
 /* IntType field */