From 53efec9513cfb1acff602c7ebdd945d677808e9e Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 28 Jul 2008 19:44:05 +0200 Subject: pcmcia: only copy CIS override data once Instead of copying CIS override data in socket_sysfs.c or ds.c, and then again in cistpl.c, only do so once. Also, cisdump_t is now only used by the deprecated ioctl. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 18 +++++++++--------- drivers/pcmcia/ds.c | 12 +----------- drivers/pcmcia/pcmcia_ioctl.c | 2 +- drivers/pcmcia/socket_sysfs.c | 13 ++----------- 4 files changed, 13 insertions(+), 32 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 65129b54eb09..11c473c865a5 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -265,13 +265,13 @@ EXPORT_SYMBOL(pcmcia_write_cis_mem); ======================================================================*/ static void read_cis_cache(struct pcmcia_socket *s, int attr, u_int addr, - u_int len, void *ptr) + size_t len, void *ptr) { struct cis_cache_entry *cis; int ret; if (s->fake_cis) { - if (s->fake_cis_len > addr+len) + if (s->fake_cis_len >= addr+len) memcpy(ptr, s->fake_cis+addr, len); else memset(ptr, 0xff, len); @@ -380,17 +380,17 @@ int verify_cis_cache(struct pcmcia_socket *s) ======================================================================*/ -int pcmcia_replace_cis(struct pcmcia_socket *s, cisdump_t *cis) +int pcmcia_replace_cis(struct pcmcia_socket *s, + const u8 *data, const size_t len) { - kfree(s->fake_cis); - s->fake_cis = NULL; - if (cis->Length > CISTPL_MAX_CIS_SIZE) + if (len > CISTPL_MAX_CIS_SIZE) return CS_BAD_SIZE; - s->fake_cis = kmalloc(cis->Length, GFP_KERNEL); + kfree(s->fake_cis); + s->fake_cis = kmalloc(len, GFP_KERNEL); if (s->fake_cis == NULL) return CS_OUT_OF_RESOURCE; - s->fake_cis_len = cis->Length; - memcpy(s->fake_cis, cis->Data, cis->Length); + s->fake_cis_len = len; + memcpy(s->fake_cis, data, len); return CS_SUCCESS; } EXPORT_SYMBOL(pcmcia_replace_cis); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4174d9656e35..2382341975e5 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -854,7 +854,6 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) int ret = -ENOMEM; int no_funcs; int old_funcs; - cisdump_t *cis; cistpl_longlink_mfc_t mfc; if (!filename) @@ -877,16 +876,7 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) goto release; } - cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); - if (!cis) { - ret = -ENOMEM; - goto release; - } - - cis->Length = fw->size + 1; - memcpy(cis->Data, fw->data, fw->size); - - if (!pcmcia_replace_cis(s, cis)) + if (!pcmcia_replace_cis(s, fw->data, fw->size)) ret = 0; else { printk(KERN_ERR "pcmcia: CIS override failed\n"); diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 419f97fc9a62..6c086ffea448 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -867,7 +867,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, &buf->win_info.map); break; case DS_REPLACE_CIS: - ret = pcmcia_replace_cis(s, &buf->cisdump); + ret = pcmcia_replace_cis(s, buf->cisdump.Data, buf->cisdump.Length); break; case DS_BIND_REQUEST: if (!capable(CAP_SYS_ADMIN)) { diff --git a/drivers/pcmcia/socket_sysfs.c b/drivers/pcmcia/socket_sysfs.c index 006a29e91d83..ff9a3bb3c88d 100644 --- a/drivers/pcmcia/socket_sysfs.c +++ b/drivers/pcmcia/socket_sysfs.c @@ -316,27 +316,18 @@ static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count) { struct pcmcia_socket *s = to_socket(container_of(kobj, struct device, kobj)); - cisdump_t *cis; int error; if (off) return -EINVAL; - if (count >= 0x200) + if (count >= CISTPL_MAX_CIS_SIZE) return -EINVAL; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; - cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL); - if (!cis) - return -ENOMEM; - - cis->Length = count + 1; - memcpy(cis->Data, buf, count); - - error = pcmcia_replace_cis(s, cis); - kfree(cis); + error = pcmcia_replace_cis(s, buf, count); if (error) return -EIO; -- cgit v1.2.3 From a804b574e6c7236222593046fc2b1b8bd0298fce Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Tue, 29 Jul 2008 08:38:30 +0200 Subject: pcmcia: add pcmcia_loop_config() helper By calling pcmcia_loop_config(), a pcmcia driver can iterate over all available configuration options. During a driver's probe() phase, one doesn't need to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and pcmcia_parse_tuple directly in most if not all cases. Signed-off-by: Dominik Brodowski --- Documentation/pcmcia/driver-changes.txt | 6 ++++ drivers/pcmcia/pcmcia_resource.c | 62 +++++++++++++++++++++++++++++++++ include/pcmcia/cistpl.h | 6 ++++ 3 files changed, 74 insertions(+) (limited to 'drivers/pcmcia') diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index 96f155e68750..059934363caf 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt @@ -1,5 +1,11 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: +* New configuration loop helper (as of 2.6.28) + By calling pcmcia_loop_config(), a driver can iterate over all available + configuration options. During a driver's probe() phase, one doesn't need + to use pcmcia_get_{first,next}_tuple, pcmcia_get_tuple_data and + pcmcia_parse_tuple directly in most if not all cases. + * New release helper (as of 2.6.17) Instead of calling pcmcia_release_{configuration,io,irq,win}, all that's necessary now is calling pcmcia_disable_device. As there is no valid diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 4884a18cf9e6..9f054bc847f2 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -909,3 +909,65 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) { pcmcia_release_window(p_dev->win); } EXPORT_SYMBOL(pcmcia_disable_device); + + +struct pcmcia_cfg_mem { + tuple_t tuple; + cisparse_t parse; + u8 buf[256]; +}; + +/** + * pcmcia_loop_config() - loop over configuration options + * @p_dev: the struct pcmcia_device which we need to loop for. + * @conf_check: function to call for each configuration option. + * It gets passed the struct pcmcia_device, the CIS data + * describing the configuration option, and private data + * being passed to pcmcia_loop_config() + * @priv_data: private data to be passed to the conf_check function. + * + * pcmcia_loop_config() loops over all configuration options, and calls + * the driver-specific conf_check() for each one, checking whether + * it is a valid one. + */ +int pcmcia_loop_config(struct pcmcia_device *p_dev, + int (*conf_check) (struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cfg, + void *priv_data), + void *priv_data) +{ + struct pcmcia_cfg_mem *cfg_mem; + tuple_t *tuple; + int ret = -ENODEV; + + cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); + if (cfg_mem == NULL) + return -ENOMEM; + + tuple = &cfg_mem->tuple; + tuple->TupleData = cfg_mem->buf; + tuple->TupleDataMax = 255; + tuple->TupleOffset = 0; + tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; + tuple->Attributes = 0; + + ret = pcmcia_get_first_tuple(p_dev, tuple); + while (!ret) { + if (pcmcia_get_tuple_data(p_dev, tuple)) + goto next_entry; + + if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse)) + goto next_entry; + + ret = conf_check(p_dev, &cfg_mem->parse.cftable_entry, + priv_data); + if (!ret) + break; + +next_entry: + ret = pcmcia_get_next_tuple(p_dev, tuple); + } + + return ret; +} +EXPORT_SYMBOL(pcmcia_loop_config); diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index e2e10c1e9a06..b2eb914a18df 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -613,4 +613,10 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned #define pcmcia_validate_cis(p_dev, info) \ pccard_validate_cis(p_dev->socket, p_dev->func, info) +int pcmcia_loop_config(struct pcmcia_device *p_dev, + int (*conf_check) (struct pcmcia_device *p_dev, + cistpl_cftable_entry_t *cf, + void *priv_data), + void *priv_data); + #endif /* LINUX_CISTPL_H */ -- cgit v1.2.3 From 498ac1899b62626bf6879a251d75c22ec564c559 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 14:59:13 +0200 Subject: pcmcia: pcmcia_config_loop() ConfigIndex unification Almost all drivers set p_dev->conf.ConfigIndex to cfg->index in the pcmcia_config_loop() callback function. Therefore, factor it out. Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 1 - drivers/bluetooth/bt3c_cs.c | 2 -- drivers/bluetooth/btuart_cs.c | 2 -- drivers/bluetooth/dtl1_cs.c | 1 - drivers/char/pcmcia/cm4000_cs.c | 2 -- drivers/char/pcmcia/cm4040_cs.c | 2 -- drivers/isdn/hardware/avm/avm_cs.c | 1 - drivers/isdn/hisax/avma1_cs.c | 1 - drivers/isdn/hisax/elsa_cs.c | 2 -- drivers/isdn/hisax/sedlbauer_cs.c | 1 - drivers/isdn/hisax/teles_cs.c | 2 -- drivers/net/pcmcia/pcnet_cs.c | 2 -- drivers/net/pcmcia/smc91c92_cs.c | 2 -- drivers/net/pcmcia/xirc2ps_cs.c | 2 -- drivers/net/wireless/airo_cs.c | 2 -- drivers/net/wireless/atmel_cs.c | 2 -- drivers/net/wireless/hostap/hostap_cs.c | 1 - drivers/net/wireless/orinoco_cs.c | 1 - drivers/net/wireless/spectrum_cs.c | 1 - drivers/parport/parport_cs.c | 1 - drivers/pcmcia/pcmcia_resource.c | 8 ++++++-- drivers/scsi/pcmcia/aha152x_stub.c | 1 - drivers/scsi/pcmcia/fdomain_stub.c | 1 - drivers/scsi/pcmcia/nsp_cs.c | 2 -- drivers/scsi/pcmcia/qlogic_stub.c | 1 - drivers/scsi/pcmcia/sym53c500_cs.c | 1 - drivers/serial/serial_cs.c | 4 ---- drivers/telephony/ixj_pcmcia.c | 1 - drivers/usb/host/sl811_cs.c | 2 -- 29 files changed, 6 insertions(+), 46 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 8cccd1b81ee2..4b8bd2021a9c 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -181,7 +181,6 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io; - pdev->conf.ConfigIndex = cfg->index; pdev->io.BasePort1 = io->win[0].base; pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; if (!(io->flags & CISTPL_IO_16BIT)) diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 6ec366f1cf74..3436be152485 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -688,7 +688,6 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; @@ -706,7 +705,6 @@ static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, int j; if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - p_dev->conf.ConfigIndex = cf->index; for (j = 0; j < 5; j++) { p_dev->io.BasePort1 = base[j]; p_dev->io.IOAddrLines = base[j] ? 16 : 3; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 39cca285152d..5e31ea2f2d6f 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -617,7 +617,6 @@ static int btuart_check_config(struct pcmcia_device *p_dev, p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.IOAddrLines = (try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; @@ -635,7 +634,6 @@ static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, int j; if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - p_dev->conf.ConfigIndex = cf->index; for (j = 0; j < 5; j++) { p_dev->io.BasePort1 = base[j]; p_dev->io.IOAddrLines = base[j] ? 16 : 3; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index e30a6332c6c6..1846e2aa9d4a 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -595,7 +595,6 @@ static int dtl1_confcheck(struct pcmcia_device *p_dev, void *priv_data) { if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.NumPorts1 = cf->io.win[0].len; /*yo */ p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 47adec480bd1..7eafd2f4dbb9 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1763,8 +1763,6 @@ static int cm4000_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, void *priv_data) { - p_dev->conf.ConfigIndex = cfg->index; - if (!cfg->io.nwin) return -ENODEV; diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index e0f5d8c9b266..71ca8c474c89 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -531,8 +531,6 @@ static int cm4040_config_check(struct pcmcia_device *p_dev, void *priv_data) { int rc; - p_dev->conf.ConfigIndex = cfg->index; - if (!cfg->io.nwin) return -ENODEV; diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 7a1ead117d11..3569c68dc942 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -161,7 +161,6 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev, if (cf->io.nwin <= 0) return -ENODEV; - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.NumPorts1 = cf->io.win[0].len; p_dev->io.NumPorts2 = 0; diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 8142d9fc8147..76164d6a3c89 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -181,7 +181,6 @@ static int avma1cs_configcheck(struct pcmcia_device *p_dev, if (cf->io.nwin <= 0) return -ENODEV; - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.NumPorts1 = cf->io.win[0].len; p_dev->io.NumPorts2 = 0; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 449800898dcf..c9899e51a262 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -212,13 +212,11 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev, if ((cf->io.nwin > 0) && cf->io.win[0].base) { printk(KERN_INFO "(elsa_cs: looks like the 96 model)\n"); - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; if (!pcmcia_request_io(p_dev, &p_dev->io)) return 0; } else { printk(KERN_INFO "(elsa_cs: looks like the 97 model)\n"); - p_dev->conf.ConfigIndex = cf->index; for (j = 0x2f0; j > 0x100; j -= 0x10) { p_dev->io.BasePort1 = j; if (!pcmcia_request_io(p_dev, &p_dev->io)) diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 0f80b5667ea1..2c611f91cfba 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -233,7 +233,6 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, cfg_mem->dflt = *cfg; if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 2b063a2916f4..ecb75ae8a399 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -202,13 +202,11 @@ static int teles_cs_configcheck(struct pcmcia_device *p_dev, if ((cf->io.nwin > 0) && cf->io.win[0].base) { printk(KERN_INFO "(teles_cs: looks like the 96 model)\n"); - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; if (!pcmcia_request_io(p_dev, &p_dev->io)) return 0; } else { printk(KERN_INFO "(teles_cs: looks like the 97 model)\n"); - p_dev->conf.ConfigIndex = cf->index; for (j = 0x2f0; j > 0x100; j -= 0x10) { p_dev->io.BasePort1 = j; if (!pcmcia_request_io(p_dev, &p_dev->io)) diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 7a9eeca6adc2..a60608722495 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -523,8 +523,6 @@ static int pcnet_confcheck(struct pcmcia_device *p_dev, if (cfg->index == 0 || cfg->io.nwin == 0) return -EINVAL; - p_dev->conf.ConfigIndex = cfg->index; - /* For multifunction cards, by convention, we configure the network function with window 0, and serial with window 1 */ if (io->nwin > 1) { diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index c012e3400736..1e595038a492 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -464,7 +464,6 @@ static int mhz_mfc_config_check(struct pcmcia_device *p_dev, void *priv_data) { int k; - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort2 = cf->io.win[0].base; for (k = 0; k < 0x400; k += 0x10) { if (k & 0x80) @@ -654,7 +653,6 @@ static int smc_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, void *priv_data) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; return pcmcia_request_io(p_dev, &p_dev->io); diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index b57f022952b4..b0de704f229c 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -724,7 +724,6 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev, if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { for (ioaddr = 0x300; ioaddr < 0x400; ioaddr += 0x10) { - p_dev->conf.ConfigIndex = cf->index ; p_dev->io.BasePort2 = cf->io.win[0].base; p_dev->io.BasePort1 = ioaddr; if (!pcmcia_request_io(p_dev, &p_dev->io)) @@ -742,7 +741,6 @@ xirc2ps_config_check(struct pcmcia_device *p_dev, int *pass = priv_data; if (cf->io.nwin > 0 && (cf->io.win[0].base & 0xf) == 8) { - p_dev->conf.ConfigIndex = cf->index ; p_dev->io.BasePort2 = cf->io.win[0].base; p_dev->io.BasePort1 = p_dev->io.BasePort2 + (*pass ? (cf->index & 0x20 ? -24:8) diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 4fbe811bebfc..d7216730f18e 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -223,8 +223,6 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; - /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { p_dev->conf.Attributes |= CONF_ENABLE_SPKR; diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 263c36f7ee22..12efd44d64a1 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -234,8 +234,6 @@ static int atmel_config_check(struct pcmcia_device *p_dev, *dflt = *cfg; if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; - /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { p_dev->conf.Attributes |= CONF_ENABLE_SPKR; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 3d914dde5de0..2abaa90b799d 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -552,7 +552,6 @@ static int prism2_config_check(struct pcmcia_device *p_dev, if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index); diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 473370c9e0d6..67a172dfb2db 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -179,7 +179,6 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, cfg_mem->dflt = *cfg; if (cfg->index == 0) goto next_entry; - p_dev->conf.ConfigIndex = cfg->index; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 8e1951cfc152..7536aa91dad7 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c @@ -648,7 +648,6 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, cfg_mem->dflt = *cfg; if (cfg->index == 0) goto next_entry; - p_dev->conf.ConfigIndex = cfg->index; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 636231739f4b..814c5252d703 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -156,7 +156,6 @@ static int parport_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *dflt = priv_data; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->conf.ConfigIndex = cfg->index; if (epp_mode) p_dev->conf.ConfigIndex |= FORCE_EPP_MODE; p_dev->io.BasePort1 = io->win[0].base; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 9f054bc847f2..ba34ac8876ff 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -953,14 +953,18 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, ret = pcmcia_get_first_tuple(p_dev, tuple); while (!ret) { + cistpl_cftable_entry_t *cfg = &cfg_mem->parse.cftable_entry; + if (pcmcia_get_tuple_data(p_dev, tuple)) goto next_entry; if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse)) goto next_entry; - ret = conf_check(p_dev, &cfg_mem->parse.cftable_entry, - priv_data); + /* default values */ + p_dev->conf.ConfigIndex = cfg->index; + + ret = conf_check(p_dev, cfg, priv_data); if (!ret) break; diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index bbcc20f2d9d0..5e4d8e42ba0b 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -152,7 +152,6 @@ static int aha152x_config_check(struct pcmcia_device *p_dev, p_dev->io.BasePort1 = cfg->io.win[1].base; if ((cfg->io.nwin > 0) && (p_dev->io.BasePort1 < 0xffff)) { - p_dev->conf.ConfigIndex = cfg->index; if (!pcmcia_request_io(p_dev, &p_dev->io)) return 0; } diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index fefef7d81f14..e3d6937c9200 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -127,7 +127,6 @@ static int fdomain_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, void *priv_data) { - p_dev->conf.ConfigIndex = cfg->index; p_dev->io.BasePort1 = cfg->io.win[0].base; return pcmcia_request_io(p_dev, &p_dev->io); } diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index a29a6f29c977..aee24b745dc9 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1626,8 +1626,6 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; - /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { p_dev->conf.Attributes |= CONF_ENABLE_SPKR; diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index aa9b9e0968b6..a361275b20a3 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -199,7 +199,6 @@ static int qlogic_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, void *priv_data) { - p_dev->conf.ConfigIndex = cfg->index; p_dev->io.BasePort1 = cfg->io.win[0].base; p_dev->io.NumPorts1 = cfg->io.win[0].len; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 15369d9e3121..23a5219051a9 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -704,7 +704,6 @@ static int SYM53C500_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, void *priv_data) { - p_dev->conf.ConfigIndex = cfg->index; p_dev->io.BasePort1 = cfg->io.win[0].base; p_dev->io.NumPorts1 = cfg->io.win[0].len; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index ac60cd288418..693738160010 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -454,7 +454,6 @@ static int simple_config_check(struct pcmcia_device *p_dev, if ((cf->io.nwin > 0) && (cf->io.win[0].len == size_table[(*try >> 1)]) && (cf->io.win[0].base != 0)) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.IOAddrLines = ((*try & 0x1) == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; @@ -472,7 +471,6 @@ static int simple_config_check_notpicky(struct pcmcia_device *p_dev, int j; if ((cf->io.nwin > 0) && ((cf->io.flags & CISTPL_IO_LINES_MASK) <= 3)) { - p_dev->conf.ConfigIndex = cf->index; for (j = 0; j < 5; j++) { p_dev->io.BasePort1 = base[j]; p_dev->io.IOAddrLines = base[j] ? 16 : 3; @@ -555,7 +553,6 @@ static int multi_config_check(struct pcmcia_device *p_dev, /* The quad port cards have bad CIS's, so just look for a window larger than 8 ports and assume it will be right */ if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; if (!pcmcia_request_io(p_dev, &p_dev->io)) { @@ -573,7 +570,6 @@ static int multi_config_check_notpicky(struct pcmcia_device *p_dev, int *base2 = priv_data; if (cf->io.nwin == 2) { - p_dev->conf.ConfigIndex = cf->index; p_dev->io.BasePort1 = cf->io.win[0].base; p_dev->io.BasePort2 = cf->io.win[1].base; p_dev->io.IOAddrLines = cf->io.flags & CISTPL_IO_LINES_MASK; diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index 89c5e40ce3a0..ba2c7a2125a0 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -132,7 +132,6 @@ static int ixj_config_check(struct pcmcia_device *p_dev, if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; - p_dev->conf.ConfigIndex = cfg->index; p_dev->io.BasePort1 = io->win[0].base; p_dev->io.NumPorts1 = io->win[0].len; if (io->nwin == 2) { diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 9773601bf0bb..5b55c72c710b 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -172,8 +172,6 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, if (cfg->index == 0) return -ENODEV; - p_dev->conf.ConfigIndex = cfg->index; - /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1< --- drivers/ata/pata_pcmcia.c | 33 ++++++++++----------- drivers/bluetooth/bt3c_cs.c | 2 ++ drivers/bluetooth/btuart_cs.c | 2 ++ drivers/bluetooth/dtl1_cs.c | 1 + drivers/char/pcmcia/cm4000_cs.c | 1 + drivers/char/pcmcia/cm4040_cs.c | 1 + drivers/ide/legacy/ide-cs.c | 33 ++++++++++----------- drivers/isdn/hardware/avm/avm_cs.c | 1 + drivers/isdn/hisax/avma1_cs.c | 5 ++-- drivers/isdn/hisax/elsa_cs.c | 1 + drivers/isdn/hisax/sedlbauer_cs.c | 26 ++++++++--------- drivers/isdn/hisax/teles_cs.c | 1 + drivers/net/pcmcia/axnet_cs.c | 1 + drivers/net/pcmcia/pcnet_cs.c | 1 + drivers/net/pcmcia/smc91c92_cs.c | 2 ++ drivers/net/pcmcia/xirc2ps_cs.c | 2 ++ drivers/net/wireless/airo_cs.c | 51 ++++++++++++++------------------- drivers/net/wireless/atmel_cs.c | 9 ++---- drivers/net/wireless/hostap/hostap_cs.c | 24 +++++++--------- drivers/net/wireless/orinoco_cs.c | 18 ++++++------ drivers/net/wireless/spectrum_cs.c | 18 ++++++------ drivers/parport/parport_cs.c | 12 ++------ drivers/pcmcia/pcmcia_resource.c | 7 ++++- drivers/scsi/pcmcia/aha152x_stub.c | 5 ++-- drivers/scsi/pcmcia/fdomain_stub.c | 5 ++-- drivers/scsi/pcmcia/nsp_cs.c | 23 +++++++-------- drivers/scsi/pcmcia/qlogic_stub.c | 5 ++-- drivers/scsi/pcmcia/sym53c500_cs.c | 1 + drivers/serial/serial_cs.c | 4 +++ drivers/telephony/ixj_pcmcia.c | 8 ++---- drivers/usb/host/sl811_cs.c | 19 ++++++------ include/pcmcia/cistpl.h | 1 + 32 files changed, 158 insertions(+), 165 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 4b8bd2021a9c..20982065a494 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -151,7 +151,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) struct pcmcia_config_check { config_info_t conf; - cistpl_cftable_entry_t dflt; unsigned long ctl_base; int skip_vcc; int is_kme; @@ -159,6 +158,7 @@ struct pcmcia_config_check { static int pcmcia_check_one_config(struct pcmcia_device *pdev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct pcmcia_config_check *stk = priv_data; @@ -166,21 +166,23 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, /* Check for matching Vcc, unless we're desperate */ if (!stk->skip_vcc) { if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) - goto next_entry; - } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) - goto next_entry; + if (stk->conf.Vcc != + cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (stk->conf.Vcc != + dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; } } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) + pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; pdev->io.BasePort1 = io->win[0].base; pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; if (!(io->flags & CISTPL_IO_16BIT)) @@ -190,23 +192,19 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, pdev->io.BasePort2 = io->win[1].base; pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; if (pcmcia_request_io(pdev, &pdev->io) != 0) - goto next_entry; + return -ENODEV; stk->ctl_base = pdev->io.BasePort2; } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { pdev->io.NumPorts1 = io->win[0].len; pdev->io.NumPorts2 = 0; if (pcmcia_request_io(pdev, &pdev->io) != 0) - goto next_entry; + return -ENODEV; stk->ctl_base = pdev->io.BasePort1 + 0x0e; } else - goto next_entry; + return -ENODEV; /* If we've got this far, we're done */ return 0; } -next_entry: - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); - return -ENODEV; } @@ -264,7 +262,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); stk->skip_vcc = io_base = ctl_base = 0; if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { - memset(&stk->dflt, 0, sizeof(stk->dflt)); stk->skip_vcc = 1; if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) goto failed; /* No suitable config found */ diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 3436be152485..794a5ef9ea22 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -680,6 +680,7 @@ static void bt3c_detach(struct pcmcia_device *link) static int bt3c_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { unsigned long try = (unsigned long) priv_data; @@ -699,6 +700,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 5e31ea2f2d6f..32017f96067c 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -609,6 +609,7 @@ static void btuart_detach(struct pcmcia_device *link) static int btuart_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { unsigned long try = (unsigned long) priv_data; @@ -628,6 +629,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev, static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 1846e2aa9d4a..1830ebd6ca7b 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -592,6 +592,7 @@ static void dtl1_detach(struct pcmcia_device *link) static int dtl1_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 7eafd2f4dbb9..7785fbb4c0f6 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1761,6 +1761,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link) static int cm4000_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { if (!cfg->io.nwin) diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 71ca8c474c89..468ddef916b3 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -528,6 +528,7 @@ static void cm4040_reader_release(struct pcmcia_device *link) static int cm4040_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { int rc; diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 8580becf226a..cc8eeaf80275 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -222,7 +222,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) struct pcmcia_config_check { config_info_t conf; - cistpl_cftable_entry_t dflt; unsigned long ctl_base; int skip_vcc; int is_kme; @@ -230,6 +229,7 @@ struct pcmcia_config_check { static int pcmcia_check_one_config(struct pcmcia_device *pdev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct pcmcia_config_check *stk = priv_data; @@ -237,21 +237,23 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, /* Check for matching Vcc, unless we're desperate */ if (!stk->skip_vcc) { if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) - goto next_entry; - } else if (stk->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != stk->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) - goto next_entry; + if (stk->conf.Vcc != + cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (stk->conf.Vcc != + dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) + return -ENODEV; } } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) pdev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (stk->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) - pdev->conf.Vpp = stk->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) + pdev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; - if ((cfg->io.nwin > 0) || (stk->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &stk->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; pdev->conf.ConfigIndex = cfg->index; pdev->io.BasePort1 = io->win[0].base; pdev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; @@ -262,23 +264,19 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, pdev->io.BasePort2 = io->win[1].base; pdev->io.NumPorts2 = (stk->is_kme) ? 2 : 1; if (pcmcia_request_io(pdev, &pdev->io) != 0) - goto next_entry; + return -ENODEV; stk->ctl_base = pdev->io.BasePort2; } else if ((io->nwin == 1) && (io->win[0].len >= 16)) { pdev->io.NumPorts1 = io->win[0].len; pdev->io.NumPorts2 = 0; if (pcmcia_request_io(pdev, &pdev->io) != 0) - goto next_entry; + return -ENODEV; stk->ctl_base = pdev->io.BasePort1 + 0x0e; } else - goto next_entry; + return -ENODEV; /* If we've got this far, we're done */ return 0; } -next_entry: - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - memcpy(&stk->dflt, cfg, sizeof(stk->dflt)); - return -ENODEV; } @@ -305,7 +303,6 @@ static int ide_config(struct pcmcia_device *link) CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); stk->skip_vcc = io_base = ctl_base = 0; if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { - memset(&stk->dflt, 0, sizeof(stk->dflt)); stk->skip_vcc = 1; if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) goto failed; /* No suitable config found */ diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 3569c68dc942..a8d6949338cd 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -156,6 +156,7 @@ static void avmcs_detach(struct pcmcia_device *link) static int avmcs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { if (cf->io.nwin <= 0) diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 76164d6a3c89..7ce1aabb0aeb 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -175,8 +175,9 @@ static void avma1cs_detach(struct pcmcia_device *link) ======================================================================*/ static int avma1cs_configcheck(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cf, - void *priv_data) + cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, + void *priv_data) { if (cf->io.nwin <= 0) return -ENODEV; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index c9899e51a262..29c55b0b86b4 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -206,6 +206,7 @@ static void elsa_cs_detach(struct pcmcia_device *link) static int elsa_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int j; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 2c611f91cfba..2746acbd8b70 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -218,19 +218,17 @@ static void sedlbauer_detach(struct pcmcia_device *link) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) struct sedlbauer_config_data { - cistpl_cftable_entry_t dflt; config_info_t conf; win_req_t req; }; static int sedlbauer_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct sedlbauer_config_data *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; if (cfg->index == 0) return -ENODEV; @@ -243,26 +241,28 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1<conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) + if (cfg_mem->conf.Vcc != + cfg->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; - } else if (cfg_mem->dflt.vcc.present & (1<conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) + } else if (dflt->vcc.present & (1<conf.Vcc != + dflt->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; } if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (cfg_mem->dflt.vpp1.present & (1<conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; + else if (dflt->vpp1.present & (1<conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; /* Do we need to allocate an interrupt? */ - if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) + if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; if (!(io->flags & CISTPL_IO_8BIT)) p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; @@ -291,8 +291,8 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, needs to be mapped to virtual space with ioremap() before it is used. */ - if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { - cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; + if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { + cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; memreq_t map; cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; cfg_mem->req.Attributes |= WIN_ENABLE; diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index ecb75ae8a399..f4f2e2231a9b 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -196,6 +196,7 @@ static void teles_detach(struct pcmcia_device *link) static int teles_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int j; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 04ece0b77d1d..c99dc5d54d19 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -286,6 +286,7 @@ static int try_io_port(struct pcmcia_device *link) static int axnet_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { int i; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index a60608722495..10fc537804b0 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -514,6 +514,7 @@ static int try_io_port(struct pcmcia_device *link) static int pcnet_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { int *has_shmem = priv_data; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 1e595038a492..05bca83c5e27 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -461,6 +461,7 @@ static int mhz_3288_power(struct pcmcia_device *link) static int mhz_mfc_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int k; @@ -651,6 +652,7 @@ static int mot_setup(struct pcmcia_device *link) static int smc_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { p_dev->io.BasePort1 = cf->io.win[0].base; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index b0de704f229c..a16efa49b855 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -718,6 +718,7 @@ has_ce2_string(struct pcmcia_device * p_dev) static int xirc2ps_config_modem(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { unsigned int ioaddr; @@ -736,6 +737,7 @@ xirc2ps_config_modem(struct pcmcia_device *p_dev, static int xirc2ps_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int *pass = priv_data; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index d7216730f18e..657adf85ab77 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -206,19 +206,12 @@ static void airo_detach(struct pcmcia_device *link) #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) -struct airo_cs_config_data { - cistpl_cftable_entry_t dflt; - win_req_t req; -}; - static int airo_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { - struct airo_cs_config_data *cfg_mem = priv_data; - - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; + win_req_t *req = priv_data; if (cfg->index == 0) return -ENODEV; @@ -233,17 +226,17 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, /* Note that the CIS values need to be rescaled */ if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (cfg_mem->dflt.vpp1.present & (1<conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; + else if (dflt->vpp1.present & (1<conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; /* Do we need to allocate an interrupt? */ - if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) + if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; if (!(io->flags & CISTPL_IO_8BIT)) p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; @@ -273,14 +266,14 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, needs to be mapped to virtual space with ioremap() before it is used. */ - if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { - cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; + if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { + cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; memreq_t map; - cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; - cfg_mem->req.Base = mem->win[0].host_addr; - cfg_mem->req.Size = mem->win[0].len; - cfg_mem->req.AccessSpeed = 0; - if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) + req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; + req->Base = mem->win[0].host_addr; + req->Size = mem->win[0].len; + req->AccessSpeed = 0; + if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) return -ENODEV; map.Page = 0; map.CardOffset = mem->win[0].card_addr; @@ -295,15 +288,15 @@ static int airo_cs_config_check(struct pcmcia_device *p_dev, static int airo_config(struct pcmcia_device *link) { local_info_t *dev; - struct airo_cs_config_data *cfg_mem; + win_req_t *req; int last_fn, last_ret; dev = link->priv; DEBUG(0, "airo_config(0x%p)\n", link); - cfg_mem = kzalloc(sizeof(struct airo_cs_config_data), GFP_KERNEL); - if (!cfg_mem) + req = kzalloc(sizeof(win_req_t), GFP_KERNEL); + if (!req) return -ENOMEM; /* @@ -320,7 +313,7 @@ static int airo_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - last_ret = pcmcia_loop_config(link, airo_cs_config_check, cfg_mem); + last_ret = pcmcia_loop_config(link, airo_cs_config_check, req); if (last_ret) goto failed; @@ -365,17 +358,17 @@ static int airo_config(struct pcmcia_device *link) printk(" & 0x%04x-0x%04x", link->io.BasePort2, link->io.BasePort2+link->io.NumPorts2-1); if (link->win) - printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, - cfg_mem->req.Base+cfg_mem->req.Size-1); + printk(", mem 0x%06lx-0x%06lx", req->Base, + req->Base+req->Size-1); printk("\n"); - kfree(cfg_mem); + kfree(req); return 0; cs_failed: cs_error(link, last_fn, last_ret); failed: airo_release(link); - kfree(cfg_mem); + kfree(req); return -ENODEV; } /* airo_config */ diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index 12efd44d64a1..c71aae992ecc 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -226,14 +226,12 @@ static int card_present(void *arg) static int atmel_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { - cistpl_cftable_entry_t *dflt = priv_data; - - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - *dflt = *cfg; if (cfg->index == 0) return -ENODEV; + /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { p_dev->conf.Attributes |= CONF_ENABLE_SPKR; @@ -278,7 +276,6 @@ static int atmel_config(struct pcmcia_device *link) local_info_t *dev; int last_fn, last_ret; struct pcmcia_device_id *did; - cistpl_cftable_entry_t dflt = { 0 }; dev = link->priv; did = handle_to_dev(link).driver_data; @@ -297,7 +294,7 @@ static int atmel_config(struct pcmcia_device *link) these things without consulting the CIS, and most client drivers will only use the CIS to fill in implementation-defined details. */ - if (pcmcia_loop_config(link, atmel_config_check, &dflt)) + if (pcmcia_loop_config(link, atmel_config_check, NULL)) goto failed; /* diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 2abaa90b799d..f9595ca71a06 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -537,23 +537,21 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) * socket and make the device available to the system */ struct prism2_config_data { - cistpl_cftable_entry_t dflt; config_info_t conf; }; static int prism2_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct prism2_config_data *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; if (cfg->index == 0) return -ENODEV; PDEBUG(DEBUG_EXTRA, "Checking CFTABLE_ENTRY 0x%02X " - "(default 0x%02X)\n", cfg->index, cfg_mem->dflt.index); + "(default 0x%02X)\n", cfg->index, dflt->index); /* Does this card need audio output? */ if (cfg->flags & CISTPL_CFTABLE_AUDIO) { @@ -570,8 +568,8 @@ static int prism2_config_check(struct pcmcia_device *p_dev, " this entry\n"); return -ENODEV; } - } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000 && !ignore_cis_vcc) { PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " "- skipping this entry\n"); @@ -581,11 +579,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev, if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) - p_dev->conf.Vpp = cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) + p_dev->conf.Vpp = dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ - if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) + if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; else if (!(p_dev->conf.Attributes & CONF_ENABLE_IRQ)) { /* At least Compaq WL200 does not have IRQInfo1 set, @@ -597,11 +595,11 @@ static int prism2_config_check(struct pcmcia_device *p_dev, /* IO window settings */ PDEBUG(DEBUG_EXTRA, "IO window settings: cfg->io.nwin=%d " - "cfg_mem->dflt.io.nwin=%d\n", - cfg->io.nwin, cfg_mem->dflt.io.nwin); + "dflt->io.nwin=%d\n", + cfg->io.nwin, dflt->io.nwin); p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; PDEBUG(DEBUG_EXTRA, "io->flags = 0x%04X, " "io.base=0x%04x, len=%d\n", io->flags, diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 67a172dfb2db..8a367f96db37 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -165,18 +165,16 @@ static void orinoco_cs_detach(struct pcmcia_device *link) } while (0) struct orinoco_cs_config_data { - cistpl_cftable_entry_t dflt; config_info_t conf; }; static int orinoco_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct orinoco_cs_config_data *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; if (cfg->index == 0) goto next_entry; @@ -188,9 +186,9 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, if (!ignore_cis_vcc) goto next_entry; } - } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } @@ -199,17 +197,17 @@ static int orinoco_cs_config_check(struct pcmcia_device *p_dev, if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = - cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; if (!(io->flags & CISTPL_IO_8BIT)) p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index 7536aa91dad7..e28878dfaba3 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c @@ -634,18 +634,16 @@ static void spectrum_cs_detach(struct pcmcia_device *link) */ struct spectrum_cs_config_data { - cistpl_cftable_entry_t dflt; config_info_t conf; }; static int spectrum_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct spectrum_cs_config_data *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - cfg_mem->dflt = *cfg; if (cfg->index == 0) goto next_entry; @@ -657,9 +655,9 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, if (!ignore_cis_vcc) goto next_entry; } - } else if (cfg_mem->dflt.vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM] / 10000); + } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { + if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } @@ -668,17 +666,17 @@ static int spectrum_cs_config_check(struct pcmcia_device *p_dev, if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) + else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = - cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; /* Do we need to allocate an interrupt? */ p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; if (!(io->flags & CISTPL_IO_8BIT)) p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 814c5252d703..05f34e73694b 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -151,9 +151,9 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int parport_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { - cistpl_cftable_entry_t *dflt = priv_data; if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; if (epp_mode) @@ -166,26 +166,20 @@ static int parport_config_check(struct pcmcia_device *p_dev, p_dev->io.NumPorts2 = io->win[1].len; } if (pcmcia_request_io(p_dev, &p_dev->io) != 0) - goto next_entry; + return -ENODEV; return 0; } - -next_entry: - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - *dflt = *cfg; - return -ENODEV; } static int parport_config(struct pcmcia_device *link) { parport_info_t *info = link->priv; - cistpl_cftable_entry_t dflt = { 0 }; struct parport *p; int last_ret, last_fn; DEBUG(0, "parport_config(0x%p)\n", link); - last_ret = pcmcia_loop_config(link, parport_config_check, &dflt); + last_ret = pcmcia_loop_config(link, parport_config_check, NULL); if (last_ret) { cs_error(link, RequestIO, last_ret); goto failed; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index ba34ac8876ff..5ddfd46dea65 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -915,6 +915,7 @@ struct pcmcia_cfg_mem { tuple_t tuple; cisparse_t parse; u8 buf[256]; + cistpl_cftable_entry_t dflt; }; /** @@ -933,10 +934,12 @@ struct pcmcia_cfg_mem { int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data), void *priv_data) { struct pcmcia_cfg_mem *cfg_mem; + tuple_t *tuple; int ret = -ENODEV; @@ -963,8 +966,10 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, /* default values */ p_dev->conf.ConfigIndex = cfg->index; + if (cfg->flags & CISTPL_CFTABLE_DEFAULT) + cfg_mem->dflt = *cfg; - ret = conf_check(p_dev, cfg, priv_data); + ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data); if (!ret) break; diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 5e4d8e42ba0b..2ed3077b826a 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -141,8 +141,9 @@ static void aha152x_detach(struct pcmcia_device *link) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int aha152x_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - void *priv_data) + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + void *priv_data) { /* For New Media T&J, look for a SCSI window */ if (cfg->io.win[0].len >= 0x20) diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index e3d6937c9200..2b6e92d7be07 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -124,8 +124,9 @@ static void fdomain_detach(struct pcmcia_device *link) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int fdomain_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - void *priv_data) + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; return pcmcia_request_io(p_dev, &p_dev->io); diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index aee24b745dc9..aa4523462578 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1612,17 +1612,15 @@ struct nsp_cs_configdata { nsp_hw_data *data; win_req_t req; config_info_t conf; - cistpl_cftable_entry_t dflt; }; static int nsp_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct nsp_cs_configdata *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t)); if (cfg->index == 0) return -ENODEV; @@ -1637,28 +1635,27 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, if (cfg->vcc.present & (1<conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; - else if (cfg_mem->dflt.vcc.present & (1<conf.Vcc != cfg_mem->dflt.vcc.param[CISTPL_POWER_VNOM]/10000) + else if (dflt->vcc.present & (1<conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; } if (cfg->vpp1.present & (1 << CISTPL_POWER_VNOM)) { p_dev->conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM] / 10000; - } else if (cfg_mem->dflt.vpp1.present & (1 << CISTPL_POWER_VNOM)) { + } else if (dflt->vpp1.present & (1 << CISTPL_POWER_VNOM)) { p_dev->conf.Vpp = - cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM] / 10000; + dflt->vpp1.param[CISTPL_POWER_VNOM] / 10000; } /* Do we need to allocate an interrupt? */ - if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) { + if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; - } /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_AUTO; if (!(io->flags & CISTPL_IO_8BIT)) p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_16; @@ -1677,10 +1674,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, goto next_entry; } - if ((cfg->mem.nwin > 0) || (cfg_mem->dflt.mem.nwin > 0)) { + if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { memreq_t map; cistpl_mem_t *mem = - (cfg->mem.nwin) ? &cfg->mem : &cfg_mem->dflt.mem; + (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; cfg_mem->req.Attributes |= WIN_ENABLE; cfg_mem->req.Base = mem->win[0].host_addr; diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index a361275b20a3..da6b3603198b 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -196,8 +196,9 @@ static void qlogic_detach(struct pcmcia_device *link) do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int qlogic_config_check(struct pcmcia_device *p_dev, - cistpl_cftable_entry_t *cfg, - void *priv_data) + cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, + void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; p_dev->io.NumPorts1 = cfg->io.win[0].len; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index 23a5219051a9..eba193134dfa 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -702,6 +702,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int SYM53C500_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 693738160010..f8658686439d 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -443,6 +443,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { static const int size_table[2] = { 8, 16 }; @@ -465,6 +466,7 @@ static int simple_config_check(struct pcmcia_device *p_dev, static int simple_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; @@ -546,6 +548,7 @@ found_port: static int multi_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int *base2 = priv_data; @@ -565,6 +568,7 @@ static int multi_config_check(struct pcmcia_device *p_dev, static int multi_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data) { int *base2 = priv_data; diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index ba2c7a2125a0..b41df211b786 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -126,10 +126,9 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) static int ixj_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { - cistpl_cftable_entry_t *dflt = priv_data; - if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.BasePort1 = io->win[0].base; @@ -138,10 +137,7 @@ static int ixj_config_check(struct pcmcia_device *p_dev, p_dev->io.BasePort2 = io->win[1].base; p_dev->io.NumPorts2 = io->win[1].len; } - if (pcmcia_request_io(p_dev, &p_dev->io)) { - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - *dflt = *cfg; - } else + if (!pcmcia_request_io(p_dev, &p_dev->io)) return 0; } return -ENODEV; diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 5b55c72c710b..78cc32e7b014 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -156,19 +156,16 @@ static void sl811_cs_release(struct pcmcia_device * link) } struct sl811_css_cfg { - cistpl_cftable_entry_t dflt; config_info_t conf; }; static int sl811_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, + cistpl_cftable_entry_t *dflt, void *priv_data) { struct sl811_css_cfg *cfg_mem = priv_data; - if (cfg->flags & CISTPL_CFTABLE_DEFAULT) - memcpy(&cfg_mem->dflt, cfg, sizeof(cistpl_cftable_entry_t)); - if (cfg->index == 0) return -ENODEV; @@ -178,8 +175,8 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != cfg_mem->conf.Vcc) return -ENODEV; - } else if (cfg_mem->dflt.vcc.present & (1<dflt.vcc.param[CISTPL_POWER_VNOM]/10000 + } else if (dflt->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000 != cfg_mem->conf.Vcc) return -ENODEV; } @@ -187,18 +184,18 @@ static int sl811_cs_config_check(struct pcmcia_device *p_dev, if (cfg->vpp1.present & (1<conf.Vpp = cfg->vpp1.param[CISTPL_POWER_VNOM]/10000; - else if (cfg_mem->dflt.vpp1.present & (1<vpp1.present & (1<conf.Vpp = - cfg_mem->dflt.vpp1.param[CISTPL_POWER_VNOM]/10000; + dflt->vpp1.param[CISTPL_POWER_VNOM]/10000; /* we need an interrupt */ - if (cfg->irq.IRQInfo1 || cfg_mem->dflt.irq.IRQInfo1) + if (cfg->irq.IRQInfo1 || dflt->irq.IRQInfo1) p_dev->conf.Attributes |= CONF_ENABLE_IRQ; /* IO window settings */ p_dev->io.NumPorts1 = p_dev->io.NumPorts2 = 0; - if ((cfg->io.nwin > 0) || (cfg_mem->dflt.io.nwin > 0)) { - cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &cfg_mem->dflt.io; + if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { + cistpl_io_t *io = (cfg->io.nwin) ? &cfg->io : &dflt->io; p_dev->io.Attributes1 = IO_DATA_PATH_WIDTH_8; p_dev->io.IOAddrLines = io->flags & CISTPL_IO_LINES_MASK; diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index b2eb914a18df..0aa702705d00 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -616,6 +616,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, + cistpl_cftable_entry_t *dflt, void *priv_data), void *priv_data); -- cgit v1.2.3 From ad913c11928f51abb6174f165db8d8d205b22e21 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 16:12:00 +0200 Subject: pcmcia: pcmcia_config_loop() improvement by passing vcc By passing the current Vcc setting to the pcmcia_config_loop callback function, we can remove pcmcia_get_configuration_info() calls from many drivers. Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 12 ++++------ drivers/bluetooth/bt3c_cs.c | 2 ++ drivers/bluetooth/btuart_cs.c | 11 +++++---- drivers/bluetooth/dtl1_cs.c | 1 + drivers/char/pcmcia/cm4000_cs.c | 1 + drivers/char/pcmcia/cm4040_cs.c | 1 + drivers/ide/legacy/ide-cs.c | 12 ++++------ drivers/isdn/hardware/avm/avm_cs.c | 1 + drivers/isdn/hisax/avma1_cs.c | 1 + drivers/isdn/hisax/elsa_cs.c | 1 + drivers/isdn/hisax/sedlbauer_cs.c | 42 +++++++++++++-------------------- drivers/isdn/hisax/teles_cs.c | 1 + drivers/net/pcmcia/axnet_cs.c | 1 + drivers/net/pcmcia/pcnet_cs.c | 1 + drivers/net/pcmcia/smc91c92_cs.c | 2 ++ drivers/net/pcmcia/xirc2ps_cs.c | 2 ++ drivers/net/wireless/airo_cs.c | 1 + drivers/net/wireless/atmel_cs.c | 1 + drivers/net/wireless/hostap/hostap_cs.c | 23 ++++-------------- drivers/net/wireless/orinoco_cs.c | 28 +++++----------------- drivers/net/wireless/spectrum_cs.c | 28 +++++----------------- drivers/parport/parport_cs.c | 2 ++ drivers/pcmcia/pcmcia_resource.c | 7 +++++- drivers/scsi/pcmcia/aha152x_stub.c | 1 + drivers/scsi/pcmcia/fdomain_stub.c | 1 + drivers/scsi/pcmcia/nsp_cs.c | 8 +++---- drivers/scsi/pcmcia/qlogic_stub.c | 1 + drivers/scsi/pcmcia/sym53c500_cs.c | 1 + drivers/serial/serial_cs.c | 4 ++++ drivers/telephony/ixj_pcmcia.c | 1 + drivers/usb/host/sl811_cs.c | 35 +++++++-------------------- include/pcmcia/cistpl.h | 1 + 32 files changed, 93 insertions(+), 142 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index 20982065a494..6e4d31d8d14e 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -150,7 +150,6 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) struct pcmcia_config_check { - config_info_t conf; unsigned long ctl_base; int skip_vcc; int is_kme; @@ -159,6 +158,7 @@ struct pcmcia_config_check { static int pcmcia_check_one_config(struct pcmcia_device *pdev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { struct pcmcia_config_check *stk = priv_data; @@ -166,12 +166,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, /* Check for matching Vcc, unless we're desperate */ if (!stk->skip_vcc) { if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) return -ENODEV; } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != - dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) return -ENODEV; } } @@ -257,10 +255,8 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) if (!stk) goto out1; stk->is_kme = is_kme; - - /* Not sure if this is right... look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(pdev, &stk->conf)); stk->skip_vcc = io_base = ctl_base = 0; + if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) { stk->skip_vcc = 1; if (pcmcia_loop_config(pdev, pcmcia_check_one_config, stk)) diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 794a5ef9ea22..3fd8022a6351 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -681,6 +681,7 @@ static void bt3c_detach(struct pcmcia_device *link) static int bt3c_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { unsigned long try = (unsigned long) priv_data; @@ -701,6 +702,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev, static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 32017f96067c..17183125434f 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -610,16 +610,17 @@ static void btuart_detach(struct pcmcia_device *link) static int btuart_check_config(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - unsigned long try = (unsigned long) priv_data; + int *try = priv_data; if (cf->vpp1.present & (1 << CISTPL_POWER_VNOM)) p_dev->conf.Vpp = cf->vpp1.param[CISTPL_POWER_VNOM] / 10000; if ((cf->io.nwin > 0) && (cf->io.win[0].len == 8) && (cf->io.win[0].base != 0)) { p_dev->io.BasePort1 = cf->io.win[0].base; - p_dev->io.IOAddrLines = (try == 0) ? 16 : + p_dev->io.IOAddrLines = (*try == 0) ? 16 : cf->io.flags & CISTPL_IO_LINES_MASK; if (!pcmcia_request_io(p_dev, &p_dev->io)) return 0; @@ -630,6 +631,7 @@ static int btuart_check_config(struct pcmcia_device *p_dev, static int btuart_check_config_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; @@ -650,13 +652,12 @@ static int btuart_config(struct pcmcia_device *link) { btuart_info_t *info = link->priv; int i; - unsigned long try; + int try; /* First pass: look for a config entry that looks normal. Two tries: without IO aliases, then with aliases */ for (try = 0; try < 2; try++) - if (!pcmcia_loop_config(link, btuart_check_config, - (void *) try)) + if (!pcmcia_loop_config(link, btuart_check_config, &try)) goto found_port; /* Second pass: try to find an entry that isn't picky about diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index 1830ebd6ca7b..ec12560e0342 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -593,6 +593,7 @@ static void dtl1_detach(struct pcmcia_device *link) static int dtl1_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if ((cf->io.nwin == 1) && (cf->io.win[0].len > 8)) { diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index 7785fbb4c0f6..1c5bf99895ed 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -1762,6 +1762,7 @@ static void cmm_cm4000_release(struct pcmcia_device * link) static int cm4000_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if (!cfg->io.nwin) diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index 468ddef916b3..e047bac56f0e 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -529,6 +529,7 @@ static void cm4040_reader_release(struct pcmcia_device *link) static int cm4040_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int rc; diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index cc8eeaf80275..6472cd8231f7 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c @@ -221,7 +221,6 @@ out_release: do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) struct pcmcia_config_check { - config_info_t conf; unsigned long ctl_base; int skip_vcc; int is_kme; @@ -230,6 +229,7 @@ struct pcmcia_config_check { static int pcmcia_check_one_config(struct pcmcia_device *pdev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { struct pcmcia_config_check *stk = priv_data; @@ -237,12 +237,10 @@ static int pcmcia_check_one_config(struct pcmcia_device *pdev, /* Check for matching Vcc, unless we're desperate */ if (!stk->skip_vcc) { if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != - cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) return -ENODEV; } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (stk->conf.Vcc != - dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) return -ENODEV; } } @@ -298,10 +296,8 @@ static int ide_config(struct pcmcia_device *link) if (!stk) goto err_mem; stk->is_kme = is_kme; - - /* Not sure if this is right... look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &stk->conf)); stk->skip_vcc = io_base = ctl_base = 0; + if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) { stk->skip_vcc = 1; if (pcmcia_loop_config(link, pcmcia_check_one_config, stk)) diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index a8d6949338cd..388046539705 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -157,6 +157,7 @@ static void avmcs_detach(struct pcmcia_device *link) static int avmcs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if (cf->io.nwin <= 0) diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 7ce1aabb0aeb..8fd3ca0fb93a 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -177,6 +177,7 @@ static void avma1cs_detach(struct pcmcia_device *link) static int avma1cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if (cf->io.nwin <= 0) diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 29c55b0b86b4..2bf0016dea5e 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -207,6 +207,7 @@ static void elsa_cs_detach(struct pcmcia_device *link) static int elsa_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int j; diff --git a/drivers/isdn/hisax/sedlbauer_cs.c b/drivers/isdn/hisax/sedlbauer_cs.c index 2746acbd8b70..9a3c9f5e4fe8 100644 --- a/drivers/isdn/hisax/sedlbauer_cs.c +++ b/drivers/isdn/hisax/sedlbauer_cs.c @@ -217,17 +217,13 @@ static void sedlbauer_detach(struct pcmcia_device *link) #define CS_CHECK(fn, ret) \ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) -struct sedlbauer_config_data { - config_info_t conf; - win_req_t req; -}; - static int sedlbauer_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - struct sedlbauer_config_data *cfg_mem = priv_data; + win_req_t *req = priv_data; if (cfg->index == 0) return -ENODEV; @@ -241,12 +237,10 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1<conf.Vcc != - cfg->vcc.param[CISTPL_POWER_VNOM]/10000) + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; } else if (dflt->vcc.present & (1<conf.Vcc != - dflt->vcc.param[CISTPL_POWER_VNOM]/10000) + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; } @@ -294,12 +288,12 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, if ((cfg->mem.nwin > 0) || (dflt->mem.nwin > 0)) { cistpl_mem_t *mem = (cfg->mem.nwin) ? &cfg->mem : &dflt->mem; memreq_t map; - cfg_mem->req.Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; - cfg_mem->req.Attributes |= WIN_ENABLE; - cfg_mem->req.Base = mem->win[0].host_addr; - cfg_mem->req.Size = mem->win[0].len; - cfg_mem->req.AccessSpeed = 0; - if (pcmcia_request_window(&p_dev, &cfg_mem->req, &p_dev->win) != 0) + req->Attributes = WIN_DATA_WIDTH_16|WIN_MEMORY_TYPE_CM; + req->Attributes |= WIN_ENABLE; + req->Base = mem->win[0].host_addr; + req->Size = mem->win[0].len; + req->AccessSpeed = 0; + if (pcmcia_request_window(&p_dev, req, &p_dev->win) != 0) return -ENODEV; map.Page = 0; map.CardOffset = mem->win[0].card_addr; @@ -314,20 +308,16 @@ static int sedlbauer_config_check(struct pcmcia_device *p_dev, static int sedlbauer_config(struct pcmcia_device *link) { local_info_t *dev = link->priv; - struct sedlbauer_config_data *cfg_mem; + win_req_t *req; int last_fn, last_ret; IsdnCard_t icard; DEBUG(0, "sedlbauer_config(0x%p)\n", link); - cfg_mem = kzalloc(sizeof(struct sedlbauer_config_data), GFP_KERNEL); - if (!cfg_mem) + req = kzalloc(sizeof(win_req_t), GFP_KERNEL); + if (!req) return -ENOMEM; - /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, - pcmcia_get_configuration_info(link, &cfg_mem->conf)); - /* In this loop, we scan the CIS for configuration table entries, each of which describes a valid card configuration, including @@ -340,7 +330,7 @@ static int sedlbauer_config(struct pcmcia_device *link) these things without consulting the CIS, and most client drivers will only use the CIS to fill in implementation-defined details. */ - last_ret = pcmcia_loop_config(link, sedlbauer_config_check, cfg_mem); + last_ret = pcmcia_loop_config(link, sedlbauer_config_check, req); if (last_ret) goto failed; @@ -381,8 +371,8 @@ static int sedlbauer_config(struct pcmcia_device *link) printk(" & 0x%04x-0x%04x", link->io.BasePort2, link->io.BasePort2+link->io.NumPorts2-1); if (link->win) - printk(", mem 0x%06lx-0x%06lx", cfg_mem->req.Base, - cfg_mem->req.Base+cfg_mem->req.Size-1); + printk(", mem 0x%06lx-0x%06lx", req->Base, + req->Base+req->Size-1); printk("\n"); icard.para[0] = link->irq.AssignedIRQ; diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index f4f2e2231a9b..21cabd0aadbe 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -197,6 +197,7 @@ static void teles_detach(struct pcmcia_device *link) static int teles_cs_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int j; diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index c99dc5d54d19..061d889794c5 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -287,6 +287,7 @@ static int try_io_port(struct pcmcia_device *link) static int axnet_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int i; diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index 10fc537804b0..aa17434faa0e 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -515,6 +515,7 @@ static int try_io_port(struct pcmcia_device *link) static int pcnet_confcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int *has_shmem = priv_data; diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 05bca83c5e27..b3f2085ddca9 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -462,6 +462,7 @@ static int mhz_3288_power(struct pcmcia_device *link) static int mhz_mfc_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int k; @@ -653,6 +654,7 @@ static int mot_setup(struct pcmcia_device *link) static int smc_configcheck(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { p_dev->io.BasePort1 = cf->io.win[0].base; diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index a16efa49b855..d97e6e917c3c 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -719,6 +719,7 @@ static int xirc2ps_config_modem(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { unsigned int ioaddr; @@ -738,6 +739,7 @@ static int xirc2ps_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int *pass = priv_data; diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index 657adf85ab77..fac1526e49aa 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -209,6 +209,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int airo_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { win_req_t *req = priv_data; diff --git a/drivers/net/wireless/atmel_cs.c b/drivers/net/wireless/atmel_cs.c index c71aae992ecc..4830d51900a3 100644 --- a/drivers/net/wireless/atmel_cs.c +++ b/drivers/net/wireless/atmel_cs.c @@ -227,6 +227,7 @@ static int card_present(void *arg) static int atmel_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if (cfg->index == 0) diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index f9595ca71a06..c768d42d5177 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -536,17 +536,12 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) /* run after a CARD_INSERTION event is received to configure the PCMCIA * socket and make the device available to the system */ -struct prism2_config_data { - config_info_t conf; -}; - static int prism2_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - struct prism2_config_data *cfg_mem = priv_data; - if (cfg->index == 0) return -ENODEV; @@ -562,14 +557,14 @@ static int prism2_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000 && !ignore_cis_vcc) { PDEBUG(DEBUG_EXTRA, " Vcc mismatch - skipping" " this entry\n"); return -ENODEV; } } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000 && !ignore_cis_vcc) { PDEBUG(DEBUG_EXTRA, " Vcc (default) mismatch " "- skipping this entry\n"); @@ -627,7 +622,6 @@ static int prism2_config(struct pcmcia_device *link) { struct net_device *dev; struct hostap_interface *iface; - struct prism2_config_data *cfg_mem; local_info_t *local; int ret = 1; int last_fn, last_ret; @@ -635,21 +629,14 @@ static int prism2_config(struct pcmcia_device *link) PDEBUG(DEBUG_FLOW, "prism2_config()\n"); - cfg_mem = kzalloc(sizeof(struct prism2_config_data), GFP_KERNEL); - if (!cfg_mem) - return -ENOMEM; - hw_priv = kzalloc(sizeof(*hw_priv), GFP_KERNEL); if (hw_priv == NULL) { ret = -ENOMEM; goto failed; } - CS_CHECK(GetConfigurationInfo, - pcmcia_get_configuration_info(link, &cfg_mem->conf)); - /* Look for an appropriate configuration table entry in the CIS */ - last_ret = pcmcia_loop_config(link, prism2_config_check, cfg_mem); + last_ret = pcmcia_loop_config(link, prism2_config_check, NULL); if (last_ret) { if (!ignore_cis_vcc) printk(KERN_ERR "GetNextTuple(): No matching " @@ -724,7 +711,6 @@ static int prism2_config(struct pcmcia_device *link) if (ret == 0 && local->ddev) strcpy(hw_priv->node.dev_name, local->ddev->name); } - kfree(cfg_mem); return ret; cs_failed: @@ -732,7 +718,6 @@ static int prism2_config(struct pcmcia_device *link) failed: kfree(hw_priv); - kfree(cfg_mem); prism2_release((u_long)link); return ret; } diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index 8a367f96db37..c7b57d9d499d 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -164,31 +164,26 @@ static void orinoco_cs_detach(struct pcmcia_device *link) last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; \ } while (0) -struct orinoco_cs_config_data { - config_info_t conf; -}; - static int orinoco_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - struct orinoco_cs_config_data *cfg_mem = priv_data; - if (cfg->index == 0) goto next_entry; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } @@ -236,7 +231,6 @@ next_entry: static int orinoco_cs_config(struct pcmcia_device *link) { - struct orinoco_cs_config_data *cfg_mem; struct net_device *dev = link->priv; struct orinoco_private *priv = netdev_priv(dev); struct orinoco_pccard *card = priv->card; @@ -244,14 +238,6 @@ orinoco_cs_config(struct pcmcia_device *link) int last_fn, last_ret; void __iomem *mem; - cfg_mem = kzalloc(sizeof(struct orinoco_cs_config_data), GFP_KERNEL); - if (!cfg_mem) - return -ENOMEM; - - /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, - pcmcia_get_configuration_info(link, &cfg_mem->conf)); - /* * In this loop, we scan the CIS for configuration table * entries, each of which describes a valid card @@ -266,7 +252,7 @@ orinoco_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, cfg_mem); + last_ret = pcmcia_loop_config(link, orinoco_cs_config_check, NULL); if (last_ret) { if (!ignore_cis_vcc) printk(KERN_ERR PFX "GetNextTuple(): No matching " @@ -324,7 +310,6 @@ orinoco_cs_config(struct pcmcia_device *link) "0x%04x-0x%04x\n", dev->name, dev->dev.parent->bus_id, link->irq.AssignedIRQ, link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); - kfree(cfg_mem); return 0; cs_failed: @@ -332,7 +317,6 @@ orinoco_cs_config(struct pcmcia_device *link) failed: orinoco_cs_release(link); - kfree(cfg_mem); return -ENODEV; } /* orinoco_cs_config */ diff --git a/drivers/net/wireless/spectrum_cs.c b/drivers/net/wireless/spectrum_cs.c index e28878dfaba3..d7e9d9c3042c 100644 --- a/drivers/net/wireless/spectrum_cs.c +++ b/drivers/net/wireless/spectrum_cs.c @@ -633,31 +633,26 @@ static void spectrum_cs_detach(struct pcmcia_device *link) * device available to the system. */ -struct spectrum_cs_config_data { - config_info_t conf; -}; - static int spectrum_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - struct spectrum_cs_config_data *cfg_mem = priv_data; - if (cfg->index == 0) goto next_entry; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, cfg->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } } else if (dflt->vcc.present & (1 << CISTPL_POWER_VNOM)) { - if (cfg_mem->conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { - DEBUG(2, "spectrum_cs_config: Vcc mismatch (cfg_mem->conf.Vcc = %d, CIS = %d)\n", cfg_mem->conf.Vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM] / 10000) { + DEBUG(2, "spectrum_cs_config: Vcc mismatch (vcc = %d, CIS = %d)\n", vcc, dflt->vcc.param[CISTPL_POWER_VNOM] / 10000); if (!ignore_cis_vcc) goto next_entry; } @@ -705,7 +700,6 @@ next_entry: static int spectrum_cs_config(struct pcmcia_device *link) { - struct spectrum_cs_config_data *cfg_mem; struct net_device *dev = link->priv; struct orinoco_private *priv = netdev_priv(dev); struct orinoco_pccard *card = priv->card; @@ -713,14 +707,6 @@ spectrum_cs_config(struct pcmcia_device *link) int last_fn, last_ret; void __iomem *mem; - cfg_mem = kzalloc(sizeof(struct spectrum_cs_config_data), GFP_KERNEL); - if (!cfg_mem) - return -ENOMEM; - - /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, - pcmcia_get_configuration_info(link, &cfg_mem->conf)); - /* * In this loop, we scan the CIS for configuration table * entries, each of which describes a valid card @@ -735,7 +721,7 @@ spectrum_cs_config(struct pcmcia_device *link) * and most client drivers will only use the CIS to fill in * implementation-defined details. */ - last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, cfg_mem); + last_ret = pcmcia_loop_config(link, spectrum_cs_config_check, NULL); if (last_ret) { if (!ignore_cis_vcc) printk(KERN_ERR PFX "GetNextTuple(): No matching " @@ -799,7 +785,6 @@ spectrum_cs_config(struct pcmcia_device *link) link->irq.AssignedIRQ, link->io.BasePort1, link->io.BasePort1 + link->io.NumPorts1 - 1); - kfree(cfg_mem); return 0; cs_failed: @@ -807,7 +792,6 @@ spectrum_cs_config(struct pcmcia_device *link) failed: spectrum_cs_release(link); - kfree(cfg_mem); return -ENODEV; } /* spectrum_cs_config */ diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 05f34e73694b..b1899e9c1f65 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -152,6 +152,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int parport_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { @@ -169,6 +170,7 @@ static int parport_config_check(struct pcmcia_device *p_dev, return -ENODEV; return 0; } + return -ENODEV; } static int parport_config(struct pcmcia_device *link) diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 5ddfd46dea65..0cf3ef30625e 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -935,6 +935,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data), void *priv_data) { @@ -942,11 +943,15 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, tuple_t *tuple; int ret = -ENODEV; + unsigned int vcc; cfg_mem = kzalloc(sizeof(struct pcmcia_cfg_mem), GFP_KERNEL); if (cfg_mem == NULL) return -ENOMEM; + /* get the current Vcc setting */ + vcc = p_dev->socket->socket.Vcc; + tuple = &cfg_mem->tuple; tuple->TupleData = cfg_mem->buf; tuple->TupleDataMax = 255; @@ -969,7 +974,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, if (cfg->flags & CISTPL_CFTABLE_DEFAULT) cfg_mem->dflt = *cfg; - ret = conf_check(p_dev, cfg, &cfg_mem->dflt, priv_data); + ret = conf_check(p_dev, cfg, &cfg_mem->dflt, vcc, priv_data); if (!ret) break; diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 2ed3077b826a..165ff884f48e 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -143,6 +143,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int aha152x_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { /* For New Media T&J, look for a SCSI window */ diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 2b6e92d7be07..06254f46a0dd 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -126,6 +126,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int fdomain_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index aa4523462578..7c19bf264873 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c @@ -1611,12 +1611,12 @@ static void nsp_cs_detach(struct pcmcia_device *link) struct nsp_cs_configdata { nsp_hw_data *data; win_req_t req; - config_info_t conf; }; static int nsp_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { struct nsp_cs_configdata *cfg_mem = priv_data; @@ -1633,10 +1633,10 @@ static int nsp_cs_config_check(struct pcmcia_device *p_dev, /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1<conf.Vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) + if (vcc != cfg->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; else if (dflt->vcc.present & (1<conf.Vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) + if (vcc != dflt->vcc.param[CISTPL_POWER_VNOM]/10000) return -ENODEV; } @@ -1719,8 +1719,6 @@ static int nsp_cs_config(struct pcmcia_device *link) return -ENOMEM; cfg_mem->data = data; - /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, pcmcia_get_configuration_info(link, &cfg_mem->conf)); ret = pcmcia_loop_config(link, nsp_cs_config_check, cfg_mem); goto cs_failed; diff --git a/drivers/scsi/pcmcia/qlogic_stub.c b/drivers/scsi/pcmcia/qlogic_stub.c index da6b3603198b..20c3e5e6d88a 100644 --- a/drivers/scsi/pcmcia/qlogic_stub.c +++ b/drivers/scsi/pcmcia/qlogic_stub.c @@ -198,6 +198,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int qlogic_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; diff --git a/drivers/scsi/pcmcia/sym53c500_cs.c b/drivers/scsi/pcmcia/sym53c500_cs.c index eba193134dfa..b330c11a1752 100644 --- a/drivers/scsi/pcmcia/sym53c500_cs.c +++ b/drivers/scsi/pcmcia/sym53c500_cs.c @@ -703,6 +703,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) static int SYM53C500_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { p_dev->io.BasePort1 = cfg->io.win[0].base; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index f8658686439d..7e00e672bfe7 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -444,6 +444,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) static int simple_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { static const int size_table[2] = { 8, 16 }; @@ -467,6 +468,7 @@ static int simple_config_check(struct pcmcia_device *p_dev, static int simple_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { static const unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 }; @@ -549,6 +551,7 @@ found_port: static int multi_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int *base2 = priv_data; @@ -569,6 +572,7 @@ static int multi_config_check(struct pcmcia_device *p_dev, static int multi_config_check_notpicky(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { int *base2 = priv_data; diff --git a/drivers/telephony/ixj_pcmcia.c b/drivers/telephony/ixj_pcmcia.c index b41df211b786..347c3ed1d9f1 100644 --- a/drivers/telephony/ixj_pcmcia.c +++ b/drivers/telephony/ixj_pcmcia.c @@ -127,6 +127,7 @@ static void ixj_get_serial(struct pcmcia_device * link, IXJ * j) static int ixj_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { if ((cfg->io.nwin > 0) || (dflt->io.nwin > 0)) { diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index 78cc32e7b014..ca733b7caea4 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -155,29 +155,22 @@ static void sl811_cs_release(struct pcmcia_device * link) platform_device_unregister(&platform_dev); } -struct sl811_css_cfg { - config_info_t conf; -}; - static int sl811_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data) { - struct sl811_css_cfg *cfg_mem = priv_data; - if (cfg->index == 0) return -ENODEV; /* Use power settings for Vcc and Vpp if present */ /* Note that the CIS values need to be rescaled */ if (cfg->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000 != - cfg_mem->conf.Vcc) + if (cfg->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) return -ENODEV; } else if (dflt->vcc.present & (1<vcc.param[CISTPL_POWER_VNOM]/10000 - != cfg_mem->conf.Vcc) + if (dflt->vcc.param[CISTPL_POWER_VNOM]/10000 != vcc) return -ENODEV; } @@ -214,29 +207,20 @@ static int sl811_cs_config(struct pcmcia_device *link) struct device *parent = &handle_to_dev(link); local_info_t *dev = link->priv; int last_fn, last_ret; - struct sl811_css_cfg *cfg_mem; DBG(0, "sl811_cs_config(0x%p)\n", link); - cfg_mem = kzalloc(sizeof(struct sl811_css_cfg), GFP_KERNEL); - if (!cfg_mem) - return -ENOMEM; - - /* Look up the current Vcc */ - CS_CHECK(GetConfigurationInfo, - pcmcia_get_configuration_info(link, &cfg_mem->conf)); - - if (pcmcia_loop_config(link, sl811_cs_config_check, cfg_mem)) - return -ENODEV; + if (pcmcia_loop_config(link, sl811_cs_config_check, NULL)) + goto failed; /* require an IRQ and two registers */ if (!link->io.NumPorts1 || link->io.NumPorts1 < 2) - goto cs_failed; + goto failed; if (link->conf.Attributes & CONF_ENABLE_IRQ) CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); else - goto cs_failed; + goto failed; CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); @@ -257,13 +241,12 @@ static int sl811_cs_config(struct pcmcia_device *link) if (sl811_hc_init(parent, link->io.BasePort1, link->irq.AssignedIRQ) < 0) { cs_failed: - printk("sl811_cs_config failed\n"); cs_error(link, last_fn, last_ret); +failed: + printk(KERN_WARNING "sl811_cs_config failed\n"); sl811_cs_release(link); - kfree(cfg_mem); return -ENODEV; } - kfree(cfg_mem); return 0; } diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 0aa702705d00..0092910a597d 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -617,6 +617,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, cistpl_cftable_entry_t *dflt, + unsigned int vcc, void *priv_data), void *priv_data); -- cgit v1.2.3 From dd797d81d3d7da31a50031f2741b93327ed22260 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 17:54:14 +0200 Subject: pcmcia: use dev_printk and dev_dbg in yenta_socket Signed-off-by: Dominik Brodowski --- drivers/pcmcia/o2micro.h | 10 +++-- drivers/pcmcia/ti113x.h | 78 +++++++++++++++++++++------------------ drivers/pcmcia/yenta_socket.c | 86 +++++++++++++++++++++++-------------------- 3 files changed, 97 insertions(+), 77 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/o2micro.h b/drivers/pcmcia/o2micro.h index a234ce1967a3..5554015a7813 100644 --- a/drivers/pcmcia/o2micro.h +++ b/drivers/pcmcia/o2micro.h @@ -140,7 +140,8 @@ static int o2micro_override(struct yenta_socket *socket) a = config_readb(socket, O2_RESERVED1); b = config_readb(socket, O2_RESERVED2); - printk(KERN_INFO "Yenta O2: res at 0x94/0xD4: %02x/%02x\n", a, b); + dev_printk(KERN_INFO, &socket->dev->dev, + "O2: res at 0x94/0xD4: %02x/%02x\n", a, b); switch (socket->dev->device) { /* @@ -153,7 +154,9 @@ static int o2micro_override(struct yenta_socket *socket) case PCI_DEVICE_ID_O2_6812: case PCI_DEVICE_ID_O2_6832: case PCI_DEVICE_ID_O2_6836: - printk(KERN_INFO "Yenta O2: old bridge, disabling read prefetch/write burst\n"); + dev_printk(KERN_INFO, &socket->dev->dev, + "Yenta O2: old bridge, disabling read " + "prefetch/write burst\n"); config_writeb(socket, O2_RESERVED1, a & ~(O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST)); config_writeb(socket, O2_RESERVED2, @@ -161,7 +164,8 @@ static int o2micro_override(struct yenta_socket *socket) break; default: - printk(KERN_INFO "Yenta O2: enabling read prefetch/write burst\n"); + dev_printk(KERN_INFO , &socket->dev->dev, + "O2: enabling read prefetch/write burst\n"); config_writeb(socket, O2_RESERVED1, a | O2_RES_READ_PREFETCH | O2_RES_WRITE_BURST); config_writeb(socket, O2_RESERVED2, diff --git a/drivers/pcmcia/ti113x.h b/drivers/pcmcia/ti113x.h index 129db7bd06c3..aaa70227bfb0 100644 --- a/drivers/pcmcia/ti113x.h +++ b/drivers/pcmcia/ti113x.h @@ -339,8 +339,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC); devctl = config_readb(socket, TI113X_DEVICE_CONTROL); - printk(KERN_INFO "Yenta TI: socket %s, mfunc 0x%08x, devctl 0x%02x\n", - pci_name(socket->dev), mfunc, devctl); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: mfunc 0x%08x, devctl 0x%02x\n", mfunc, devctl); /* make sure PCI interrupts are enabled before probing */ ti_init(socket); @@ -354,8 +354,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) * We're here which means PCI interrupts are _not_ delivered. try to * find the right setting (all serial or parallel) */ - printk(KERN_INFO "Yenta TI: socket %s probing PCI interrupt failed, trying to fix\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: probing PCI interrupt failed, trying to fix\n"); /* for serial PCI make sure MFUNC3 is set to IRQSER */ if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { @@ -379,8 +379,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) { - printk(KERN_INFO "Yenta TI: socket %s all-serial interrupts ok\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: all-serial interrupts ok\n"); mfunc_old = mfunc; goto out; } @@ -395,8 +395,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) } /* serial PCI interrupts not working fall back to parallel */ - printk(KERN_INFO "Yenta TI: socket %s falling back to parallel PCI interrupts\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: falling back to parallel PCI interrupts\n"); devctl &= ~TI113X_DCR_IMODE_MASK; devctl |= TI113X_DCR_IMODE_SERIAL; /* serial ISA could be right */ config_writeb(socket, TI113X_DEVICE_CONTROL, devctl); @@ -427,8 +427,8 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) { mfunc_old = mfunc; - printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts ok\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: parallel PCI interrupts ok\n"); } else { /* not working, back to old value */ mfunc = mfunc_old; @@ -440,8 +440,9 @@ static void ti12xx_irqroute_func0(struct yenta_socket *socket) out: if (pci_irq_status < 1) { socket->cb_irq = 0; - printk(KERN_INFO "Yenta TI: socket %s no PCI interrupts. Fish. Please report.\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "Yenta TI: no PCI interrupts. Fish. " + "Please report.\n"); } } @@ -513,8 +514,9 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) mfunc = mfunc_old = config_readl(socket, TI122X_MFUNC); devctl = config_readb(socket, TI113X_DEVICE_CONTROL); - printk(KERN_INFO "Yenta TI: socket %s, mfunc 0x%08x, devctl 0x%02x\n", - pci_name(socket->dev), mfunc, devctl); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: mfunc 0x%08x, devctl 0x%02x\n", + mfunc, devctl); /* if IRQs are configured as tied, align irq of func1 with func0 */ sysctl = config_readl(socket, TI113X_SYSTEM_CONTROL); @@ -533,9 +535,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) * We're here which means PCI interrupts are _not_ delivered. try to * find the right setting */ - printk(KERN_INFO "Yenta TI: socket %s probing PCI interrupt failed, trying to fix\n", - pci_name(socket->dev)); - + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: probing PCI interrupt failed, trying to fix\n"); /* if all serial: set INTRTIE, probe again */ if ((devctl & TI113X_DCR_IMODE_MASK) == TI12XX_DCR_IMODE_ALL_SERIAL) { @@ -544,8 +545,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) if (ti12xx_tie_interrupts(socket, &old_irq)) { pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) { - printk(KERN_INFO "Yenta TI: socket %s all-serial interrupts, tied ok\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: all-serial interrupts, tied ok\n"); goto out; } @@ -582,8 +583,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) { - printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts ok\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: parallel PCI interrupts ok\n"); goto out; } @@ -593,13 +594,13 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) if (pci_irq_status == -1) goto out; } - + /* still nothing: set INTRTIE */ if (ti12xx_tie_interrupts(socket, &old_irq)) { pci_irq_status = yenta_probe_cb_irq(socket); if (pci_irq_status == 1) { - printk(KERN_INFO "Yenta TI: socket %s parallel PCI interrupts, tied ok\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: parallel PCI interrupts, tied ok\n"); goto out; } @@ -610,8 +611,8 @@ static void ti12xx_irqroute_func1(struct yenta_socket *socket) out: if (pci_irq_status < 1) { socket->cb_irq = 0; - printk(KERN_INFO "Yenta TI: socket %s no PCI interrupts. Fish. Please report.\n", - pci_name(socket->dev)); + dev_printk(KERN_INFO, &socket->dev->dev, + "TI: no PCI interrupts. Fish. Please report.\n"); } } @@ -815,11 +816,13 @@ static int ti12xx_override(struct yenta_socket *socket) /* make sure that memory burst is active */ val_orig = val = config_readl(socket, TI113X_SYSTEM_CONTROL); if (disable_clkrun && PCI_FUNC(socket->dev->devfn) == 0) { - printk(KERN_INFO "Yenta: Disabling CLKRUN feature\n"); + dev_printk(KERN_INFO, &socket->dev->dev, + "Disabling CLKRUN feature\n"); val |= TI113X_SCR_KEEPCLK; } if (!(val & TI122X_SCR_MRBURSTUP)) { - printk(KERN_INFO "Yenta: Enabling burst memory read transactions\n"); + dev_printk(KERN_INFO, &socket->dev->dev, + "Enabling burst memory read transactions\n"); val |= TI122X_SCR_MRBURSTUP; } if (val_orig != val) @@ -830,10 +833,12 @@ static int ti12xx_override(struct yenta_socket *socket) * CSC interrupts to PCI rather than INTVAL. */ val = config_readb(socket, TI1250_DIAGNOSTIC); - printk(KERN_INFO "Yenta: Using %s to route CSC interrupts to PCI\n", - (val & TI1250_DIAG_PCI_CSC) ? "CSCINT" : "INTVAL"); - printk(KERN_INFO "Yenta: Routing CardBus interrupts to %s\n", - (val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA"); + dev_printk(KERN_INFO, &socket->dev->dev, + "Using %s to route CSC interrupts to PCI\n", + (val & TI1250_DIAG_PCI_CSC) ? "CSCINT" : "INTVAL"); + dev_printk(KERN_INFO, &socket->dev->dev, + "Routing CardBus interrupts to %s\n", + (val & TI1250_DIAG_PCI_IREQ) ? "PCI" : "ISA"); /* do irqrouting, depending on function */ if (PCI_FUNC(socket->dev->devfn) == 0) @@ -858,8 +863,9 @@ static int ti1250_override(struct yenta_socket *socket) diag |= TI1250_DIAG_PCI_CSC | TI1250_DIAG_PCI_IREQ; if (diag != old) { - printk(KERN_INFO "Yenta: adjusting diagnostic: %02x -> %02x\n", - old, diag); + dev_printk(KERN_INFO, &socket->dev->dev, + "adjusting diagnostic: %02x -> %02x\n", + old, diag); config_writeb(socket, TI1250_DIAGNOSTIC, diag); } @@ -924,7 +930,9 @@ static void ene_tune_bridge(struct pcmcia_socket *sock, struct pci_bus *bus) /* default to clear TLTEnable bit, old behaviour */ test_c9 &= ~ENE_TEST_C9_TLTENABLE; - printk(KERN_INFO "yenta EnE: chaning testregister 0xC9, %02x -> %02x\n", old_c9, test_c9); + dev_printk(KERN_INFO, &socket->dev->dev, + "EnE: chaning testregister 0xC9, %02x -> %02x\n", + old_c9, test_c9); config_writeb(socket, ENE_TEST_C9, test_c9); } diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 0ab1fb65cdc3..3ecd7c99d8eb 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c @@ -38,11 +38,7 @@ static int pwr_irqs_off; module_param(pwr_irqs_off, bool, 0644); MODULE_PARM_DESC(pwr_irqs_off, "Force IRQs off during power-on of slot. Use only when seeing IRQ storms!"); -#if 0 -#define debug(x,args...) printk(KERN_DEBUG "%s: " x, __func__ , ##args) -#else -#define debug(x,args...) -#endif +#define debug(x, s, args...) dev_dbg(&s->dev->dev, x, ##args) /* Don't ask.. */ #define to_cycles(ns) ((ns)/120) @@ -69,13 +65,13 @@ MODULE_PARM_DESC (override_bios, "yenta ignore bios resource allocation"); static inline u32 cb_readl(struct yenta_socket *socket, unsigned reg) { u32 val = readl(socket->base + reg); - debug("%p %04x %08x\n", socket, reg, val); + debug("%04x %08x\n", socket, reg, val); return val; } static inline void cb_writel(struct yenta_socket *socket, unsigned reg, u32 val) { - debug("%p %04x %08x\n", socket, reg, val); + debug("%04x %08x\n", socket, reg, val); writel(val, socket->base + reg); readl(socket->base + reg); /* avoid problems with PCI write posting */ } @@ -84,7 +80,7 @@ static inline u8 config_readb(struct yenta_socket *socket, unsigned offset) { u8 val; pci_read_config_byte(socket->dev, offset, &val); - debug("%p %04x %02x\n", socket, offset, val); + debug("%04x %02x\n", socket, offset, val); return val; } @@ -92,7 +88,7 @@ static inline u16 config_readw(struct yenta_socket *socket, unsigned offset) { u16 val; pci_read_config_word(socket->dev, offset, &val); - debug("%p %04x %04x\n", socket, offset, val); + debug("%04x %04x\n", socket, offset, val); return val; } @@ -100,32 +96,32 @@ static inline u32 config_readl(struct yenta_socket *socket, unsigned offset) { u32 val; pci_read_config_dword(socket->dev, offset, &val); - debug("%p %04x %08x\n", socket, offset, val); + debug("%04x %08x\n", socket, offset, val); return val; } static inline void config_writeb(struct yenta_socket *socket, unsigned offset, u8 val) { - debug("%p %04x %02x\n", socket, offset, val); + debug("%04x %02x\n", socket, offset, val); pci_write_config_byte(socket->dev, offset, val); } static inline void config_writew(struct yenta_socket *socket, unsigned offset, u16 val) { - debug("%p %04x %04x\n", socket, offset, val); + debug("%04x %04x\n", socket, offset, val); pci_write_config_word(socket->dev, offset, val); } static inline void config_writel(struct yenta_socket *socket, unsigned offset, u32 val) { - debug("%p %04x %08x\n", socket, offset, val); + debug("%04x %08x\n", socket, offset, val); pci_write_config_dword(socket->dev, offset, val); } static inline u8 exca_readb(struct yenta_socket *socket, unsigned reg) { u8 val = readb(socket->base + 0x800 + reg); - debug("%p %04x %02x\n", socket, reg, val); + debug("%04x %02x\n", socket, reg, val); return val; } @@ -134,20 +130,20 @@ static inline u8 exca_readw(struct yenta_socket *socket, unsigned reg) u16 val; val = readb(socket->base + 0x800 + reg); val |= readb(socket->base + 0x800 + reg + 1) << 8; - debug("%p %04x %04x\n", socket, reg, val); + debug("%04x %04x\n", socket, reg, val); return val; } static inline void exca_writeb(struct yenta_socket *socket, unsigned reg, u8 val) { - debug("%p %04x %02x\n", socket, reg, val); + debug("%04x %02x\n", socket, reg, val); writeb(val, socket->base + 0x800 + reg); readb(socket->base + 0x800 + reg); /* PCI write posting... */ } static void exca_writew(struct yenta_socket *socket, unsigned reg, u16 val) { - debug("%p %04x %04x\n", socket, reg, val); + debug("%04x %04x\n", socket, reg, val); writeb(val, socket->base + 0x800 + reg); writeb(val >> 8, socket->base + 0x800 + reg + 1); @@ -207,7 +203,7 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value) if (state & CB_CBCARD) { - val |= SS_CARDBUS; + val |= SS_CARDBUS; val |= (state & CB_CARDSTS) ? SS_STSCHG : 0; val |= (state & (CB_CDETECT1 | CB_CDETECT2)) ? 0 : SS_DETECT; val |= (state & CB_PWRCYCLE) ? SS_POWERON | SS_READY : 0; @@ -650,8 +646,10 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type root = pci_find_parent_resource(socket->dev, res); if (root && (request_resource(root, res) == 0)) return 0; - printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", - pci_name(socket->dev), nr); + dev_printk(KERN_INFO, &socket->dev->dev, + "Preassigned resource %d busy or not available, " + "reconfiguring...\n", + nr); } if (type & IORESOURCE_IO) { @@ -674,8 +672,9 @@ static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type return 1; } - printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", - pci_name(socket->dev), type); + dev_printk(KERN_INFO, &socket->dev->dev, + "no resource of type %x available, trying to continue...\n", + type); res->start = res->end = res->flags = 0; return 0; } @@ -923,7 +922,8 @@ static int yenta_probe_cb_irq(struct yenta_socket *socket) socket->probe_status = 0; if (request_irq(socket->cb_irq, yenta_probe_handler, IRQF_SHARED, "yenta", socket)) { - printk(KERN_WARNING "Yenta: request_irq() in yenta_probe_cb_irq() failed!\n"); + dev_printk(KERN_WARNING, &socket->dev->dev, + "request_irq() in yenta_probe_cb_irq() failed!\n"); return -1; } @@ -960,8 +960,9 @@ static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_i else socket->socket.irq_mask = 0; - printk(KERN_INFO "Yenta: ISA IRQ mask 0x%04x, PCI irq %d\n", - socket->socket.irq_mask, socket->cb_irq); + dev_printk(KERN_INFO, &socket->dev->dev, + "ISA IRQ mask 0x%04x, PCI irq %d\n", + socket->socket.irq_mask, socket->cb_irq); } /* @@ -1051,8 +1052,9 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) /* Show that the wanted subordinate number is not possible: */ if (cardbus_bridge->subordinate > upper_limit) - printk(KERN_WARNING "Yenta: Upper limit for fixing this " - "bridge's parent bridge: #%02x\n", upper_limit); + dev_printk(KERN_WARNING, &cardbus_bridge->dev, + "Upper limit for fixing this " + "bridge's parent bridge: #%02x\n", upper_limit); /* If we have room to increase the bridge's subordinate number, */ if (bridge_to_fix->subordinate < upper_limit) { @@ -1061,10 +1063,11 @@ static void yenta_fixup_parent_bridge(struct pci_bus *cardbus_bridge) unsigned char subordinate_to_assign = min(cardbus_bridge->subordinate, upper_limit); - printk(KERN_INFO "Yenta: Raising subordinate bus# of parent " - "bus (#%02x) from #%02x to #%02x\n", - bridge_to_fix->number, - bridge_to_fix->subordinate, subordinate_to_assign); + dev_printk(KERN_INFO, &bridge_to_fix->dev, + "Raising subordinate bus# of parent " + "bus (#%02x) from #%02x to #%02x\n", + bridge_to_fix->number, + bridge_to_fix->subordinate, subordinate_to_assign); /* Save the new subordinate in the bus struct of the bridge */ bridge_to_fix->subordinate = subordinate_to_assign; @@ -1091,8 +1094,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i * Bail out if so. */ if (!dev->subordinate) { - printk(KERN_ERR "Yenta: no bus associated with %s! " - "(try 'pci=assign-busses')\n", pci_name(dev)); + dev_printk(KERN_ERR, &dev->dev, "no bus associated! " + "(try 'pci=assign-busses')\n"); return -ENODEV; } @@ -1127,7 +1130,7 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i goto disable; if (!pci_resource_start(dev, 0)) { - printk(KERN_ERR "No cardbus resource!\n"); + dev_printk(KERN_ERR, &dev->dev, "No cardbus resource!\n"); ret = -ENODEV; goto release; } @@ -1146,8 +1149,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i * report the subsystem vendor and device for help debugging * the irq stuff... */ - printk(KERN_INFO "Yenta: CardBus bridge found at %s [%04x:%04x]\n", - pci_name(dev), dev->subsystem_vendor, dev->subsystem_device); + dev_printk(KERN_INFO, &dev->dev, "CardBus bridge found [%04x:%04x]\n", + dev->subsystem_vendor, dev->subsystem_device); yenta_config_init(socket); @@ -1179,8 +1182,12 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i socket->poll_timer.data = (unsigned long)socket; socket->poll_timer.expires = jiffies + HZ; add_timer(&socket->poll_timer); - printk(KERN_INFO "Yenta: no PCI IRQ, CardBus support disabled for this socket.\n" - KERN_INFO "Yenta: check your BIOS CardBus, BIOS IRQ or ACPI settings.\n"); + dev_printk(KERN_INFO, &dev->dev, + "no PCI IRQ, CardBus support disabled for this " + "socket.\n"); + dev_printk(KERN_INFO, &dev->dev, + "check your BIOS CardBus, BIOS IRQ or ACPI " + "settings.\n"); } else { socket->socket.features |= SS_CAP_CARDBUS; } @@ -1188,7 +1195,8 @@ static int __devinit yenta_probe (struct pci_dev *dev, const struct pci_device_i /* Figure out what the dang thing can do for the PCMCIA layer... */ yenta_interrogate(socket); yenta_get_socket_capabilities(socket, isa_interrupts); - printk(KERN_INFO "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); + dev_printk(KERN_INFO, &dev->dev, + "Socket status: %08x\n", cb_readl(socket, CB_SOCKET_STATE)); yenta_fixup_parent_bridge(dev->subordinate); -- cgit v1.2.3 From 2e55bf6b99fb05f3f4228e7f1381624ac8ac7e3d Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 18:08:38 +0200 Subject: pcmcia: use dev_printk in module pcmcia_core Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 3 ++- drivers/pcmcia/cs.c | 20 ++++++++++++-------- drivers/pcmcia/cs_internal.h | 6 +++--- 3 files changed, 17 insertions(+), 12 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 65129b54eb09..f804b45de242 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -92,7 +92,8 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag if (!(s->features & SS_CAP_STATIC_MAP) && (mem->res == NULL)) { mem->res = pcmcia_find_mem_region(0, s->map_size, s->map_size, 0, s); if (mem->res == NULL) { - printk(KERN_NOTICE "cs: unable to map card memory!\n"); + dev_printk(KERN_NOTICE, &s->dev, + "cs: unable to map card memory!\n"); return NULL; } s->cis_virt = NULL; diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index d1207393fc3e..ceb2b0c39a6f 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -247,7 +247,8 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) wait_for_completion(&socket->thread_done); if (!socket->thread) { - printk(KERN_WARNING "PCMCIA: warning: socket thread for socket %p did not start\n", socket); + dev_printk(KERN_WARNING, &socket->dev, + "PCMCIA: warning: socket thread did not start\n"); return -EIO; } @@ -412,7 +413,8 @@ static void socket_shutdown(struct pcmcia_socket *s) s->ops->get_status(s, &status); if (status & SS_POWERON) { - printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s); + dev_printk(KERN_ERR, &s->dev, + "*** DANGER *** unable to remove socket power\n"); } cs_socket_put(s); @@ -508,9 +510,10 @@ static int socket_insert(struct pcmcia_socket *skt) if (ret == CS_SUCCESS) { skt->state |= SOCKET_PRESENT; - printk(KERN_NOTICE "pccard: %s card inserted into slot %d\n", - (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA", - skt->sock); + dev_printk(KERN_NOTICE, &skt->dev, + "pccard: %s card inserted into slot %d\n", + (skt->state & SOCKET_CARDBUS) ? "CardBus" : "PCMCIA", + skt->sock); #ifdef CONFIG_CARDBUS if (skt->state & SOCKET_CARDBUS) { @@ -595,7 +598,8 @@ static int socket_resume(struct pcmcia_socket *skt) static void socket_remove(struct pcmcia_socket *skt) { - printk(KERN_NOTICE "pccard: card ejected from slot %d\n", skt->sock); + dev_printk(KERN_NOTICE, &skt->dev, + "pccard: card ejected from slot %d\n", skt->sock); socket_shutdown(skt); } @@ -641,8 +645,8 @@ static int pccardd(void *__skt) /* register with the device core */ ret = device_register(&skt->dev); if (ret) { - printk(KERN_WARNING "PCMCIA: unable to register socket 0x%p\n", - skt); + dev_printk(KERN_WARNING, &skt->dev, + "PCMCIA: unable to register socket\n"); skt->thread = NULL; complete(&skt->thread_done); return 0; diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 63dc1a28bda2..fe7d729cf28b 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -137,8 +137,8 @@ extern int cs_debug_level(int); #define cs_dbg(skt, lvl, fmt, arg...) do { \ if (cs_debug_level(lvl)) \ - printk(KERN_DEBUG "cs: %s: " fmt, \ - cs_socket_name(skt) , ## arg); \ + dev_printk(KERN_DEBUG, &skt->dev, \ + "cs: " fmt, ## arg); \ } while (0) #else @@ -146,6 +146,6 @@ extern int cs_debug_level(int); #endif #define cs_err(skt, fmt, arg...) \ - printk(KERN_ERR "cs: %s: " fmt, (skt)->dev.bus_id , ## arg) + dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) #endif /* _LINUX_CS_INTERNAL_H */ -- cgit v1.2.3 From ac449d6e2c81d26f91d092aba114ab3cb2a02ca0 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 18:33:56 +0200 Subject: pcmcia: use dev_printk in module pcmcia (includes bugfix from and Signed-off-by: Harvey Harrison ) Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 135 +++++++++++++++++++++------------------ drivers/pcmcia/pcmcia_resource.c | 13 ++-- 2 files changed, 81 insertions(+), 67 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4174d9656e35..57e462e1c592 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -48,11 +48,16 @@ int ds_pc_debug; module_param_named(pc_debug, ds_pc_debug, int, 0644); #define ds_dbg(lvl, fmt, arg...) do { \ - if (ds_pc_debug > (lvl)) \ + if (ds_pc_debug > (lvl)) \ printk(KERN_DEBUG "ds: " fmt , ## arg); \ } while (0) +#define ds_dev_dbg(lvl, dev, fmt, arg...) do { \ + if (ds_pc_debug > (lvl)) \ + dev_printk(KERN_DEBUG, dev, "ds: " fmt , ## arg); \ +} while (0) #else #define ds_dbg(lvl, fmt, arg...) do { } while (0) +#define ds_dev_dbg(lvl, dev, fmt, arg...) do { } while (0) #endif spinlock_t pcmcia_dev_list_lock; @@ -391,7 +396,7 @@ static void pcmcia_release_function(struct kref *ref) static void pcmcia_release_dev(struct device *dev) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); - ds_dbg(1, "releasing device %s\n", p_dev->dev.bus_id); + ds_dev_dbg(1, dev, "releasing device\n"); pcmcia_put_socket(p_dev->socket); kfree(p_dev->devname); kref_put(&p_dev->function_config->ref, pcmcia_release_function); @@ -401,7 +406,7 @@ static void pcmcia_release_dev(struct device *dev) static void pcmcia_add_device_later(struct pcmcia_socket *s, int mfc) { if (!s->pcmcia_state.device_add_pending) { - ds_dbg(1, "scheduling to add %s secondary" + ds_dev_dbg(1, &s->dev, "scheduling to add %s secondary" " device to %d\n", mfc ? "mfc" : "pfc", s->sock); s->pcmcia_state.device_add_pending = 1; s->pcmcia_state.mfc_pfc = mfc; @@ -427,8 +432,7 @@ static int pcmcia_device_probe(struct device * dev) p_drv = to_pcmcia_drv(dev->driver); s = p_dev->socket; - ds_dbg(1, "trying to bind %s to %s\n", p_dev->dev.bus_id, - p_drv->drv.name); + ds_dev_dbg(1, dev, "trying to bind to %s\n", p_drv->drv.name); if ((!p_drv->probe) || (!p_dev->function_config) || (!try_module_get(p_drv->owner))) { @@ -443,15 +447,16 @@ static int pcmcia_device_probe(struct device * dev) p_dev->conf.ConfigBase = cis_config.base; p_dev->conf.Present = cis_config.rmask[0]; } else { - printk(KERN_INFO "pcmcia: could not parse base and rmask0 of CIS\n"); + 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; } ret = p_drv->probe(p_dev); if (ret) { - ds_dbg(1, "binding %s to %s failed with %d\n", - p_dev->dev.bus_id, p_drv->drv.name, ret); + ds_dev_dbg(1, dev, "binding to %s failed with %d\n", + p_drv->drv.name, ret); goto put_module; } @@ -485,8 +490,9 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le struct pcmcia_device *tmp; unsigned long flags; - ds_dbg(2, "pcmcia_card_remove(%d) %s\n", s->sock, - leftover ? leftover->devname : ""); + ds_dev_dbg(2, leftover ? &leftover->dev : &s->dev, + "pcmcia_card_remove(%d) %s\n", s->sock, + leftover ? leftover->devname : ""); if (!leftover) s->device_count = 0; @@ -503,7 +509,7 @@ static void pcmcia_card_remove(struct pcmcia_socket *s, struct pcmcia_device *le p_dev->_removed=1; spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); - ds_dbg(2, "unregistering device %s\n", p_dev->dev.bus_id); + ds_dev_dbg(2, &p_dev->dev, "unregistering device\n"); device_unregister(&p_dev->dev); } @@ -520,7 +526,7 @@ static int pcmcia_device_remove(struct device * dev) p_dev = to_pcmcia_dev(dev); p_drv = to_pcmcia_drv(dev->driver); - ds_dbg(1, "removing device %s\n", p_dev->dev.bus_id); + ds_dev_dbg(1, dev, "removing device\n"); /* If we're removing the primary module driving a * pseudo multi-function card, we need to unbind @@ -543,13 +549,15 @@ static int pcmcia_device_remove(struct device * dev) /* check for proper unloading */ if (p_dev->_irq || p_dev->_io || p_dev->_locked) - printk(KERN_INFO "pcmcia: driver %s did not release config properly\n", - p_drv->drv.name); + dev_printk(KERN_INFO, dev, + "pcmcia: driver %s did not release config properly\n", + p_drv->drv.name); for (i = 0; i < MAX_WIN; i++) if (p_dev->_win & CLIENT_WIN_REQ(i)) - printk(KERN_INFO "pcmcia: driver %s did not release windows properly\n", - p_drv->drv.name); + dev_printk(KERN_INFO, dev, + "pcmcia: driver %s did not release window properly\n", + p_drv->drv.name); /* references from pcmcia_probe_device */ pcmcia_put_dev(p_dev); @@ -598,8 +606,9 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) } if (!pccard_read_tuple(p_dev->socket, p_dev->func, CISTPL_DEVICE_GEO, devgeo)) { - ds_dbg(0, "mem device geometry probably means " - "FUNCID_MEMORY\n"); + ds_dev_dbg(0, &p_dev->dev, + "mem device geometry probably means " + "FUNCID_MEMORY\n"); p_dev->func_id = CISTPL_FUNCID_MEMORY; p_dev->has_func_id = 1; } @@ -680,7 +689,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f if (!p_dev->devname) goto err_free; sprintf (p_dev->devname, "pcmcia%s", p_dev->dev.bus_id); - ds_dbg(3, "devname is %s\n", p_dev->devname); + ds_dev_dbg(3, &p_dev->dev, "devname is %s\n", p_dev->devname); spin_lock_irqsave(&pcmcia_dev_list_lock, flags); @@ -701,7 +710,7 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f spin_unlock_irqrestore(&pcmcia_dev_list_lock, flags); if (!p_dev->function_config) { - ds_dbg(3, "creating config_t for %s\n", p_dev->dev.bus_id); + ds_dev_dbg(3, &p_dev->dev, "creating config_t\n"); p_dev->function_config = kzalloc(sizeof(struct config_t), GFP_KERNEL); if (!p_dev->function_config) @@ -709,8 +718,9 @@ struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int f kref_init(&p_dev->function_config->ref); } - printk(KERN_NOTICE "pcmcia: registering new device %s\n", - p_dev->devname); + dev_printk(KERN_NOTICE, &p_dev->dev, + "pcmcia: registering new device %s\n", + p_dev->devname); pcmcia_device_query(p_dev); @@ -745,19 +755,20 @@ static int pcmcia_card_add(struct pcmcia_socket *s) int ret = 0; if (!(s->resource_setup_done)) { - ds_dbg(3, "no resources available, delaying card_add\n"); + ds_dev_dbg(3, &s->dev, + "no resources available, delaying card_add\n"); return -EAGAIN; /* try again, but later... */ } if (pcmcia_validate_mem(s)) { - ds_dbg(3, "validating mem resources failed, " + ds_dev_dbg(3, &s->dev, "validating mem resources failed, " "delaying card_add\n"); return -EAGAIN; /* try again, but later... */ } ret = pccard_validate_cis(s, BIND_FN_ALL, &no_chains); if (ret || !no_chains) { - ds_dbg(0, "invalid CIS or invalid resources\n"); + ds_dev_dbg(0, &s->dev, "invalid CIS or invalid resources\n"); return -ENODEV; } @@ -778,7 +789,7 @@ static void pcmcia_delayed_add_device(struct work_struct *work) { struct pcmcia_socket *s = container_of(work, struct pcmcia_socket, device_add); - ds_dbg(1, "adding additional device to %d\n", s->sock); + ds_dev_dbg(1, &s->dev, "adding additional device to %d\n", s->sock); pcmcia_device_add(s, s->pcmcia_state.mfc_pfc); s->pcmcia_state.device_add_pending = 0; s->pcmcia_state.mfc_pfc = 0; @@ -788,8 +799,7 @@ static int pcmcia_requery(struct device *dev, void * _data) { struct pcmcia_device *p_dev = to_pcmcia_dev(dev); if (!p_dev->dev.driver) { - ds_dbg(1, "update device information for %s\n", - p_dev->dev.bus_id); + ds_dev_dbg(1, dev, "update device information\n"); pcmcia_device_query(p_dev); } @@ -803,7 +813,7 @@ static void pcmcia_bus_rescan(struct pcmcia_socket *skt, int new_cis) unsigned long flags; /* must be called with skt_mutex held */ - ds_dbg(0, "re-scanning socket %d\n", skt->sock); + ds_dev_dbg(0, &skt->dev, "re-scanning socket %d\n", skt->sock); spin_lock_irqsave(&pcmcia_dev_list_lock, flags); if (list_empty(&skt->devices_list)) @@ -860,11 +870,12 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) if (!filename) return -EINVAL; - ds_dbg(1, "trying to load CIS file %s\n", filename); + ds_dev_dbg(1, &dev->dev, "trying to load CIS file %s\n", filename); if (strlen(filename) > (FIRMWARE_NAME_MAX - 1)) { - printk(KERN_WARNING "pcmcia: CIS filename is too long [%s]\n", - filename); + dev_printk(KERN_WARNING, &dev->dev, + "pcmcia: CIS filename is too long [%s]\n", + filename); return -EINVAL; } @@ -873,7 +884,8 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) if (request_firmware(&fw, path, &dev->dev) == 0) { if (fw->size >= CISTPL_MAX_CIS_SIZE) { ret = -EINVAL; - printk(KERN_ERR "pcmcia: CIS override is too big\n"); + dev_printk(KERN_ERR, &dev->dev, + "pcmcia: CIS override is too big\n"); goto release; } @@ -889,7 +901,8 @@ static int pcmcia_load_firmware(struct pcmcia_device *dev, char * filename) if (!pcmcia_replace_cis(s, cis)) ret = 0; else { - printk(KERN_ERR "pcmcia: CIS override failed\n"); + dev_printk(KERN_ERR, &dev->dev, + "pcmcia: CIS override failed\n"); goto release; } @@ -993,14 +1006,14 @@ static inline int pcmcia_devmatch(struct pcmcia_device *dev, * after it has re-checked that there is no possible module * with a prod_id/manf_id/card_id match. */ - ds_dbg(0, "skipping FUNC_ID match for %s until userspace " - "interaction\n", dev->dev.bus_id); + ds_dev_dbg(0, &dev->dev, + "skipping FUNC_ID match until userspace interaction\n"); if (!dev->allow_func_id_match) return 0; } if (did->match_flags & PCMCIA_DEV_ID_MATCH_FAKE_CIS) { - ds_dbg(0, "device %s needs a fake CIS\n", dev->dev.bus_id); + ds_dev_dbg(0, &dev->dev, "device needs a fake CIS\n"); if (!dev->socket->fake_cis) pcmcia_load_firmware(dev, did->cisfile); @@ -1032,11 +1045,9 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { /* match dynamic devices first */ spin_lock(&p_drv->dynids.lock); list_for_each_entry(dynid, &p_drv->dynids.list, node) { - ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, - drv->name); + ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); if (pcmcia_devmatch(p_dev, &dynid->id)) { - ds_dbg(0, "matched %s to %s\n", dev->bus_id, - drv->name); + ds_dev_dbg(0, dev, "matched to %s\n", drv->name); spin_unlock(&p_drv->dynids.lock); return 1; } @@ -1046,18 +1057,15 @@ static int pcmcia_bus_match(struct device * dev, struct device_driver * drv) { #ifdef CONFIG_PCMCIA_IOCTL /* matching by cardmgr */ if (p_dev->cardmgr == p_drv) { - ds_dbg(0, "cardmgr matched %s to %s\n", dev->bus_id, - drv->name); + ds_dev_dbg(0, dev, "cardmgr matched to %s\n", drv->name); return 1; } #endif while (did && did->match_flags) { - ds_dbg(3, "trying to match %s to %s\n", dev->bus_id, - drv->name); + ds_dev_dbg(3, dev, "trying to match to %s\n", drv->name); if (pcmcia_devmatch(p_dev, did)) { - ds_dbg(0, "matched %s to %s\n", dev->bus_id, - drv->name); + ds_dev_dbg(0, dev, "matched to %s\n", drv->name); return 1; } did++; @@ -1263,7 +1271,7 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) if (p_dev->suspended) return 0; - ds_dbg(2, "suspending %s\n", dev->bus_id); + ds_dev_dbg(2, dev, "suspending\n"); if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); @@ -1274,15 +1282,16 @@ static int pcmcia_dev_suspend(struct device * dev, pm_message_t state) if (p_drv->suspend) { ret = p_drv->suspend(p_dev); if (ret) { - printk(KERN_ERR "pcmcia: device %s (driver %s) did " - "not want to go to sleep (%d)\n", - p_dev->devname, p_drv->drv.name, ret); + dev_printk(KERN_ERR, dev, + "pcmcia: device %s (driver %s) did " + "not want to go to sleep (%d)\n", + p_dev->devname, p_drv->drv.name, ret); goto out; } } if (p_dev->device_no == p_dev->func) { - ds_dbg(2, "releasing configuration for %s\n", dev->bus_id); + ds_dev_dbg(2, dev, "releasing configuration\n"); pcmcia_release_configuration(p_dev); } @@ -1302,7 +1311,7 @@ static int pcmcia_dev_resume(struct device * dev) if (!p_dev->suspended) return 0; - ds_dbg(2, "resuming %s\n", dev->bus_id); + ds_dev_dbg(2, dev, "resuming\n"); if (dev->driver) p_drv = to_pcmcia_drv(dev->driver); @@ -1311,7 +1320,7 @@ static int pcmcia_dev_resume(struct device * dev) goto out; if (p_dev->device_no == p_dev->func) { - ds_dbg(2, "requesting configuration for %s\n", dev->bus_id); + ds_dev_dbg(2, dev, "requesting configuration\n"); ret = pcmcia_request_configuration(p_dev, &p_dev->conf); if (ret) goto out; @@ -1353,14 +1362,14 @@ static int pcmcia_bus_resume_callback(struct device *dev, void * _data) static int pcmcia_bus_resume(struct pcmcia_socket *skt) { - ds_dbg(2, "resuming socket %d\n", skt->sock); + ds_dev_dbg(2, &skt->dev, "resuming socket %d\n", skt->sock); bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_resume_callback); return 0; } static int pcmcia_bus_suspend(struct pcmcia_socket *skt) { - ds_dbg(2, "suspending socket %d\n", skt->sock); + ds_dev_dbg(2, &skt->dev, "suspending socket %d\n", skt->sock); if (bus_for_each_dev(&pcmcia_bus_type, NULL, skt, pcmcia_bus_suspend_callback)) { pcmcia_bus_resume(skt); @@ -1386,13 +1395,14 @@ static int ds_event(struct pcmcia_socket *skt, event_t event, int priority) struct pcmcia_socket *s = pcmcia_get_socket(skt); if (!s) { - printk(KERN_ERR "PCMCIA obtaining reference to socket %p " \ - "failed, event 0x%x lost!\n", skt, event); + dev_printk(KERN_ERR, &skt->dev, + "PCMCIA obtaining reference to socket " \ + "failed, event 0x%x lost!\n", event); return -ENODEV; } - ds_dbg(1, "ds_event(0x%06x, %d, 0x%p)\n", - event, priority, skt); + ds_dev_dbg(1, &skt->dev, "ds_event(0x%06x, %d, 0x%p)\n", + event, priority, skt); switch (event) { case CS_EVENT_CARD_REMOVAL: @@ -1467,7 +1477,8 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, socket = pcmcia_get_socket(socket); if (!socket) { - printk(KERN_ERR "PCMCIA obtaining reference to socket %p failed\n", socket); + dev_printk(KERN_ERR, dev, + "PCMCIA obtaining reference to socket failed\n"); return -ENODEV; } @@ -1487,7 +1498,7 @@ static int __devinit pcmcia_bus_add_socket(struct device *dev, ret = pccard_register_pcmcia(socket, &pcmcia_bus_callback); if (ret) { - printk(KERN_ERR "PCMCIA registration PCCard core failed for socket %p\n", socket); + dev_printk(KERN_ERR, dev, "PCMCIA registration failed\n"); pcmcia_put_socket(socket); return (ret); } diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 4884a18cf9e6..79058825c6f2 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -49,11 +49,12 @@ extern int ds_pc_debug; #define ds_dbg(skt, lvl, fmt, arg...) do { \ if (ds_pc_debug >= lvl) \ - printk(KERN_DEBUG "pcmcia_resource: %s: " fmt, \ - cs_socket_name(skt) , ## arg); \ + dev_printk(KERN_DEBUG, &skt->dev, \ + "pcmcia_resource: " fmt, \ + ## arg); \ } while (0) #else -#define ds_dbg(lvl, fmt, arg...) do { } while (0) +#define ds_dbg(skt, lvl, fmt, arg...) do { } while (0) #endif @@ -802,8 +803,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) /* Make sure the fact the request type was overridden is passed back */ if (type == IRQF_SHARED && !(req->Attributes & IRQ_TYPE_DYNAMIC_SHARING)) { req->Attributes |= IRQ_TYPE_DYNAMIC_SHARING; - printk(KERN_WARNING "pcmcia: request for exclusive IRQ could not be fulfilled.\n"); - printk(KERN_WARNING "pcmcia: the driver needs updating to supported shared IRQ lines.\n"); + dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: " + "request for exclusive IRQ could not be fulfilled.\n"); + dev_printk(KERN_WARNING, &p_dev->dev, "pcmcia: the driver " + "needs updating to supported shared IRQ lines.\n"); } c->irq.Attributes = req->Attributes; s->irq.AssignedIRQ = req->AssignedIRQ = irq; -- cgit v1.2.3 From dbe4ea5fde198a3808e46b665d889818c1e600f5 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 21:36:19 +0200 Subject: pcmcia: use dev_printk in module rsrc_nonstatic Signed-off-by: Dominik Brodowski --- drivers/pcmcia/rsrc_nonstatic.c | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index d0c1d63d1891..00aacbe731dc 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -194,13 +194,14 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, int any; u_char *b, hole, most; - printk(KERN_INFO "cs: IO port probe %#x-%#x:", - base, base+num-1); + dev_printk(KERN_INFO, &s->dev, "cs: IO port probe %#x-%#x:", + base, base+num-1); /* First, what does a floating port look like? */ b = kzalloc(256, GFP_KERNEL); if (!b) { - printk(KERN_ERR "do_io_probe: unable to kmalloc 256 bytes"); + dev_printk(KERN_ERR, &s->dev, + "do_io_probe: unable to kmalloc 256 bytes"); return; } for (i = base, most = 0; i < base+num; i += 8) { @@ -366,8 +367,8 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s) struct socket_data *s_data = s->resource_data; u_long i, j, bad, fail, step; - printk(KERN_INFO "cs: memory probe 0x%06lx-0x%06lx:", - base, base+num-1); + dev_printk(KERN_INFO, &s->dev, "cs: memory probe 0x%06lx-0x%06lx:", + base, base+num-1); bad = fail = 0; step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); /* don't allow too large steps */ @@ -431,8 +432,8 @@ static int validate_mem(struct pcmcia_socket *s, unsigned int probe_mask) if (probe_mask & MEM_PROBE_HIGH) { if (inv_probe(s_data->mem_db.next, s) > 0) return 0; - printk(KERN_NOTICE "cs: warning: no high memory space " - "available!\n"); + dev_printk(KERN_NOTICE, &s->dev, + "cs: warning: no high memory space available!\n"); return -ENODEV; } @@ -794,10 +795,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) if (res->flags & IORESOURCE_IO) { if (res == &ioport_resource) continue; - printk(KERN_INFO "pcmcia: parent PCI bridge I/O " - "window: 0x%llx - 0x%llx\n", - (unsigned long long)res->start, - (unsigned long long)res->end); + dev_printk(KERN_INFO, &s->cb_dev->dev, + "pcmcia: parent PCI bridge I/O " + "window: 0x%llx - 0x%llx\n", + (unsigned long long)res->start, + (unsigned long long)res->end); if (!adjust_io(s, ADD_MANAGED_RESOURCE, res->start, res->end)) done |= IORESOURCE_IO; @@ -806,10 +808,11 @@ static int nonstatic_autoadd_resources(struct pcmcia_socket *s) if (res->flags & IORESOURCE_MEM) { if (res == &iomem_resource) continue; - printk(KERN_INFO "pcmcia: parent PCI bridge Memory " - "window: 0x%llx - 0x%llx\n", - (unsigned long long)res->start, - (unsigned long long)res->end); + dev_printk(KERN_INFO, &s->cb_dev->dev, + "pcmcia: parent PCI bridge Memory " + "window: 0x%llx - 0x%llx\n", + (unsigned long long)res->start, + (unsigned long long)res->end); if (!adjust_memory(s, ADD_MANAGED_RESOURCE, res->start, res->end)) done |= IORESOURCE_MEM; } -- cgit v1.2.3 From 2bccc2a89012173f48a690caea7d9e4b3e950db9 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 09:03:53 +0200 Subject: pcmcia: remove unused cs_socket_name() definition Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 2 -- 1 file changed, 2 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index fe7d729cf28b..bca83bbfdbda 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -130,8 +130,6 @@ struct pcmcia_callback{ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); -#define cs_socket_name(skt) ((skt)->dev.bus_id) - #ifdef DEBUG extern int cs_debug_level(int); -- cgit v1.2.3 From 7d16b658bd093e75a9f72a69e2dafd2b154c4395 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 21:02:01 +0200 Subject: pcmcia: don't add extra DEBUG cflag Use CONFIG_PCMCIA_DEBUG instead of DEBUG so that dev_dbg() and other tricks work properly. (includes bugfixes from and Signed-off-by: Stephen Rothwell Signed-off-by: Larry Finger ) Signed-off-by: Dominik Broodwski --- drivers/pcmcia/Makefile | 4 ---- drivers/pcmcia/cs.c | 2 +- drivers/pcmcia/cs_internal.h | 2 +- drivers/pcmcia/ds.c | 2 +- drivers/pcmcia/i82365.c | 2 +- drivers/pcmcia/m32r_cfc.c | 4 ++-- drivers/pcmcia/m32r_pcc.c | 4 ++-- drivers/pcmcia/m8xx_pcmcia.c | 4 ++-- drivers/pcmcia/pcmcia_ioctl.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 2 +- drivers/pcmcia/soc_common.c | 2 +- drivers/pcmcia/soc_common.h | 2 +- drivers/pcmcia/tcic.c | 2 +- 13 files changed, 15 insertions(+), 19 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index 269a9e913ba2..2ea5d46a4033 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile @@ -2,10 +2,6 @@ # Makefile for the kernel pcmcia subsystem (c/o David Hinds) # -ifeq ($(CONFIG_PCMCIA_DEBUG),y) -EXTRA_CFLAGS += -DDEBUG -endif - pcmcia_core-y += cs.o cistpl.o rsrc_mgr.o socket_sysfs.o pcmcia_core-$(CONFIG_CARDBUS) += cardbus.o obj-$(CONFIG_PCCARD) += pcmcia_core.o diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index ceb2b0c39a6f..ccdbbe4936fd 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -61,7 +61,7 @@ INT_MODULE_PARM(unreset_limit, 30); /* unreset_check's */ /* Access speed for attribute memory windows */ INT_MODULE_PARM(cis_speed, 300); /* ns */ -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static int pc_debug; module_param(pc_debug, int, 0644); diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index bca83bbfdbda..481a823c94b4 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -130,7 +130,7 @@ struct pcmcia_callback{ int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG extern int cs_debug_level(int); #define cs_dbg(skt, lvl, fmt, arg...) do { \ diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 57e462e1c592..6501a968a640 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -42,7 +42,7 @@ MODULE_AUTHOR("David Hinds "); MODULE_DESCRIPTION("PCMCIA Driver Services"); MODULE_LICENSE("GPL"); -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG int ds_pc_debug; module_param_named(pc_debug, ds_pc_debug, int, 0644); diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index 68f6b2702bc4..71653ab84890 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -63,7 +63,7 @@ #include "vg468.h" #include "ricoh.h" -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static const char version[] = "i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index 3616da227152..2ab4f22c21de 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c @@ -38,7 +38,7 @@ #include "m32r_cfc.h" -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static int m32r_cfc_debug; module_param(m32r_cfc_debug, int, 0644); #define debug(lvl, fmt, arg...) do { \ @@ -505,7 +505,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) pcc_set(sock,(unsigned int)PLD_CFBUFCR,1); } -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG if(state->flags & SS_IOCARD){ debug(3, ":IOCARD"); } diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index 2b42b7155e34..2f108c23dbd9 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c @@ -45,7 +45,7 @@ #define PCC_DEBUG_DBEX -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static int m32r_pcc_debug; module_param(m32r_pcc_debug, int, 0644); #define debug(lvl, fmt, arg...) do { \ @@ -460,7 +460,7 @@ static int _pcc_set_socket(u_short sock, socket_state_t *state) pcc_set(sock,PCCSIGCR,reg); -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG if(state->flags & SS_IOCARD){ debug(3, ":IOCARD"); } diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index ff66604e90d4..d1ad0966392d 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -64,8 +64,8 @@ #include #include -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; +#ifdef CONFIG_PCMCIA_DEBUG +static int pc_debug; module_param(pc_debug, int, 0); #define dprintk(args...) printk(KERN_DEBUG "m8xx_pcmcia: " args); #else diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 419f97fc9a62..0492d2df01a1 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -58,7 +58,7 @@ typedef struct user_info_t { } user_info_t; -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG extern int ds_pc_debug; #define ds_dbg(lvl, fmt, arg...) do { \ diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 79058825c6f2..2c636058f493 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -44,7 +44,7 @@ static u8 pcmcia_used_irq[NR_IRQS]; #endif -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG extern int ds_pc_debug; #define ds_dbg(skt, lvl, fmt, arg...) do { \ diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 8c21446996f2..89edcbc3bfd2 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -54,7 +54,7 @@ #include #endif -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static int pc_debug; module_param(pc_debug, int, 0644); diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 91ef6a0da3ab..8e4cc92bbe73 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h @@ -137,7 +137,7 @@ extern int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_lev extern int soc_common_drv_pcmcia_remove(struct device *dev); -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG extern void soc_pcmcia_debug(struct soc_pcmcia_socket *skt, const char *func, int lvl, const char *fmt, ...); diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 5792bd5c54f9..2a613e920fd4 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -55,7 +55,7 @@ #include #include "tcic.h" -#ifdef DEBUG +#ifdef CONFIG_PCMCIA_DEBUG static int pc_debug; module_param(pc_debug, int, 0644); -- cgit v1.2.3 From 64f346425175ad33812cd693fbca48cd512dab63 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sat, 2 Aug 2008 17:00:46 +0200 Subject: 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 --- drivers/pcmcia/cs_internal.h | 1 - drivers/pcmcia/pcmcia_ioctl.c | 72 ++++++++++++++++++++++++++++++++++++ drivers/pcmcia/pcmcia_resource.c | 79 ---------------------------------------- include/pcmcia/cs.h | 1 - 4 files changed, 72 insertions(+), 81 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 481a823c94b4..384a76bd38eb 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -116,7 +116,6 @@ extern void pccard_sysfs_remove_socket(struct device *dev); extern struct rw_semaphore pcmcia_socket_list_rwsem; extern struct list_head pcmcia_socket_list; int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); -int pccard_get_configuration_info(struct pcmcia_socket *s, struct pcmcia_device *p_dev, config_info_t *config); int pccard_reset_card(struct pcmcia_socket *skt); 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, return CS_SUCCESS; } /* pccard_get_status */ +int pccard_get_configuration_info(struct pcmcia_socket *s, + struct pcmcia_device *p_dev, + config_info_t *config) +{ + config_t *c; + + if (!(s->state & SOCKET_PRESENT)) + return CS_NO_CARD; + + +#ifdef CONFIG_CARDBUS + if (s->state & SOCKET_CARDBUS) { + memset(config, 0, sizeof(config_info_t)); + config->Vcc = s->socket.Vcc; + config->Vpp1 = config->Vpp2 = s->socket.Vpp; + config->Option = s->cb_dev->subordinate->number; + if (s->state & SOCKET_CARDBUS_CONFIG) { + config->Attributes = CONF_VALID_CLIENT; + config->IntType = INT_CARDBUS; + config->AssignedIRQ = s->irq.AssignedIRQ; + if (config->AssignedIRQ) + config->Attributes |= CONF_ENABLE_IRQ; + if (s->io[0].res) { + config->BasePort1 = s->io[0].res->start; + config->NumPorts1 = s->io[0].res->end - + config->BasePort1 + 1; + } + } + return CS_SUCCESS; + } +#endif + + if (p_dev) { + c = p_dev->function_config; + config->Function = p_dev->func; + } else { + c = NULL; + config->Function = 0; + } + + if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { + config->Attributes = 0; + config->Vcc = s->socket.Vcc; + config->Vpp1 = config->Vpp2 = s->socket.Vpp; + return CS_SUCCESS; + } + + config->Attributes = c->Attributes | CONF_VALID_CLIENT; + config->Vcc = s->socket.Vcc; + config->Vpp1 = config->Vpp2 = s->socket.Vpp; + config->IntType = c->IntType; + config->ConfigBase = c->ConfigBase; + config->Status = c->Status; + config->Pin = c->Pin; + config->Copy = c->Copy; + config->Option = c->Option; + config->ExtStatus = c->ExtStatus; + config->Present = config->CardValues = c->CardValues; + config->IRQAttributes = c->irq.Attributes; + config->AssignedIRQ = s->irq.AssignedIRQ; + config->BasePort1 = c->io.BasePort1; + config->NumPorts1 = c->io.NumPorts1; + config->Attributes1 = c->io.Attributes1; + config->BasePort2 = c->io.BasePort2; + config->NumPorts2 = c->io.NumPorts2; + config->Attributes2 = c->io.Attributes2; + config->IOAddrLines = c->io.IOAddrLines; + + return CS_SUCCESS; +} /* pccard_get_configuration_info */ + + /*====================================================================== These manage a ring buffer of events pending for one user process diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 9afe420c41f4..c5a2b005091c 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -197,85 +197,6 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, EXPORT_SYMBOL(pcmcia_access_configuration_register); -int pccard_get_configuration_info(struct pcmcia_socket *s, - struct pcmcia_device *p_dev, - config_info_t *config) -{ - config_t *c; - - if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; - - -#ifdef CONFIG_CARDBUS - if (s->state & SOCKET_CARDBUS) { - memset(config, 0, sizeof(config_info_t)); - config->Vcc = s->socket.Vcc; - config->Vpp1 = config->Vpp2 = s->socket.Vpp; - config->Option = s->cb_dev->subordinate->number; - if (s->state & SOCKET_CARDBUS_CONFIG) { - config->Attributes = CONF_VALID_CLIENT; - config->IntType = INT_CARDBUS; - config->AssignedIRQ = s->irq.AssignedIRQ; - if (config->AssignedIRQ) - config->Attributes |= CONF_ENABLE_IRQ; - if (s->io[0].res) { - config->BasePort1 = s->io[0].res->start; - config->NumPorts1 = s->io[0].res->end - config->BasePort1 + 1; - } - } - return CS_SUCCESS; - } -#endif - - if (p_dev) { - c = p_dev->function_config; - config->Function = p_dev->func; - } else { - c = NULL; - config->Function = 0; - } - - if ((c == NULL) || !(c->state & CONFIG_LOCKED)) { - config->Attributes = 0; - config->Vcc = s->socket.Vcc; - config->Vpp1 = config->Vpp2 = s->socket.Vpp; - return CS_SUCCESS; - } - - config->Attributes = c->Attributes | CONF_VALID_CLIENT; - config->Vcc = s->socket.Vcc; - config->Vpp1 = config->Vpp2 = s->socket.Vpp; - config->IntType = c->IntType; - config->ConfigBase = c->ConfigBase; - config->Status = c->Status; - config->Pin = c->Pin; - config->Copy = c->Copy; - config->Option = c->Option; - config->ExtStatus = c->ExtStatus; - config->Present = config->CardValues = c->CardValues; - config->IRQAttributes = c->irq.Attributes; - config->AssignedIRQ = s->irq.AssignedIRQ; - config->BasePort1 = c->io.BasePort1; - config->NumPorts1 = c->io.NumPorts1; - config->Attributes1 = c->io.Attributes1; - config->BasePort2 = c->io.BasePort2; - config->NumPorts2 = c->io.NumPorts2; - config->Attributes2 = c->io.Attributes2; - config->IOAddrLines = c->io.IOAddrLines; - - return CS_SUCCESS; -} /* pccard_get_configuration_info */ - -int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, - config_info_t *config) -{ - return pccard_get_configuration_info(p_dev->socket, p_dev, - config); -} -EXPORT_SYMBOL(pcmcia_get_configuration_info); - - /** pcmcia_get_window */ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 45d84b275789..ea51a8c4cc50 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -372,7 +372,6 @@ enum service { struct pcmcia_socket; int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); -int pcmcia_get_configuration_info(struct pcmcia_device *p_dev, config_info_t *config); int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); -- cgit v1.2.3 From 4c89e88bfde6a3c179790e21004f24e09a058290 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 10:07:45 +0200 Subject: pcmcia: deprecate CS_SUCCESS Instead of using own error or success codes, the PCMCIA code should rely on the generic return values. Therefore, replace all occurrences of CS_SUCCESS with 0. CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/bluetooth/bluecard_cs.c | 8 ++-- drivers/bluetooth/bt3c_cs.c | 4 +- drivers/bluetooth/btuart_cs.c | 4 +- drivers/bluetooth/dtl1_cs.c | 4 +- drivers/char/pcmcia/cm4040_cs.c | 4 +- drivers/char/pcmcia/ipwireless/main.c | 36 ++++++++-------- drivers/isdn/hardware/avm/avm_cs.c | 4 +- drivers/isdn/hisax/avma1_cs.c | 4 +- drivers/isdn/hisax/elsa_cs.c | 6 +-- drivers/isdn/hisax/teles_cs.c | 6 +-- drivers/mtd/maps/pcmciamtd.c | 17 ++++---- drivers/net/pcmcia/3c574_cs.c | 7 ++-- drivers/net/pcmcia/3c589_cs.c | 7 ++-- drivers/net/pcmcia/axnet_cs.c | 7 ++-- drivers/net/pcmcia/com20020_cs.c | 8 ++-- drivers/net/pcmcia/fmvj18x_cs.c | 19 +++++---- drivers/net/pcmcia/ibmtr_cs.c | 2 +- drivers/net/pcmcia/pcnet_cs.c | 7 ++-- drivers/net/pcmcia/smc91c92_cs.c | 45 +++++++++++--------- drivers/net/wireless/b43/pcmcia.c | 14 +++---- drivers/net/wireless/hostap/hostap_cs.c | 22 +++++----- drivers/net/wireless/netwave_cs.c | 5 ++- drivers/net/wireless/ray_cs.c | 4 +- drivers/net/wireless/wavelan_cs.c | 16 ++++---- drivers/net/wireless/wl3501_cs.c | 4 +- drivers/pcmcia/cardbus.c | 2 +- drivers/pcmcia/cistpl.c | 73 +++++++++++++++++---------------- drivers/pcmcia/cs.c | 14 +++---- drivers/pcmcia/ds.c | 2 +- drivers/pcmcia/ds_internal.h | 10 ++++- drivers/pcmcia/pcmcia_ioctl.c | 14 +++---- drivers/pcmcia/pcmcia_resource.c | 26 ++++++------ drivers/pcmcia/rsrc_nonstatic.c | 4 +- drivers/serial/serial_cs.c | 16 ++++---- drivers/ssb/pcmcia.c | 20 ++++----- 35 files changed, 233 insertions(+), 212 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index bcf57927b7a8..e6ee21d99d92 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -901,23 +901,23 @@ static int bluecard_config(struct pcmcia_device *link) for (n = 0; n < 0x400; n += 0x40) { link->io.BasePort1 = n ^ 0x300; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) + if (i == 0) break; } - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIO, i); goto failed; } i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); goto failed; } diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index 3fd8022a6351..156edfd7e10d 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -743,13 +743,13 @@ static int bt3c_config(struct pcmcia_device *link) found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); goto failed; } diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index 17183125434f..8e556b7ff9f6 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -672,13 +672,13 @@ static int btuart_config(struct pcmcia_device *link) found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); goto failed; } diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index ec12560e0342..e6e6b037695a 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -617,13 +617,13 @@ static int dtl1_config(struct pcmcia_device *link) goto failed; i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); goto failed; } diff --git a/drivers/char/pcmcia/cm4040_cs.c b/drivers/char/pcmcia/cm4040_cs.c index e047bac56f0e..2d7c906435b7 100644 --- a/drivers/char/pcmcia/cm4040_cs.c +++ b/drivers/char/pcmcia/cm4040_cs.c @@ -567,8 +567,8 @@ static int reader_config(struct pcmcia_device *link, int devno) link->conf.IntType = 00000002; - if ((fail_rc = pcmcia_request_configuration(link,&link->conf)) - !=CS_SUCCESS) { + fail_rc = pcmcia_request_configuration(link, &link->conf); + if (fail_rc != 0) { dev_printk(KERN_INFO, &handle_to_dev(link), "pcmcia_request_configuration failed 0x%x\n", fail_rc); diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 1f520e544d45..24ffe0324e53 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -67,7 +67,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot) struct pcmcia_device *link = ipw->link; int ret = pccard_reset_card(link->socket); - if (ret != CS_SUCCESS) + if (ret != 0) cs_error(link, ResetCard, ret); } @@ -104,7 +104,7 @@ static int config_ipwireless(struct ipw_dev *ipw) while (ret == 0) { ret = pcmcia_get_tuple_data(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetTupleData, ret); goto exit0; } @@ -115,21 +115,21 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_get_first_tuple(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetFirstTuple, ret); goto exit0; } ret = pcmcia_get_tuple_data(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetTupleData, ret); goto exit0; } ret = pcmcia_parse_tuple(link, &tuple, &parse); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, ParseTuple, ret); goto exit0; } @@ -151,21 +151,21 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_get_first_tuple(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetFirstTuple, ret); goto exit0; } ret = pcmcia_get_tuple_data(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetTupleData, ret); goto exit0; } ret = pcmcia_parse_tuple(link, &tuple, &parse); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetTupleData, ret); goto exit0; } @@ -180,7 +180,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_request_io(link, &link->io); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestIO, ret); goto exit0; } @@ -194,21 +194,21 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_get_first_tuple(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetFirstTuple, ret); goto exit1; } ret = pcmcia_get_tuple_data(link, &tuple); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, GetTupleData, ret); goto exit1; } ret = pcmcia_parse_tuple(link, &tuple, &parse); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, ParseTuple, ret); goto exit1; } @@ -226,7 +226,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_request_window(&link, &ipw->request_common_memory, &ipw->handle_common_memory); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestWindow, ret); goto exit1; } @@ -238,7 +238,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_map_mem_page(ipw->handle_common_memory, &memreq_common_memory); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, MapMemPage, ret); goto exit1; } @@ -260,7 +260,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_request_window(&link, &ipw->request_attr_memory, &ipw->handle_attr_memory); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestWindow, ret); goto exit2; } @@ -271,7 +271,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_map_mem_page(ipw->handle_attr_memory, &memreq_attr_memory); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, MapMemPage, ret); goto exit2; } @@ -291,7 +291,7 @@ static int config_ipwireless(struct ipw_dev *ipw) ret = pcmcia_request_irq(link, &link->irq); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestIRQ, ret); goto exit3; } @@ -331,7 +331,7 @@ static int config_ipwireless(struct ipw_dev *ipw) */ ret = pcmcia_request_configuration(link, &link->conf); - if (ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestConfiguration, ret); goto exit4; } diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index 388046539705..c72565520e41 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -197,7 +197,7 @@ static int avmcs_config(struct pcmcia_device *link) * allocate an interrupt line */ i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); /* undo */ pcmcia_disable_device(link); @@ -208,7 +208,7 @@ static int avmcs_config(struct pcmcia_device *link) * configure the PCMCIA socket */ i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); pcmcia_disable_device(link); break; diff --git a/drivers/isdn/hisax/avma1_cs.c b/drivers/isdn/hisax/avma1_cs.c index 8fd3ca0fb93a..23560c897ec3 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -217,7 +217,7 @@ static int avma1cs_config(struct pcmcia_device *link) * allocate an interrupt line */ i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); /* undo */ pcmcia_disable_device(link); @@ -228,7 +228,7 @@ static int avma1cs_config(struct pcmcia_device *link) * configure the PCMCIA socket */ i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); pcmcia_disable_device(link); break; diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index 2bf0016dea5e..f4d0fe29bcf8 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -238,20 +238,20 @@ static int elsa_cs_config(struct pcmcia_device *link) dev = link->priv; i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL); - if (i != CS_SUCCESS) { + if (i != 0) { last_fn = RequestIO; goto cs_failed; } i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { link->irq.AssignedIRQ = 0; last_fn = RequestIRQ; goto cs_failed; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { last_fn = RequestConfiguration; goto cs_failed; } diff --git a/drivers/isdn/hisax/teles_cs.c b/drivers/isdn/hisax/teles_cs.c index 21cabd0aadbe..623d111544d4 100644 --- a/drivers/isdn/hisax/teles_cs.c +++ b/drivers/isdn/hisax/teles_cs.c @@ -228,20 +228,20 @@ static int teles_cs_config(struct pcmcia_device *link) dev = link->priv; i = pcmcia_loop_config(link, teles_cs_configcheck, NULL); - if (i != CS_SUCCESS) { + if (i != 0) { last_fn = RequestIO; goto cs_failed; } i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { link->irq.AssignedIRQ = 0; last_fn = RequestIRQ; goto cs_failed; } i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { last_fn = RequestConfiguration; goto cs_failed; } diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 8861ca477dd9..27b3d96b7124 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -118,7 +118,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) DEBUG(2, "Remapping window from 0x%8.8x to 0x%8.8x", dev->offset, mrq.CardOffset); mrq.Page = 0; - if( (ret = pcmcia_map_mem_page(win, &mrq)) != CS_SUCCESS) { + ret = pcmcia_map_mem_page(win, &mrq); + if (ret != 0) { cs_error(dev->p_dev, MapMemPage, ret); return NULL; } @@ -326,9 +327,8 @@ static void pcmciamtd_set_vpp(struct map_info *map, int on) DEBUG(2, "dev = %p on = %d vpp = %d\n", dev, on, dev->vpp); ret = pcmcia_modify_configuration(link, &mod); - if(ret != CS_SUCCESS) { + if (ret != 0) cs_error(link, ModifyConfiguration, ret); - } } @@ -368,14 +368,14 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, tuple.DesiredTuple = RETURN_FIRST_TUPLE; rc = pcmcia_get_first_tuple(link, &tuple); - while(rc == CS_SUCCESS) { + while (rc == 0) { rc = pcmcia_get_tuple_data(link, &tuple); - if(rc != CS_SUCCESS) { + if (rc != 0) { cs_error(link, GetTupleData, rc); break; } rc = pcmcia_parse_tuple(link, &tuple, &parse); - if(rc != CS_SUCCESS) { + if (rc != 0) { cs_error(link, ParseTuple, rc); break; } @@ -500,9 +500,8 @@ static int pcmciamtd_config(struct pcmcia_device *link) DEBUG(2, "Validating CIS"); ret = pcmcia_validate_cis(link, NULL); - if(ret != CS_SUCCESS) { + if (ret != 0) cs_error(link, GetTupleData, ret); - } card_settings(dev, link, &new_name); @@ -582,7 +581,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) link->conf.ConfigIndex = 0; DEBUG(2, "Setting Configuration"); ret = pcmcia_request_configuration(link, &link->conf); - if(ret != CS_SUCCESS) { + if (ret != 0) { cs_error(link, RequestConfiguration, ret); if (dev->win_base) { iounmap(dev->win_base); diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 7112fd5e0e1b..08c4dd896077 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c @@ -355,9 +355,10 @@ static int tc574_config(struct pcmcia_device *link) for (i = j = 0; j < 0x400; j += 0x20) { link->io.BasePort1 = j ^ 0x300; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) break; + if (i == 0) + break; } - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIO, i); goto failed; } @@ -377,7 +378,7 @@ static int tc574_config(struct pcmcia_device *link) tuple.TupleDataMax = 64; tuple.TupleOffset = 0; tuple.DesiredTuple = 0x88; - if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { + if (pcmcia_get_first_tuple(link, &tuple) == 0) { pcmcia_get_tuple_data(link, &tuple); for (i = 0; i < 3; i++) phys_addr[i] = htons(le16_to_cpu(buf[i])); diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 549a64558420..0b28d0d8ffa8 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c @@ -278,9 +278,10 @@ static int tc589_config(struct pcmcia_device *link) if (multi && (j & 0x80)) continue; link->io.BasePort1 = j ^ 0x300; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) break; + if (i == 0) + break; } - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIO, i); goto failed; } @@ -295,7 +296,7 @@ static int tc589_config(struct pcmcia_device *link) /* The 3c589 has an extra EEPROM for configuration info, including the hardware address. The 3c562 puts the address in the CIS. */ tuple.DesiredTuple = 0x88; - if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { + if (pcmcia_get_first_tuple(link, &tuple) == 0) { pcmcia_get_tuple_data(link, &tuple); for (i = 0; i < 3; i++) phys_addr[i] = htons(le16_to_cpu(buf[i])); diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c index 061d889794c5..0bc641adce19 100644 --- a/drivers/net/pcmcia/axnet_cs.c +++ b/drivers/net/pcmcia/axnet_cs.c @@ -262,7 +262,7 @@ static int try_io_port(struct pcmcia_device *link) if (link->io.NumPorts2 > 0) { /* for master/slave multifunction cards */ link->io.Attributes2 = IO_DATA_PATH_WIDTH_8; - link->irq.Attributes = + link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED; } } else { @@ -276,7 +276,8 @@ static int try_io_port(struct pcmcia_device *link) link->io.BasePort1 = j ^ 0x300; link->io.BasePort2 = (j ^ 0x300) + 0x10; ret = pcmcia_request_io(link, &link->io); - if (ret == CS_SUCCESS) return ret; + if (ret == 0) + return ret; } return ret; } else { @@ -327,7 +328,7 @@ static int axnet_config(struct pcmcia_device *link) /* don't trust the CIS on this; Linksys got it wrong */ link->conf.Present = 0x63; last_ret = pcmcia_loop_config(link, axnet_configcheck, NULL); - if (last_ret != CS_SUCCESS) { + if (last_ret != 0) { cs_error(link, RequestIO, last_ret); goto failed; } diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index ea9414c4d900..831090c75622 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c @@ -260,21 +260,21 @@ static int com20020_config(struct pcmcia_device *link) DEBUG(0, "com20020_config(0x%p)\n", link); DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); - i = !CS_SUCCESS; + i = -ENODEV; if (!link->io.BasePort1) { for (ioaddr = 0x100; ioaddr < 0x400; ioaddr += 0x10) { link->io.BasePort1 = ioaddr; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) + if (i == 0) break; } } else i = pcmcia_request_io(link, &link->io); - if (i != CS_SUCCESS) + if (i != 0) { DEBUG(1,"arcnet: requestIO failed totally!\n"); goto failed; @@ -287,7 +287,7 @@ static int com20020_config(struct pcmcia_device *link) link->irq.AssignedIRQ, link->irq.IRQInfo1, link->irq.IRQInfo2); i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) + if (i != 0) { DEBUG(1,"arcnet: requestIRQ failed totally!\n"); goto failed; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index a550c9bd126f..0ffd981502e1 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -309,7 +309,8 @@ static int mfc_try_io_port(struct pcmcia_device *link) printk(KERN_NOTICE "fmvj18x_cs: out of resource for serial\n"); } ret = pcmcia_request_io(link, &link->io); - if (ret == CS_SUCCESS) return ret; + if (ret == 0) + return ret; } return ret; } @@ -325,7 +326,7 @@ static int ungermann_try_io_port(struct pcmcia_device *link) for (ioaddr = 0x300; ioaddr < 0x3e0; ioaddr += 0x20) { link->io.BasePort1 = ioaddr; ret = pcmcia_request_io(link, &link->io); - if (ret == CS_SUCCESS) { + if (ret == 0) { /* calculate ConfigIndex value */ link->conf.ConfigIndex = ((link->io.BasePort1 & 0x0f0) >> 3) | 0x22; @@ -356,7 +357,7 @@ static int fmvj18x_config(struct pcmcia_device *link) tuple.TupleOffset = 0; tuple.DesiredTuple = CISTPL_FUNCE; tuple.TupleOffset = 0; - if (pcmcia_get_first_tuple(link, &tuple) == CS_SUCCESS) { + if (pcmcia_get_first_tuple(link, &tuple) == 0) { /* Yes, I have CISTPL_FUNCE. Let's check CISTPL_MANFID */ tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); @@ -430,10 +431,10 @@ static int fmvj18x_config(struct pcmcia_device *link) link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING|IRQ_FIRST_SHARED|IRQ_HANDLE_PRESENT; ret = mfc_try_io_port(link); - if (ret != CS_SUCCESS) goto cs_failed; + if (ret != 0) goto cs_failed; } else if (cardtype == UNGERMANN) { ret = ungermann_try_io_port(link); - if (ret != CS_SUCCESS) goto cs_failed; + if (ret != 0) goto cs_failed; } else { CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); } @@ -565,7 +566,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) req.Base = 0; req.Size = 0; req.AccessSpeed = 0; i = pcmcia_request_window(&link, &req, &link->win); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestWindow, i); return -1; } @@ -599,7 +600,7 @@ static int fmvj18x_get_hwinfo(struct pcmcia_device *link, u_char *node_id) iounmap(base); j = pcmcia_release_window(link->win); - if (j != CS_SUCCESS) + if (j != 0) cs_error(link, ReleaseWindow, j); return (i != 0x200) ? 0 : -1; @@ -620,7 +621,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) req.Base = 0; req.Size = 0; req.AccessSpeed = 0; i = pcmcia_request_window(&link, &req, &link->win); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestWindow, i); return -1; } @@ -642,7 +643,7 @@ static int fmvj18x_setup_mfc(struct pcmcia_device *link) iounmap(base); j = pcmcia_release_window(link->win); - if (j != CS_SUCCESS) + if (j != 0) cs_error(link, ReleaseWindow, j); return 0; diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c index 4eafa4f42cff..cf3cca4642f2 100644 --- a/drivers/net/pcmcia/ibmtr_cs.c +++ b/drivers/net/pcmcia/ibmtr_cs.c @@ -238,7 +238,7 @@ static int __devinit ibmtr_config(struct pcmcia_device *link) /* Try PRIMARY card at 0xA20-0xA23 */ link->io.BasePort1 = 0xA20; i = pcmcia_request_io(link, &link->io); - if (i != CS_SUCCESS) { + if (i != 0) { /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ link->io.BasePort1 = 0xA24; CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c index aa17434faa0e..1758952b3a38 100644 --- a/drivers/net/pcmcia/pcnet_cs.c +++ b/drivers/net/pcmcia/pcnet_cs.c @@ -310,7 +310,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) req.Base = 0; req.Size = 0; req.AccessSpeed = 0; i = pcmcia_request_window(&link, &req, &link->win); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestWindow, i); return NULL; } @@ -333,7 +333,7 @@ static hw_info_t *get_hwinfo(struct pcmcia_device *link) iounmap(virt); j = pcmcia_release_window(link->win); - if (j != CS_SUCCESS) + if (j != 0) cs_error(link, ReleaseWindow, j); return (i < NR_INFO) ? hw_info+i : NULL; } /* get_hwinfo */ @@ -504,7 +504,8 @@ static int try_io_port(struct pcmcia_device *link) link->io.BasePort1 = j ^ 0x300; link->io.BasePort2 = (j ^ 0x300) + 0x10; ret = pcmcia_request_io(link, &link->io); - if (ret == CS_SUCCESS) return ret; + if (ret == 0) + return ret; } return ret; } else { diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index b3f2085ddca9..267cbe0afd16 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -409,8 +409,11 @@ static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, { int i; - if ((i = pcmcia_get_first_tuple(handle, tuple)) != CS_SUCCESS || - (i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS) + i = pcmcia_get_first_tuple(handle, tuple); + if (i != 0) + return i; + i = pcmcia_get_tuple_data(handle, tuple); + if (i != 0) return i; return pcmcia_parse_tuple(handle, tuple, parse); } @@ -420,8 +423,8 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, { int i; - if ((i = pcmcia_get_next_tuple(handle, tuple)) != CS_SUCCESS || - (i = pcmcia_get_tuple_data(handle, tuple)) != CS_SUCCESS) + if ((i = pcmcia_get_next_tuple(handle, tuple)) != 0 || + (i = pcmcia_get_tuple_data(handle, tuple)) != 0) return i; return pcmcia_parse_tuple(handle, tuple, parse); } @@ -509,7 +512,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) req.Base = req.Size = 0; req.AccessSpeed = 0; i = pcmcia_request_window(&link, &req, &link->win); - if (i != CS_SUCCESS) + if (i != 0) goto free_cfg_mem; smc->base = ioremap(req.Base, req.Size); mem.CardOffset = mem.Page = 0; @@ -517,7 +520,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) mem.CardOffset = link->conf.ConfigBase; i = pcmcia_map_mem_page(link->win, &mem); - if ((i == CS_SUCCESS) + if ((i == 0) && (smc->manfid == MANFID_MEGAHERTZ) && (smc->cardid == PRODID_MEGAHERTZ_EM3288)) mhz_3288_power(link); @@ -551,12 +554,12 @@ static int mhz_setup(struct pcmcia_device *link) /* Read the station address from the CIS. It is stored as the last (fourth) string in the Version 1 Version/ID tuple. */ tuple->DesiredTuple = CISTPL_VERS_1; - if (first_tuple(link, tuple, parse) != CS_SUCCESS) { + if (first_tuple(link, tuple, parse) != 0) { rc = -1; goto free_cfg_mem; } /* Ugh -- the EM1144 card has two VERS_1 tuples!?! */ - if (next_tuple(link, tuple, parse) != CS_SUCCESS) + if (next_tuple(link, tuple, parse) != 0) first_tuple(link, tuple, parse); if (parse->version_1.ns > 3) { station_addr = parse->version_1.str + parse->version_1.ofs[3]; @@ -568,11 +571,11 @@ static int mhz_setup(struct pcmcia_device *link) /* Another possibility: for the EM3288, in a special tuple */ tuple->DesiredTuple = 0x81; - if (pcmcia_get_first_tuple(link, tuple) != CS_SUCCESS) { + if (pcmcia_get_first_tuple(link, tuple) != 0) { rc = -1; goto free_cfg_mem; } - if (pcmcia_get_tuple_data(link, tuple) != CS_SUCCESS) { + if (pcmcia_get_tuple_data(link, tuple) != 0) { rc = -1; goto free_cfg_mem; } @@ -700,12 +703,12 @@ static int smc_setup(struct pcmcia_device *link) /* Check for a LAN function extension tuple */ tuple->DesiredTuple = CISTPL_FUNCE; i = first_tuple(link, tuple, parse); - while (i == CS_SUCCESS) { + while (i == 0) { if (parse->funce.type == CISTPL_FUNCE_LAN_NODE_ID) break; i = next_tuple(link, tuple, parse); } - if (i == CS_SUCCESS) { + if (i == 0) { node_id = (cistpl_lan_node_id_t *)parse->funce.data; if (node_id->nb == 6) { for (i = 0; i < 6; i++) @@ -752,9 +755,10 @@ static int osi_config(struct pcmcia_device *link) for (i = j = 0; j < 4; j++) { link->io.BasePort2 = com[j]; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) break; + if (i == 0) + break; } - if (i != CS_SUCCESS) { + if (i != 0) { /* Fallback: turn off hard decode */ link->conf.ConfigIndex = 0x03; link->io.NumPorts2 = 0; @@ -787,13 +791,13 @@ static int osi_setup(struct pcmcia_device *link, u_short manfid, u_short cardid) /* Read the station address from tuple 0x90, subtuple 0x04 */ tuple->DesiredTuple = 0x90; i = pcmcia_get_first_tuple(link, tuple); - while (i == CS_SUCCESS) { + while (i == 0) { i = pcmcia_get_tuple_data(link, tuple); - if ((i != CS_SUCCESS) || (buf[0] == 0x04)) + if ((i != 0) || (buf[0] == 0x04)) break; i = pcmcia_get_next_tuple(link, tuple); } - if (i != CS_SUCCESS) { + if (i != 0) { rc = -1; goto free_cfg_mem; } @@ -931,8 +935,11 @@ static int check_sig(struct pcmcia_device *link) ======================================================================*/ -#define CS_EXIT_TEST(ret, svc, label) \ -if (ret != CS_SUCCESS) { cs_error(link, svc, ret); goto label; } +#define CS_EXIT_TEST(ret, svc, label) \ +if (ret != 0) { \ + cs_error(link, svc, ret); \ + goto label; \ +} static int smc91c92_config(struct pcmcia_device *link) { diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index b8aa16307f79..ab42fb6addf6 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -82,13 +82,13 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) tuple.TupleOffset = 0; res = pcmcia_get_first_tuple(dev, &tuple); - if (res != CS_SUCCESS) + if (res != 0) goto err_kfree_ssb; res = pcmcia_get_tuple_data(dev, &tuple); - if (res != CS_SUCCESS) + if (res != 0) goto err_kfree_ssb; res = pcmcia_parse_tuple(dev, &tuple, &parse); - if (res != CS_SUCCESS) + if (res != 0) goto err_kfree_ssb; dev->conf.ConfigBase = parse.config.base; @@ -107,13 +107,13 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) win.Size = SSB_CORE_SIZE; win.AccessSpeed = 250; res = pcmcia_request_window(&dev, &win, &dev->win); - if (res != CS_SUCCESS) + if (res != 0) goto err_kfree_ssb; mem.CardOffset = 0; mem.Page = 0; res = pcmcia_map_mem_page(dev->win, &mem); - if (res != CS_SUCCESS) + if (res != 0) goto err_disable; dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; @@ -121,11 +121,11 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) dev->irq.Handler = NULL; /* The handler is registered later. */ dev->irq.Instance = NULL; res = pcmcia_request_irq(dev, &dev->irq); - if (res != CS_SUCCESS) + if (res != 0) goto err_disable; res = pcmcia_request_configuration(dev, &dev->conf); - if (res != CS_SUCCESS) + if (res != 0) goto err_disable; err = ssb_bus_pcmciabus_register(ssb, dev, win.Base); diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index c768d42d5177..2826e674a8e7 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -234,7 +234,7 @@ static void sandisk_set_iobase(local_info_t *local) reg.Value = hw_priv->link->io.BasePort1 & 0x00ff; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 0 -" " res=%d\n", res); } @@ -246,7 +246,7 @@ static void sandisk_set_iobase(local_info_t *local) reg.Value = (hw_priv->link->io.BasePort1 & 0xff00) >> 8; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "Prism3 SanDisk - failed to set I/O base 1 -" " res=%d\n", res); } @@ -322,7 +322,7 @@ static int sandisk_enable_wireless(struct net_device *dev) reg.Value = COR_SOFT_RESET; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); goto done; @@ -339,7 +339,7 @@ static int sandisk_enable_wireless(struct net_device *dev) reg.Value = COR_LEVEL_REQ | 0x8 | COR_ADDR_DECODE | COR_FUNC_ENA; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "%s: SanDisk - COR sreset failed (%d)\n", dev->name, res); goto done; @@ -374,7 +374,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) reg.Value = 0; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 1 (%d)\n", res); return; @@ -386,7 +386,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) reg.Value |= COR_SOFT_RESET; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 2 (%d)\n", res); return; @@ -399,7 +399,7 @@ static void prism2_pccard_cor_sreset(local_info_t *local) reg.Value |= COR_IREQ_ENA; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_cor_sreset failed 3 (%d)\n", res); return; @@ -433,7 +433,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) reg.Value = 0; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 1 " "(%d)\n", res); return; @@ -446,7 +446,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) reg.Value |= COR_SOFT_RESET; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 2 " "(%d)\n", res); return; @@ -460,7 +460,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) reg.Offset = CISREG_CCSR; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 3 " "(%d)\n", res); return; @@ -472,7 +472,7 @@ static void prism2_pccard_genesis_reset(local_info_t *local, int hcr) reg.Value = old_cor & ~COR_SOFT_RESET; res = pcmcia_access_configuration_register(hw_priv->link, ®); - if (res != CS_SUCCESS) { + if (res != 0) { printk(KERN_DEBUG "prism2_pccard_genesis_sreset failed 4 " "(%d)\n", res); return; diff --git a/drivers/net/wireless/netwave_cs.c b/drivers/net/wireless/netwave_cs.c index f479c1af6782..bf2dd1057928 100644 --- a/drivers/net/wireless/netwave_cs.c +++ b/drivers/net/wireless/netwave_cs.c @@ -749,9 +749,10 @@ static int netwave_pcmcia_config(struct pcmcia_device *link) { for (i = j = 0x0; j < 0x400; j += 0x20) { link->io.BasePort1 = j ^ 0x300; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) break; + if (i == 0) + break; } - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIO, i); goto failed; } diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 963960dc30f2..99c7c8bc2573 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -798,9 +798,9 @@ static void ray_release(struct pcmcia_device *link) iounmap(local->amem); /* Do bother checking to see if these succeed or not */ i = pcmcia_release_window(local->amem_handle); - if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i); + if ( i != 0 ) DEBUG(0,"ReleaseWindow(local->amem) ret = %x\n",i); i = pcmcia_release_window(local->rmem_handle); - if ( i != CS_SUCCESS ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i); + if ( i != 0 ) DEBUG(0,"ReleaseWindow(local->rmem) ret = %x\n",i); pcmcia_disable_device(link); DEBUG(2,"ray_release ending\n"); diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c index b584c0ecc62d..fee9a0250534 100644 --- a/drivers/net/wireless/wavelan_cs.c +++ b/drivers/net/wireless/wavelan_cs.c @@ -3708,7 +3708,7 @@ wv_pcmcia_reset(struct net_device * dev) #endif i = pcmcia_access_configuration_register(link, ®); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, AccessConfigurationRegister, i); return FALSE; @@ -3722,7 +3722,7 @@ wv_pcmcia_reset(struct net_device * dev) reg.Action = CS_WRITE; reg.Value = reg.Value | COR_SW_RESET; i = pcmcia_access_configuration_register(link, ®); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, AccessConfigurationRegister, i); return FALSE; @@ -3731,7 +3731,7 @@ wv_pcmcia_reset(struct net_device * dev) reg.Action = CS_WRITE; reg.Value = COR_LEVEL_IRQ | COR_CONFIG; i = pcmcia_access_configuration_register(link, ®); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, AccessConfigurationRegister, i); return FALSE; @@ -3909,7 +3909,7 @@ wv_pcmcia_config(struct pcmcia_device * link) do { i = pcmcia_request_io(link, &link->io); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, RequestIO, i); break; @@ -3920,7 +3920,7 @@ wv_pcmcia_config(struct pcmcia_device * link) * actually assign a handler to the interrupt. */ i = pcmcia_request_irq(link, &link->irq); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, RequestIRQ, i); break; @@ -3932,7 +3932,7 @@ wv_pcmcia_config(struct pcmcia_device * link) */ link->conf.ConfigIndex = 1; i = pcmcia_request_configuration(link, &link->conf); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, RequestConfiguration, i); break; @@ -3948,7 +3948,7 @@ wv_pcmcia_config(struct pcmcia_device * link) req.Base = req.Size = 0; req.AccessSpeed = mem_speed; i = pcmcia_request_window(&link, &req, &link->win); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, RequestWindow, i); break; @@ -3960,7 +3960,7 @@ wv_pcmcia_config(struct pcmcia_device * link) mem.CardOffset = 0; mem.Page = 0; i = pcmcia_map_mem_page(link->win, &mem); - if(i != CS_SUCCESS) + if (i != 0) { cs_error(link, MapMemPage, i); break; diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c index 377141995e36..969f53fd705b 100644 --- a/drivers/net/wireless/wl3501_cs.c +++ b/drivers/net/wireless/wl3501_cs.c @@ -1977,10 +1977,10 @@ static int wl3501_config(struct pcmcia_device *link) link->io.BasePort1 = j; link->io.BasePort2 = link->io.BasePort1 + 0x10; i = pcmcia_request_io(link, &link->io); - if (i == CS_SUCCESS) + if (i == 0) break; } - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIO, i); goto failed; } diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index 911ca0e8dfc2..db77e1f3309a 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c @@ -238,7 +238,7 @@ int __ref cb_alloc(struct pcmcia_socket * s) pci_bus_add_devices(bus); s->irq.AssignedIRQ = s->pci_irq; - return CS_SUCCESS; + return 0; } void cb_free(struct pcmcia_socket * s) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index fe789e0e7ada..1a513d9a8612 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -392,7 +392,7 @@ int pcmcia_replace_cis(struct pcmcia_socket *s, return CS_OUT_OF_RESOURCE; s->fake_cis_len = len; memcpy(s->fake_cis, data, len); - return CS_SUCCESS; + return 0; } EXPORT_SYMBOL(pcmcia_replace_cis); @@ -441,9 +441,9 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple !(tuple->Attributes & TUPLE_RETURN_COMMON)) { cisdata_t req = tuple->DesiredTuple; tuple->DesiredTuple = CISTPL_LONGLINK_MFC; - if (pccard_get_next_tuple(s, function, tuple) == CS_SUCCESS) { + if (pccard_get_next_tuple(s, function, tuple) == 0) { tuple->DesiredTuple = CISTPL_LINKTARGET; - if (pccard_get_next_tuple(s, function, tuple) != CS_SUCCESS) + if (pccard_get_next_tuple(s, function, tuple) != 0) return CS_NO_MORE_ITEMS; } else tuple->CISOffset = tuple->TupleLink = 0; @@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ tuple->TupleCode = link[0]; tuple->TupleLink = link[1]; tuple->CISOffset = ofs + 2; - return CS_SUCCESS; + return 0; } EXPORT_SYMBOL(pccard_get_next_tuple); @@ -604,11 +604,11 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple) len = tuple->TupleLink - tuple->TupleOffset; tuple->TupleDataLen = tuple->TupleLink; if (len == 0) - return CS_SUCCESS; + return 0; read_cis_cache(s, SPACE(tuple->Flags), tuple->CISOffset + tuple->TupleOffset, _MIN(len, tuple->TupleDataMax), tuple->TupleData); - return CS_SUCCESS; + return 0; } EXPORT_SYMBOL(pccard_get_tuple_data); @@ -659,7 +659,7 @@ static int parse_device(tuple_t *tuple, cistpl_device_t *device) if (++p == q) break; } - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -673,7 +673,7 @@ static int parse_checksum(tuple_t *tuple, cistpl_checksum_t *csum) csum->addr = tuple->CISOffset + get_unaligned_le16(p) - 2; csum->len = get_unaligned_le16(p + 2); csum->sum = *(p + 4); - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -683,7 +683,7 @@ static int parse_longlink(tuple_t *tuple, cistpl_longlink_t *link) if (tuple->TupleDataLen < 4) return CS_BAD_TUPLE; link->addr = get_unaligned_le32(tuple->TupleData); - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -704,7 +704,7 @@ static int parse_longlink_mfc(tuple_t *tuple, link->fn[i].addr = get_unaligned_le32(p); p += 4; } - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -729,9 +729,9 @@ static int parse_strings(u_char *p, u_char *q, int max, } if (found) { *found = ns; - return CS_SUCCESS; + return 0; } else { - return (ns == max) ? CS_SUCCESS : CS_BAD_TUPLE; + return (ns == max) ? 0 : CS_BAD_TUPLE; } } @@ -782,7 +782,7 @@ static int parse_jedec(tuple_t *tuple, cistpl_jedec_t *jedec) p += 2; } jedec->nid = nid; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -793,7 +793,7 @@ static int parse_manfid(tuple_t *tuple, cistpl_manfid_t *m) return CS_BAD_TUPLE; m->manf = get_unaligned_le16(tuple->TupleData); m->card = get_unaligned_le16(tuple->TupleData + 2); - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -806,7 +806,7 @@ static int parse_funcid(tuple_t *tuple, cistpl_funcid_t *f) p = (u_char *)tuple->TupleData; f->func = p[0]; f->sysinit = p[1]; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -821,7 +821,7 @@ static int parse_funce(tuple_t *tuple, cistpl_funce_t *f) f->type = p[0]; for (i = 1; i < tuple->TupleDataLen; i++) f->data[i-1] = p[i]; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -847,7 +847,7 @@ static int parse_config(tuple_t *tuple, cistpl_config_t *config) for (i = 0; i <= rmsz; i++) config->rmask[i>>2] += p[i] << (8*(i%4)); config->subtuples = tuple->TupleDataLen - (rasz+rmsz+4); - return CS_SUCCESS; + return 0; } /*====================================================================== @@ -1122,7 +1122,7 @@ static int parse_cftable_entry(tuple_t *tuple, entry->subtuples = q-p; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -1138,7 +1138,7 @@ static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar) bar->attr = *p; p += 2; bar->size = get_unaligned_le32(p); - return CS_SUCCESS; + return 0; } static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) @@ -1152,7 +1152,7 @@ static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) p++; config->base = get_unaligned_le32(p); config->subtuples = tuple->TupleDataLen - 6; - return CS_SUCCESS; + return 0; } static int parse_cftable_entry_cb(tuple_t *tuple, @@ -1223,7 +1223,7 @@ static int parse_cftable_entry_cb(tuple_t *tuple, entry->subtuples = q-p; - return CS_SUCCESS; + return 0; } #endif @@ -1249,7 +1249,7 @@ static int parse_device_geo(tuple_t *tuple, cistpl_device_geo_t *geo) p += 6; } geo->ngeo = n; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -1291,7 +1291,7 @@ static int parse_org(tuple_t *tuple, cistpl_org_t *org) if (*p == '\0') break; if (++p == q) return CS_BAD_TUPLE; } - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -1310,14 +1310,14 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) fmt->offset = get_unaligned_le32(p + 2); fmt->length = get_unaligned_le32(p + 6); - return CS_SUCCESS; + return 0; } /*====================================================================*/ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) { - int ret = CS_SUCCESS; + int ret = 0; if (tuple->TupleDataLen > tuple->TupleDataMax) return CS_BAD_TUPLE; @@ -1388,7 +1388,7 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) break; case CISTPL_NO_LINK: case CISTPL_LINKTARGET: - ret = CS_SUCCESS; + ret = 0; break; default: ret = CS_UNSUPPORTED_FUNCTION; @@ -1416,12 +1416,14 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t tuple.DesiredTuple = code; tuple.Attributes = TUPLE_RETURN_COMMON; ret = pccard_get_first_tuple(s, function, &tuple); - if (ret != CS_SUCCESS) goto done; + if (ret != 0) + goto done; tuple.TupleData = buf; tuple.TupleOffset = 0; tuple.TupleDataMax = 255; ret = pccard_get_tuple_data(s, &tuple); - if (ret != CS_SUCCESS) goto done; + if (ret != 0) + goto done; ret = pccard_parse_tuple(&tuple, parse); done: kfree(buf); @@ -1462,21 +1464,21 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned tuple->DesiredTuple = RETURN_FIRST_TUPLE; tuple->Attributes = TUPLE_RETURN_COMMON; ret = pccard_get_first_tuple(s, function, tuple); - if (ret != CS_SUCCESS) + if (ret != 0) goto done; /* First tuple should be DEVICE; we should really have either that or a CFTABLE_ENTRY of some sort */ if ((tuple->TupleCode == CISTPL_DEVICE) || - (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == CS_SUCCESS) || - (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == CS_SUCCESS)) + (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY, p) == 0) || + (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) dev_ok++; /* All cards should have a MANFID tuple, and/or a VERS_1 or VERS_2 tuple, for card identification. Certain old D-Link and Linksys cards have only a broken VERS_2 tuple; hence the bogus test. */ - if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == CS_SUCCESS) || - (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == CS_SUCCESS) || + if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || + (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) ident_ok++; @@ -1485,7 +1487,8 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned for (count = 1; count < MAX_TUPLES; count++) { ret = pccard_get_next_tuple(s, function, tuple); - if (ret != CS_SUCCESS) break; + if (ret != 0) + break; if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || ((tuple->TupleCode > 0x47) && (tuple->TupleCode < 0x80)) || ((tuple->TupleCode > 0x90) && (tuple->TupleCode < 0xff))) @@ -1500,6 +1503,6 @@ done: *info = count; kfree(tuple); kfree(p); - return CS_SUCCESS; + return 0; } EXPORT_SYMBOL(pccard_validate_cis); diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index ccdbbe4936fd..037cb0c7e094 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -370,7 +370,7 @@ static int socket_reset(struct pcmcia_socket *skt) return CS_NO_CARD; if (status & SS_READY) - return CS_SUCCESS; + return 0; msleep(unreset_check * 10); } @@ -507,7 +507,7 @@ static int socket_insert(struct pcmcia_socket *skt) return CS_NO_CARD; ret = socket_setup(skt, setup_delay); - if (ret == CS_SUCCESS) { + if (ret == 0) { skt->state |= SOCKET_PRESENT; dev_printk(KERN_NOTICE, &skt->dev, @@ -543,7 +543,7 @@ static int socket_suspend(struct pcmcia_socket *skt) skt->ops->suspend(skt); skt->state |= SOCKET_SUSPEND; - return CS_SUCCESS; + return 0; } /* @@ -568,7 +568,7 @@ static int socket_resume(struct pcmcia_socket *skt) } ret = socket_setup(skt, resume_delay); - if (ret == CS_SUCCESS) { + if (ret == 0) { /* * FIXME: need a better check here for cardbus cards. */ @@ -593,7 +593,7 @@ static int socket_resume(struct pcmcia_socket *skt) skt->state &= ~SOCKET_SUSPEND; - return CS_SUCCESS; + return 0; } static void socket_remove(struct pcmcia_socket *skt) @@ -778,14 +778,14 @@ int pccard_reset_card(struct pcmcia_socket *skt) send_event(skt, CS_EVENT_RESET_PHYSICAL, CS_EVENT_PRI_LOW); if (skt->callback) skt->callback->suspend(skt); - if (socket_reset(skt) == CS_SUCCESS) { + if (socket_reset(skt) == 0) { send_event(skt, CS_EVENT_CARD_RESET, CS_EVENT_PRI_LOW); if (skt->callback) skt->callback->resume(skt); } } - ret = CS_SUCCESS; + ret = 0; } while (0); mutex_unlock(&skt->skt_mutex); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index a393501554ac..20bef0c12c14 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -187,7 +187,7 @@ static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err) else printk("%s: Unknown error code %#x\n", serv, err->retcode); - return CS_SUCCESS; + return 0; } /* report_error */ /* end of code which was in cs.c before */ diff --git a/drivers/pcmcia/ds_internal.h b/drivers/pcmcia/ds_internal.h index 3a2b25e6ed73..14bc55aa1426 100644 --- a/drivers/pcmcia/ds_internal.h +++ b/drivers/pcmcia/ds_internal.h @@ -18,6 +18,12 @@ extern int handle_request(struct pcmcia_socket *s, event_t event); #else static inline void __init pcmcia_setup_ioctl(void) { return; } static inline void __exit pcmcia_cleanup_ioctl(void) { return; } -static inline void handle_event(struct pcmcia_socket *s, event_t event) { return; } -static inline int handle_request(struct pcmcia_socket *s, event_t event) { return CS_SUCCESS; } +static inline void handle_event(struct pcmcia_socket *s, event_t event) +{ + return; +} +static inline int handle_request(struct pcmcia_socket *s, event_t event) +{ + return 0; +} #endif diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 53dadc111002..ef64ceb5e751 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -167,7 +167,7 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) #else static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { - return CS_SUCCESS; + return 0; } #endif @@ -274,7 +274,7 @@ static int pccard_get_status(struct pcmcia_socket *s, status->CardState |= (reg & ESR_REQ_ATTN) ? CS_EVENT_REQUEST_ATTENTION : 0; } - return CS_SUCCESS; + return 0; } status->CardState |= (val & SS_WRPROT) ? CS_EVENT_WRITE_PROTECT : 0; @@ -284,7 +284,7 @@ static int pccard_get_status(struct pcmcia_socket *s, (val & SS_BATWARN) ? CS_EVENT_BATTERY_LOW : 0; status->CardState |= (val & SS_READY) ? CS_EVENT_READY_CHANGE : 0; - return CS_SUCCESS; + return 0; } /* pccard_get_status */ int pccard_get_configuration_info(struct pcmcia_socket *s, @@ -315,7 +315,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, config->BasePort1 + 1; } } - return CS_SUCCESS; + return 0; } #endif @@ -331,7 +331,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, config->Attributes = 0; config->Vcc = s->socket.Vcc; config->Vpp1 = config->Vpp2 = s->socket.Vpp; - return CS_SUCCESS; + return 0; } config->Attributes = c->Attributes | CONF_VALID_CLIENT; @@ -355,7 +355,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, config->Attributes2 = c->io.Attributes2; config->IOAddrLines = c->io.IOAddrLines; - return CS_SUCCESS; + return 0; } /* pccard_get_configuration_info */ @@ -961,7 +961,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, err = -EINVAL; } - if ((err == 0) && (ret != CS_SUCCESS)) { + if ((err == 0) && (ret != 0)) { ds_dbg(2, "ds_ioctl: ret = %d\n", ret); switch (ret) { case CS_BAD_SOCKET: case CS_NO_CARD: diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index c5a2b005091c..48e168e8165b 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -192,7 +192,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, return CS_BAD_ARGS; break; } - return CS_SUCCESS; + return 0; } /* pcmcia_access_configuration_register */ EXPORT_SYMBOL(pcmcia_access_configuration_register); @@ -226,7 +226,7 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, if (win->ctl.flags & MAP_USE_WAIT) req->Attributes |= WIN_USE_WAIT; *handle = win; - return CS_SUCCESS; + return 0; } /* pcmcia_get_window */ EXPORT_SYMBOL(pcmcia_get_window); @@ -241,7 +241,7 @@ int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) return CS_BAD_HANDLE; req->Page = 0; req->CardOffset = win->ctl.card_start; - return CS_SUCCESS; + return 0; } /* pcmcia_get_mem_page */ EXPORT_SYMBOL(pcmcia_get_mem_page); @@ -257,7 +257,7 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) win->ctl.card_start = req->CardOffset; if (s->ops->set_mem_map(s, &win->ctl) != 0) return CS_BAD_OFFSET; - return CS_SUCCESS; + return 0; } /* pcmcia_map_mem_page */ EXPORT_SYMBOL(pcmcia_map_mem_page); @@ -328,7 +328,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, } } - return CS_SUCCESS; + return 0; } /* modify_configuration */ EXPORT_SYMBOL(pcmcia_modify_configuration); @@ -363,7 +363,7 @@ int pcmcia_release_configuration(struct pcmcia_device *p_dev) } } - return CS_SUCCESS; + return 0; } /* pcmcia_release_configuration */ @@ -397,7 +397,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) if (req->NumPorts2) release_io_space(s, req->BasePort2, req->NumPorts2); - return CS_SUCCESS; + return 0; } /* pcmcia_release_io */ @@ -429,7 +429,7 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) pcmcia_used_irq[req->AssignedIRQ]--; #endif - return CS_SUCCESS; + return 0; } /* pcmcia_release_irq */ @@ -458,7 +458,7 @@ int pcmcia_release_window(window_handle_t win) win->magic = 0; - return CS_SUCCESS; + return 0; } /* pcmcia_release_window */ EXPORT_SYMBOL(pcmcia_release_window); @@ -573,7 +573,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, c->state |= CONFIG_LOCKED; p_dev->_locked = 1; - return CS_SUCCESS; + return 0; } /* pcmcia_request_configuration */ EXPORT_SYMBOL(pcmcia_request_configuration); @@ -619,7 +619,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) c->io = *req; c->state |= CONFIG_IO_REQ; p_dev->_io = 1; - return CS_SUCCESS; + return 0; } /* pcmcia_request_io */ EXPORT_SYMBOL(pcmcia_request_io); @@ -740,7 +740,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) pcmcia_used_irq[irq]++; #endif - return CS_SUCCESS; + return 0; } /* pcmcia_request_irq */ EXPORT_SYMBOL(pcmcia_request_irq); @@ -821,7 +821,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h } *wh = win; - return CS_SUCCESS; + return 0; } /* pcmcia_request_window */ EXPORT_SYMBOL(pcmcia_request_window); diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 00aacbe731dc..9d04fb214ec2 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -134,7 +134,7 @@ static int add_interval(struct resource_map *map, u_long base, u_long num) if (!q) return CS_OUT_OF_RESOURCE; q->base = base; q->num = num; q->next = p->next; p->next = q; - return CS_SUCCESS; + return 0; } /*====================================================================*/ @@ -174,7 +174,7 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num) } } } - return CS_SUCCESS; + return 0; } /*====================================================================== diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 344e570fbb6f..ea7e3c0e02d9 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -431,10 +431,10 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) { int i; i = pcmcia_get_first_tuple(handle, tuple); - if (i != CS_SUCCESS) + if (i != 0) return CS_NO_MORE_ITEMS; i = pcmcia_get_tuple_data(handle, tuple); - if (i != CS_SUCCESS) + if (i != 0) return i; return pcmcia_parse_tuple(handle, tuple, parse); } @@ -527,7 +527,7 @@ static int simple_config(struct pcmcia_device *link) found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } @@ -541,7 +541,7 @@ found_port: info->quirk->config(link); i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); return -1; } @@ -609,7 +609,7 @@ static int multi_config(struct pcmcia_device *link) } i = pcmcia_request_irq(link, &link->irq); - if (i != CS_SUCCESS) { + if (i != 0) { /* FIXME: comment does not fit, error handling does not fit */ printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n"); @@ -624,7 +624,7 @@ static int multi_config(struct pcmcia_device *link) info->quirk->config(link); i = pcmcia_request_configuration(link, &link->conf); - if (i != CS_SUCCESS) { + if (i != 0) { cs_error(link, RequestConfiguration, i); return -ENODEV; } @@ -702,7 +702,7 @@ static int serial_config(struct pcmcia_device * link) /* Is this a compliant multifunction card? */ tuple->DesiredTuple = CISTPL_LONGLINK_MFC; tuple->Attributes = TUPLE_RETURN_COMMON | TUPLE_RETURN_LINK; - info->multi = (first_tuple(link, tuple, parse) == CS_SUCCESS); + info->multi = (first_tuple(link, tuple, parse) == 0); /* Is this a multiport card? */ tuple->DesiredTuple = CISTPL_MANFID; @@ -726,7 +726,7 @@ static int serial_config(struct pcmcia_device * link) ((link->func_id == CISTPL_FUNCID_MULTI) || (link->func_id == CISTPL_FUNCID_SERIAL))) { tuple->DesiredTuple = CISTPL_CFTABLE_ENTRY; - if (first_tuple(link, tuple, parse) == CS_SUCCESS) { + if (first_tuple(link, tuple, parse) == 0) { if ((cf->io.nwin == 1) && (cf->io.win[0].len % 8 == 0)) info->multi = cf->io.win[0].len >> 3; if ((cf->io.nwin == 2) && (cf->io.win[0].len == 8) && diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 24c2a46c1476..96993080c7d1 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c @@ -80,7 +80,7 @@ static int ssb_pcmcia_cfg_write(struct ssb_bus *bus, u8 offset, u8 value) reg.Action = CS_WRITE; reg.Value = value; res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); - if (unlikely(res != CS_SUCCESS)) + if (unlikely(res != 0)) return -EBUSY; return 0; @@ -96,7 +96,7 @@ static int ssb_pcmcia_cfg_read(struct ssb_bus *bus, u8 offset, u8 *value) reg.Offset = offset; reg.Action = CS_READ; res = pcmcia_access_configuration_register(bus->host_pcmcia, ®); - if (unlikely(res != CS_SUCCESS)) + if (unlikely(res != 0)) return -EBUSY; *value = reg.Value; @@ -638,17 +638,17 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "MAC first tpl"); + GOTO_ERROR_ON(res != 0, "MAC first tpl"); res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "MAC first tpl data"); + GOTO_ERROR_ON(res != 0, "MAC first tpl data"); while (1) { GOTO_ERROR_ON(tuple.TupleDataLen < 1, "MAC tpl < 1"); if (tuple.TupleData[0] == CISTPL_FUNCE_LAN_NODE_ID) break; res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "MAC next tpl"); + GOTO_ERROR_ON(res != 0, "MAC next tpl"); res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "MAC next tpl data"); + GOTO_ERROR_ON(res != 0, "MAC next tpl data"); } GOTO_ERROR_ON(tuple.TupleDataLen != ETH_ALEN + 2, "MAC tpl size"); memcpy(sprom->il0mac, &tuple.TupleData[2], ETH_ALEN); @@ -659,9 +659,9 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, tuple.TupleData = buf; tuple.TupleDataMax = sizeof(buf); res = pcmcia_get_first_tuple(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "VEN first tpl"); + GOTO_ERROR_ON(res != 0, "VEN first tpl"); res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "VEN first tpl data"); + GOTO_ERROR_ON(res != 0, "VEN first tpl data"); while (1) { GOTO_ERROR_ON(tuple.TupleDataLen < 1, "VEN tpl < 1"); switch (tuple.TupleData[0]) { @@ -735,9 +735,9 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); if (res == CS_NO_MORE_ITEMS) break; - GOTO_ERROR_ON(res != CS_SUCCESS, "VEN next tpl"); + GOTO_ERROR_ON(res != 0, "VEN next tpl"); res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); - GOTO_ERROR_ON(res != CS_SUCCESS, "VEN next tpl data"); + GOTO_ERROR_ON(res != 0, "VEN next tpl data"); } return 0; -- cgit v1.2.3 From 5ff87db6792844ae24cc784512a95e0c94521b19 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 10:36:50 +0200 Subject: pcmcia: deprecate unused CS_ error codes Deprecate unused CS_ error codes by replacing their definitions with generic error messages, and removing them from the error_t lookup table. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 10 ---------- include/pcmcia/cs.h | 20 ++++++++++---------- 2 files changed, 10 insertions(+), 20 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 20bef0c12c14..7142fd647e7b 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -75,29 +75,19 @@ typedef struct lookup_t { static const lookup_t error_table[] = { { CS_SUCCESS, "Operation succeeded" }, - { CS_BAD_ADAPTER, "Bad adapter" }, { CS_BAD_ATTRIBUTE, "Bad attribute", }, { CS_BAD_BASE, "Bad base address" }, - { CS_BAD_EDC, "Bad EDC" }, { CS_BAD_IRQ, "Bad IRQ" }, { CS_BAD_OFFSET, "Bad offset" }, { CS_BAD_PAGE, "Bad page number" }, - { CS_READ_FAILURE, "Read failure" }, { CS_BAD_SIZE, "Bad size" }, - { CS_BAD_SOCKET, "Bad socket" }, { CS_BAD_TYPE, "Bad type" }, { CS_BAD_VCC, "Bad Vcc" }, { CS_BAD_VPP, "Bad Vpp" }, - { CS_BAD_WINDOW, "Bad window" }, - { CS_WRITE_FAILURE, "Write failure" }, { CS_NO_CARD, "No card present" }, { CS_UNSUPPORTED_FUNCTION, "Usupported function" }, { CS_UNSUPPORTED_MODE, "Unsupported mode" }, - { CS_BAD_SPEED, "Bad speed" }, - { CS_BUSY, "Resource busy" }, { CS_GENERAL_FAILURE, "General failure" }, - { CS_WRITE_PROTECTED, "Write protected" }, - { CS_BAD_ARG_LENGTH, "Bad argument length" }, { CS_BAD_ARGS, "Bad arguments" }, { CS_CONFIGURATION_LOCKED, "Configuration locked" }, { CS_IN_USE, "Resource in use" }, diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 201705c51bbd..695baf6cf1fd 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -289,29 +289,29 @@ typedef struct error_info_t { /* Return codes */ #define CS_SUCCESS 0x00 -#define CS_BAD_ADAPTER 0x01 +#define CS_BAD_ADAPTER -ENODEV #define CS_BAD_ATTRIBUTE 0x02 #define CS_BAD_BASE 0x03 -#define CS_BAD_EDC 0x04 +#define CS_BAD_EDC -ENODEV #define CS_BAD_IRQ 0x06 #define CS_BAD_OFFSET 0x07 #define CS_BAD_PAGE 0x08 -#define CS_READ_FAILURE 0x09 +#define CS_READ_FAILURE -EIO #define CS_BAD_SIZE 0x0a -#define CS_BAD_SOCKET 0x0b +#define CS_BAD_SOCKET -EINVAL #define CS_BAD_TYPE 0x0d #define CS_BAD_VCC 0x0e #define CS_BAD_VPP 0x0f -#define CS_BAD_WINDOW 0x11 -#define CS_WRITE_FAILURE 0x12 +#define CS_BAD_WINDOW -ENODEV +#define CS_WRITE_FAILURE -EIO #define CS_NO_CARD 0x14 #define CS_UNSUPPORTED_FUNCTION 0x15 #define CS_UNSUPPORTED_MODE 0x16 -#define CS_BAD_SPEED 0x17 -#define CS_BUSY 0x18 +#define CS_BAD_SPEED -ENODEV +#define CS_BUSY -ENODEV #define CS_GENERAL_FAILURE 0x19 -#define CS_WRITE_PROTECTED 0x1a -#define CS_BAD_ARG_LENGTH 0x1b +#define CS_WRITE_PROTECTED -EPERM +#define CS_BAD_ARG_LENGTH -ENODEV #define CS_BAD_ARGS 0x1c #define CS_CONFIGURATION_LOCKED 0x1d #define CS_IN_USE 0x1e -- cgit v1.2.3 From 1168386aa7d850ead2ae135d5a7949a592c6e9a0 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 10:22:47 +0200 Subject: pcmcia: deprecate CS_OUT_OF_RESOURCE CS_OUT_OF_RESOURCE was almost only used to note -ENOMEM situations. Therefore, use -ENOMEM explicitely, and also print out warnings. CC: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/net/pcmcia/smc91c92_cs.c | 4 ++-- drivers/pcmcia/cistpl.c | 43 +++++++++++++++++++++++++--------------- drivers/pcmcia/pcmcia_resource.c | 2 +- drivers/pcmcia/rsrc_nonstatic.c | 32 ++++++++++++++++++------------ include/pcmcia/cs.h | 2 +- 5 files changed, 50 insertions(+), 33 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 267cbe0afd16..918b4a3eca57 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -491,7 +491,7 @@ static int mhz_mfc_config(struct pcmcia_device *link) cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); if (!cfg_mem) - return CS_OUT_OF_RESOURCE; + return -ENOMEM; link->conf.Attributes |= CONF_ENABLE_SPKR; link->conf.Status = CCSR_AUDIO_ENA; @@ -690,7 +690,7 @@ static int smc_setup(struct pcmcia_device *link) cfg_mem = kmalloc(sizeof(struct smc_cfg_mem), GFP_KERNEL); if (!cfg_mem) - return CS_OUT_OF_RESOURCE; + return -ENOMEM; tuple = &cfg_mem->tuple; parse = &cfg_mem->parse; diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 1a513d9a8612..8d37768d0b46 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -352,7 +352,9 @@ int verify_cis_cache(struct pcmcia_socket *s) buf = kmalloc(256, GFP_KERNEL); if (buf == NULL) - return -1; + dev_printk(KERN_WARNING, &s->dev, + "no memory for verifying CIS\n"); + return -ENOMEM; list_for_each_entry(cis, &s->cis_cache, node) { int len = cis->len; @@ -384,15 +386,19 @@ int verify_cis_cache(struct pcmcia_socket *s) int pcmcia_replace_cis(struct pcmcia_socket *s, const u8 *data, const size_t len) { - if (len > CISTPL_MAX_CIS_SIZE) - return CS_BAD_SIZE; - kfree(s->fake_cis); - s->fake_cis = kmalloc(len, GFP_KERNEL); - if (s->fake_cis == NULL) - return CS_OUT_OF_RESOURCE; - s->fake_cis_len = len; - memcpy(s->fake_cis, data, len); - return 0; + if (len > CISTPL_MAX_CIS_SIZE) { + dev_printk(KERN_WARNING, &s->dev, "replacement CIS too big\n"); + return -EINVAL; + } + kfree(s->fake_cis); + s->fake_cis = kmalloc(len, GFP_KERNEL); + if (s->fake_cis == NULL) { + dev_printk(KERN_WARNING, &s->dev, "no memory to replace CIS\n"); + return -ENOMEM; + } + s->fake_cis_len = len; + memcpy(s->fake_cis, data, len); + return 0; } EXPORT_SYMBOL(pcmcia_replace_cis); @@ -1411,8 +1417,10 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t int ret; buf = kmalloc(256, GFP_KERNEL); - if (buf == NULL) - return CS_OUT_OF_RESOURCE; + if (buf == NULL) { + dev_printk(KERN_WARNING, &s->dev, "no memory to read tuple\n"); + return -ENOMEM; + } tuple.DesiredTuple = code; tuple.Attributes = TUPLE_RETURN_COMMON; ret = pccard_get_first_tuple(s, function, &tuple); @@ -1452,12 +1460,15 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned return CS_BAD_HANDLE; tuple = kmalloc(sizeof(*tuple), GFP_KERNEL); - if (tuple == NULL) - return CS_OUT_OF_RESOURCE; + if (tuple == NULL) { + dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n"); + return -ENOMEM; + } p = kmalloc(sizeof(*p), GFP_KERNEL); if (p == NULL) { - kfree(tuple); - return CS_OUT_OF_RESOURCE; + kfree(tuple); + dev_printk(KERN_WARNING, &s->dev, "no memory to validate CIS\n"); + return -ENOMEM; } count = reserved = 0; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 48e168e8165b..69d87a7e0766 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -780,7 +780,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h for (w = 0; w < MAX_WIN; w++) if (!(s->state & SOCKET_WIN_REQ(w))) break; if (w == MAX_WIN) - return CS_OUT_OF_RESOURCE; + return CS_IN_USE; win = &s->win[w]; win->magic = WINDOW_MAGIC; diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 9d04fb214ec2..0e4141bac7b1 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -122,19 +122,22 @@ static void free_region(struct resource *res) static int add_interval(struct resource_map *map, u_long base, u_long num) { - struct resource_map *p, *q; + struct resource_map *p, *q; - for (p = map; ; p = p->next) { - if ((p != map) && (p->base+p->num-1 >= base)) - return -1; - if ((p->next == map) || (p->next->base > base+num-1)) - break; - } - q = kmalloc(sizeof(struct resource_map), GFP_KERNEL); - if (!q) return CS_OUT_OF_RESOURCE; - q->base = base; q->num = num; - q->next = p->next; p->next = q; - return 0; + for (p = map; ; p = p->next) { + if ((p != map) && (p->base+p->num-1 >= base)) + return -1; + if ((p->next == map) || (p->next->base > base+num-1)) + break; + } + q = kmalloc(sizeof(struct resource_map), GFP_KERNEL); + if (!q) { + printk(KERN_WARNING "out of memory to update resources\n"); + return -ENOMEM; + } + q->base = base; q->num = num; + q->next = p->next; p->next = q; + return 0; } /*====================================================================*/ @@ -166,7 +169,10 @@ static int sub_interval(struct resource_map *map, u_long base, u_long num) } else { /* Split the block into two pieces */ p = kmalloc(sizeof(struct resource_map), GFP_KERNEL); - if (!p) return CS_OUT_OF_RESOURCE; + if (!p) { + printk(KERN_WARNING "out of memory to update resources\n"); + return -ENOMEM; + } p->base = base+num; p->num = q->base+q->num - p->base; q->num = base - q->base; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 695baf6cf1fd..9e6916c1fa81 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -316,7 +316,7 @@ typedef struct error_info_t { #define CS_CONFIGURATION_LOCKED 0x1d #define CS_IN_USE 0x1e #define CS_NO_MORE_ITEMS 0x1f -#define CS_OUT_OF_RESOURCE 0x20 +#define CS_OUT_OF_RESOURCE -ENOMEM #define CS_BAD_HANDLE 0x21 #define CS_BAD_TUPLE 0x40 -- cgit v1.2.3 From de6405e9d1e7530ea33b62e1a3921338f836a046 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 10:47:59 +0200 Subject: pcmcia: deprecate CS_UNSUPPORTED_* CS_UNSUPPORTED_MODE and CS_UNSUPPORTED_FUNCTION were mostly used to denote trying to use PCMCIA functions on CardBus cards. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 2 +- drivers/pcmcia/cs.c | 6 +++--- drivers/pcmcia/ds.c | 3 +-- drivers/pcmcia/pcmcia_ioctl.c | 4 ++-- drivers/pcmcia/pcmcia_resource.c | 8 +++++--- include/pcmcia/cs.h | 4 ++-- 6 files changed, 14 insertions(+), 13 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 8d37768d0b46..71231e8c7edd 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1397,7 +1397,7 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) ret = 0; break; default: - ret = CS_UNSUPPORTED_FUNCTION; + ret = -EINVAL; break; } return ret; diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 037cb0c7e094..e847c3231da8 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -769,7 +769,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) break; } if (skt->state & SOCKET_CARDBUS) { - ret = CS_UNSUPPORTED_FUNCTION; + ret = -EPERM; break; } @@ -810,7 +810,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) break; } if (skt->state & SOCKET_CARDBUS) { - ret = CS_UNSUPPORTED_FUNCTION; + ret = -EPERM; break; } if (skt->callback) { @@ -840,7 +840,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) break; } if (skt->state & SOCKET_CARDBUS) { - ret = CS_UNSUPPORTED_FUNCTION; + ret = -EPERM; break; } ret = socket_resume(skt); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7142fd647e7b..4a658e2b6f21 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -85,8 +85,7 @@ static const lookup_t error_table[] = { { CS_BAD_VCC, "Bad Vcc" }, { CS_BAD_VPP, "Bad Vpp" }, { CS_NO_CARD, "No card present" }, - { CS_UNSUPPORTED_FUNCTION, "Usupported function" }, - { CS_UNSUPPORTED_MODE, "Unsupported mode" }, + { -EINVAL, "Bad parameter" }, { CS_GENERAL_FAILURE, "General failure" }, { CS_BAD_ARGS, "Bad arguments" }, { CS_CONFIGURATION_LOCKED, "Configuration locked" }, diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index ef64ceb5e751..40bef470b47c 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -175,7 +175,7 @@ static inline int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) { static int pcmcia_adjust_resource_info(adjust_t *adj) { struct pcmcia_socket *s; - int ret = CS_UNSUPPORTED_FUNCTION; + int ret = -ENOSYS; unsigned long flags; down_read(&pcmcia_socket_list_rwsem); @@ -975,7 +975,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, err = -ENOSPC; break; case CS_NO_MORE_ITEMS: err = -ENODATA; break; - case CS_UNSUPPORTED_FUNCTION: + case -ENOSYS: err = -ENOSYS; break; default: err = -EIO; break; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 69d87a7e0766..3b8b0e14d8cf 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -475,8 +475,10 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, if (!(s->state & SOCKET_PRESENT)) return CS_NO_CARD; - if (req->IntType & INT_CARDBUS) - return CS_UNSUPPORTED_MODE; + if (req->IntType & INT_CARDBUS) { + ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n"); + return -EINVAL; + } c = p_dev->function_config; if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; @@ -592,7 +594,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) return CS_NO_CARD; if (!req) - return CS_UNSUPPORTED_MODE; + return -EINVAL; c = p_dev->function_config; if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 9e6916c1fa81..6b51d27ddae8 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -305,8 +305,8 @@ typedef struct error_info_t { #define CS_BAD_WINDOW -ENODEV #define CS_WRITE_FAILURE -EIO #define CS_NO_CARD 0x14 -#define CS_UNSUPPORTED_FUNCTION 0x15 -#define CS_UNSUPPORTED_MODE 0x16 +#define CS_UNSUPPORTED_FUNCTION -ENODEV +#define CS_UNSUPPORTED_MODE -ENODEV #define CS_BAD_SPEED -ENODEV #define CS_BUSY -ENODEV #define CS_GENERAL_FAILURE 0x19 -- cgit v1.2.3 From d8b0a49da4f213c637d458319432016f4ea5e12a Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 10:56:13 +0200 Subject: pcmcia: deprecate CS_BAD_VCC and CS_BAD_VPP They were either used to report that changing voltage is not allowed, or that changing voltage failed. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 3 +-- drivers/pcmcia/pcmcia_resource.c | 29 ++++++++++++++++++++--------- include/pcmcia/cs.h | 4 ++-- 3 files changed, 23 insertions(+), 13 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4a658e2b6f21..f6ff1218b3f3 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -82,8 +82,7 @@ static const lookup_t error_table[] = { { CS_BAD_PAGE, "Bad page number" }, { CS_BAD_SIZE, "Bad size" }, { CS_BAD_TYPE, "Bad type" }, - { CS_BAD_VCC, "Bad Vcc" }, - { CS_BAD_VPP, "Bad Vpp" }, + { -EIO, "Input/Output error" }, { CS_NO_CARD, "No card present" }, { -EINVAL, "Bad parameter" }, { CS_GENERAL_FAILURE, "General failure" }, diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 3b8b0e14d8cf..9b61265fe7be 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -291,20 +291,28 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, s->ops->set_socket(s, &s->socket); } - if (mod->Attributes & CONF_VCC_CHANGE_VALID) - return CS_BAD_VCC; + if (mod->Attributes & CONF_VCC_CHANGE_VALID) { + ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); + return -EINVAL; + } /* We only allow changing Vpp1 and Vpp2 to the same value */ if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) && (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { if (mod->Vpp1 != mod->Vpp2) - return CS_BAD_VPP; + ds_dbg(s, 0, "Vpp1 and Vpp2 must be the same\n"); + return -EINVAL; s->socket.Vpp = mod->Vpp1; - if (s->ops->set_socket(s, &s->socket)) - return CS_BAD_VPP; + if (s->ops->set_socket(s, &s->socket)) { + dev_printk(KERN_WARNING, &s->dev, + "Unable to set VPP\n"); + return -EIO; + } } else if ((mod->Attributes & CONF_VPP1_CHANGE_VALID) || - (mod->Attributes & CONF_VPP2_CHANGE_VALID)) - return CS_BAD_VPP; + (mod->Attributes & CONF_VPP2_CHANGE_VALID)) { + ds_dbg(s, 0, "changing Vcc is not allowed at this time\n"); + return -EINVAL; + } if (mod->Attributes & CONF_IO_CHANGE_WIDTH) { pccard_io_map io_off = { 0, 0, 0, 0, 1 }; @@ -485,8 +493,11 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, /* Do power control. We don't allow changes in Vcc. */ s->socket.Vpp = req->Vpp; - if (s->ops->set_socket(s, &s->socket)) - return CS_BAD_VPP; + if (s->ops->set_socket(s, &s->socket)) { + dev_printk(KERN_WARNING, &s->dev, + "Unable to set socket state\n"); + return -EINVAL; + } /* Pick memory or I/O card, DMA mode, interrupt */ c->IntType = req->IntType; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 6b51d27ddae8..5d1ed8ec0376 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -300,8 +300,8 @@ typedef struct error_info_t { #define CS_BAD_SIZE 0x0a #define CS_BAD_SOCKET -EINVAL #define CS_BAD_TYPE 0x0d -#define CS_BAD_VCC 0x0e -#define CS_BAD_VPP 0x0f +#define CS_BAD_VCC -EINVAL +#define CS_BAD_VPP -EINVAL #define CS_BAD_WINDOW -ENODEV #define CS_WRITE_FAILURE -EIO #define CS_NO_CARD 0x14 -- cgit v1.2.3 From 3939c1ef1f954409d1441c09fbc08376655758fe Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:10:56 +0200 Subject: pcmcia: deprecate CS_NO_CARD It means that no card can be detected in the socket, so return -ENODEV Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 4 ++-- drivers/pcmcia/cs.c | 16 ++++++++-------- drivers/pcmcia/ds.c | 2 +- drivers/pcmcia/pcmcia_ioctl.c | 4 ++-- drivers/pcmcia/pcmcia_resource.c | 14 +++++++------- include/pcmcia/cs.h | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 71231e8c7edd..a0eae81731c5 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -427,7 +427,7 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple if (!s) return CS_BAD_HANDLE; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; tuple->TupleLink = tuple->Flags = 0; #ifdef CONFIG_CARDBUS if (s->state & SOCKET_CARDBUS) { @@ -507,7 +507,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ if (!s) return CS_BAD_HANDLE; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; link[1] = tuple->TupleLink; ofs = tuple->CISOffset + tuple->TupleLink; diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index e847c3231da8..15a1203d45fb 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -367,7 +367,7 @@ static int socket_reset(struct pcmcia_socket *skt) skt->ops->get_status(skt, &status); if (!(status & SS_DETECT)) - return CS_NO_CARD; + return -ENODEV; if (status & SS_READY) return 0; @@ -428,14 +428,14 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) skt->ops->get_status(skt, &status); if (!(status & SS_DETECT)) - return CS_NO_CARD; + return -ENODEV; msleep(initial_delay * 10); for (i = 0; i < 100; i++) { skt->ops->get_status(skt, &status); if (!(status & SS_DETECT)) - return CS_NO_CARD; + return -ENODEV; if (!(status & SS_PENDING)) break; @@ -504,7 +504,7 @@ static int socket_insert(struct pcmcia_socket *skt) cs_dbg(skt, 4, "insert\n"); if (!cs_socket_get(skt)) - return CS_NO_CARD; + return -ENODEV; ret = socket_setup(skt, setup_delay); if (ret == 0) { @@ -761,7 +761,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) mutex_lock(&skt->skt_mutex); do { if (!(skt->state & SOCKET_PRESENT)) { - ret = CS_NO_CARD; + ret = -ENODEV; break; } if (skt->state & SOCKET_SUSPEND) { @@ -806,7 +806,7 @@ int pcmcia_suspend_card(struct pcmcia_socket *skt) mutex_lock(&skt->skt_mutex); do { if (!(skt->state & SOCKET_PRESENT)) { - ret = CS_NO_CARD; + ret = -ENODEV; break; } if (skt->state & SOCKET_CARDBUS) { @@ -836,7 +836,7 @@ int pcmcia_resume_card(struct pcmcia_socket *skt) mutex_lock(&skt->skt_mutex); do { if (!(skt->state & SOCKET_PRESENT)) { - ret = CS_NO_CARD; + ret = -ENODEV; break; } if (skt->state & SOCKET_CARDBUS) { @@ -896,7 +896,7 @@ int pcmcia_insert_card(struct pcmcia_socket *skt) ret = -EBUSY; break; } - if (socket_insert(skt) == CS_NO_CARD) { + if (socket_insert(skt) == -ENODEV) { ret = -ENODEV; break; } diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index f6ff1218b3f3..aaac16aedee3 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -83,7 +83,7 @@ static const lookup_t error_table[] = { { CS_BAD_SIZE, "Bad size" }, { CS_BAD_TYPE, "Bad type" }, { -EIO, "Input/Output error" }, - { CS_NO_CARD, "No card present" }, + { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, { CS_GENERAL_FAILURE, "General failure" }, { CS_BAD_ARGS, "Bad arguments" }, diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 40bef470b47c..ed8c4fb1e8c1 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -248,7 +248,7 @@ static int pccard_get_status(struct pcmcia_socket *s, if (s->state & SOCKET_SUSPEND) status->CardState |= CS_EVENT_PM_SUSPEND; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; c = (p_dev) ? p_dev->function_config : NULL; @@ -294,7 +294,7 @@ int pccard_get_configuration_info(struct pcmcia_socket *s, config_t *c; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; #ifdef CONFIG_CARDBUS diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 9b61265fe7be..3e013854ec2d 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -169,7 +169,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, u_char val; if (!p_dev || !p_dev->function_config) - return CS_NO_CARD; + return -EINVAL; s = p_dev->socket; c = p_dev->function_config; @@ -206,7 +206,7 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int w; if (!s || !(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; for (w = idx; w < MAX_WIN; w++) if (s->state & SOCKET_WIN_REQ(w)) break; @@ -276,7 +276,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, c = p_dev->function_config; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; if (!(c->state & CONFIG_LOCKED)) return CS_CONFIGURATION_LOCKED; @@ -481,7 +481,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, pccard_io_map iomap; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV;; if (req->IntType & INT_CARDBUS) { ds_dbg(p_dev->socket, 0, "IntType may not be INT_CARDBUS\n"); @@ -602,7 +602,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) config_t *c; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; if (!req) return -EINVAL; @@ -662,7 +662,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) int type; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; c = p_dev->function_config; if (c->state & CONFIG_LOCKED) return CS_CONFIGURATION_LOCKED; @@ -771,7 +771,7 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h int w; if (!(s->state & SOCKET_PRESENT)) - return CS_NO_CARD; + return -ENODEV; if (req->Attributes & (WIN_PAGED | WIN_SHARED)) return CS_BAD_ATTRIBUTE; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 5d1ed8ec0376..3b4cd51770dd 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -304,7 +304,7 @@ typedef struct error_info_t { #define CS_BAD_VPP -EINVAL #define CS_BAD_WINDOW -ENODEV #define CS_WRITE_FAILURE -EIO -#define CS_NO_CARD 0x14 +#define CS_NO_CARD -ENODEV #define CS_UNSUPPORTED_FUNCTION -ENODEV #define CS_UNSUPPORTED_MODE -ENODEV #define CS_BAD_SPEED -ENODEV -- cgit v1.2.3 From 8567142e87322141f9344d1ab632ccf5190cd0d3 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:15:45 +0200 Subject: pcmcia: deprecate CS_GENERAL_FAILURE It's only used by pcmcia_core when socket-related queries time out. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs.c | 4 ++-- drivers/pcmcia/ds.c | 1 - include/pcmcia/cs.h | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 15a1203d45fb..f9424801b9c8 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -376,7 +376,7 @@ static int socket_reset(struct pcmcia_socket *skt) } cs_err(skt, "time out after reset.\n"); - return CS_GENERAL_FAILURE; + return -ETIMEDOUT; } /* @@ -445,7 +445,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) if (status & SS_PENDING) { cs_err(skt, "voltage interrogation timed out.\n"); - return CS_GENERAL_FAILURE; + return -ETIMEDOUT; } if (status & SS_CARDBUS) { diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index aaac16aedee3..cb500195342f 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -85,7 +85,6 @@ static const lookup_t error_table[] = { { -EIO, "Input/Output error" }, { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, - { CS_GENERAL_FAILURE, "General failure" }, { CS_BAD_ARGS, "Bad arguments" }, { CS_CONFIGURATION_LOCKED, "Configuration locked" }, { CS_IN_USE, "Resource in use" }, diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 3b4cd51770dd..bec295cb94f6 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -309,7 +309,7 @@ typedef struct error_info_t { #define CS_UNSUPPORTED_MODE -ENODEV #define CS_BAD_SPEED -ENODEV #define CS_BUSY -ENODEV -#define CS_GENERAL_FAILURE 0x19 +#define CS_GENERAL_FAILURE -ETIMEDOUT #define CS_WRITE_PROTECTED -EPERM #define CS_BAD_ARG_LENGTH -ENODEV #define CS_BAD_ARGS 0x1c -- cgit v1.2.3 From ffb8da20271bcfb343e299e5f630dab9ccfb6214 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:18:00 +0200 Subject: pcmcia: deprecate CS_BAD_HANDLE CS_BAD_HANDLE means that something went badly wrong: no parameter was passed, or the paramater passed wasn't the correct one. Therefore, replace it with -EINVAL. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 8 ++++---- drivers/pcmcia/ds.c | 1 - drivers/pcmcia/pcmcia_resource.c | 12 ++++++------ include/pcmcia/cs.h | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index a0eae81731c5..660e162c502f 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -425,7 +425,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *t int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple) { if (!s) - return CS_BAD_HANDLE; + return -EINVAL; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; tuple->TupleLink = tuple->Flags = 0; @@ -505,7 +505,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ int ofs, i, attr; if (!s) - return CS_BAD_HANDLE; + return -EINVAL; if (!(s->state & SOCKET_PRESENT)) return -ENODEV; @@ -603,7 +603,7 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple) u_int len; if (!s) - return CS_BAD_HANDLE; + return -EINVAL; if (tuple->TupleLink < tuple->TupleOffset) return CS_NO_MORE_ITEMS; @@ -1457,7 +1457,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int ret, reserved, dev_ok = 0, ident_ok = 0; if (!s) - return CS_BAD_HANDLE; + return -EINVAL; tuple = kmalloc(sizeof(*tuple), GFP_KERNEL); if (tuple == NULL) { diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index cb500195342f..6a37198df9f1 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -90,7 +90,6 @@ static const lookup_t error_table[] = { { CS_IN_USE, "Resource in use" }, { CS_NO_MORE_ITEMS, "No more items" }, { CS_OUT_OF_RESOURCE, "Out of resource" }, - { CS_BAD_HANDLE, "Bad handle" }, { CS_BAD_TUPLE, "Bad CIS tuple" } }; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 3e013854ec2d..55a1238b1c57 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -238,7 +238,7 @@ EXPORT_SYMBOL(pcmcia_get_window); int pcmcia_get_mem_page(window_handle_t win, memreq_t *req) { if ((win == NULL) || (win->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; + return -EINVAL; req->Page = 0; req->CardOffset = win->ctl.card_start; return 0; @@ -250,7 +250,7 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) { struct pcmcia_socket *s; if ((win == NULL) || (win->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; + return -EINVAL; if (req->Page != 0) return CS_BAD_PAGE; s = win->sock; @@ -389,7 +389,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) config_t *c = p_dev->function_config; if (!p_dev->_io ) - return CS_BAD_HANDLE; + return -EINVAL; p_dev->_io = 0; @@ -415,7 +415,7 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) config_t *c= p_dev->function_config; if (!p_dev->_irq) - return CS_BAD_HANDLE; + return -EINVAL; p_dev->_irq = 0; if (c->state & CONFIG_LOCKED) @@ -446,10 +446,10 @@ int pcmcia_release_window(window_handle_t win) struct pcmcia_socket *s; if ((win == NULL) || (win->magic != WINDOW_MAGIC)) - return CS_BAD_HANDLE; + return -EINVAL; s = win->sock; if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) - return CS_BAD_HANDLE; + return -EINVAL; /* Shut down memory window */ win->ctl.flags &= ~MAP_ACTIVE; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index bec295cb94f6..dc5c1eb8ec79 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -317,7 +317,7 @@ typedef struct error_info_t { #define CS_IN_USE 0x1e #define CS_NO_MORE_ITEMS 0x1f #define CS_OUT_OF_RESOURCE -ENOMEM -#define CS_BAD_HANDLE 0x21 +#define CS_BAD_HANDLE -EINVAL #define CS_BAD_TUPLE 0x40 -- cgit v1.2.3 From 943f70f1b5182c5220641ccb7bb905005162e227 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:23:42 +0200 Subject: pcmcia: deprecate CS_CONFIGURATION_LOCKED This error code meant that trying to change the configuration after the initialization phase is forbidden. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 12 ++++++------ include/pcmcia/cs.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 6a37198df9f1..7f38eb06c81e 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -86,7 +86,7 @@ static const lookup_t error_table[] = { { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, { CS_BAD_ARGS, "Bad arguments" }, - { CS_CONFIGURATION_LOCKED, "Configuration locked" }, + { -EACCES, "Configuration locked" }, { CS_IN_USE, "Resource in use" }, { CS_NO_MORE_ITEMS, "No more items" }, { CS_OUT_OF_RESOURCE, "Out of resource" }, diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 55a1238b1c57..0ac3ea92a1c5 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -175,7 +175,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, c = p_dev->function_config; if (!(c->state & CONFIG_LOCKED)) - return CS_CONFIGURATION_LOCKED; + return -EACCES; addr = (c->ConfigBase + reg->Offset) >> 1; @@ -278,7 +278,7 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, if (!(s->state & SOCKET_PRESENT)) return -ENODEV; if (!(c->state & CONFIG_LOCKED)) - return CS_CONFIGURATION_LOCKED; + return -EACCES; if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { if (mod->Attributes & CONF_ENABLE_IRQ) { @@ -419,7 +419,7 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) p_dev->_irq = 0; if (c->state & CONFIG_LOCKED) - return CS_CONFIGURATION_LOCKED; + return -EACCES; if (c->irq.Attributes != req->Attributes) return CS_BAD_ATTRIBUTE; if (s->irq.AssignedIRQ != req->AssignedIRQ) @@ -489,7 +489,7 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, } c = p_dev->function_config; if (c->state & CONFIG_LOCKED) - return CS_CONFIGURATION_LOCKED; + return -EACCES; /* Do power control. We don't allow changes in Vcc. */ s->socket.Vpp = req->Vpp; @@ -608,7 +608,7 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) return -EINVAL; c = p_dev->function_config; if (c->state & CONFIG_LOCKED) - return CS_CONFIGURATION_LOCKED; + return -EACCES; if (c->state & CONFIG_IO_REQ) return CS_IN_USE; if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) @@ -665,7 +665,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) return -ENODEV; c = p_dev->function_config; if (c->state & CONFIG_LOCKED) - return CS_CONFIGURATION_LOCKED; + return -EACCES; if (c->state & CONFIG_IRQ_REQ) return CS_IN_USE; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index dc5c1eb8ec79..a517a5845af0 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -313,7 +313,7 @@ typedef struct error_info_t { #define CS_WRITE_PROTECTED -EPERM #define CS_BAD_ARG_LENGTH -ENODEV #define CS_BAD_ARGS 0x1c -#define CS_CONFIGURATION_LOCKED 0x1d +#define CS_CONFIGURATION_LOCKED -EACCES #define CS_IN_USE 0x1e #define CS_NO_MORE_ITEMS 0x1f #define CS_OUT_OF_RESOURCE -ENOMEM -- cgit v1.2.3 From f958095ef4fc96e978c6eddcaca29100e5276c7f Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:40:19 +0200 Subject: pcmcia: deprecate CS_IN_USE If a resource is already in use, mark it with -EBUSY. Same for cards already asleep. (includes a fix for a bug found by Larry Finger -- thanks!) Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs.c | 6 +++--- drivers/pcmcia/pcmcia_resource.c | 43 +++++++++++++++++++++++++++------------- include/pcmcia/cs.h | 2 +- 3 files changed, 33 insertions(+), 18 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index f9424801b9c8..1c6c8c8f57c9 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -534,7 +534,7 @@ static int socket_insert(struct pcmcia_socket *skt) static int socket_suspend(struct pcmcia_socket *skt) { if (skt->state & SOCKET_SUSPEND) - return CS_IN_USE; + return -EBUSY; send_event(skt, CS_EVENT_PM_SUSPEND, CS_EVENT_PRI_LOW); skt->socket = dead_socket; @@ -556,7 +556,7 @@ static int socket_resume(struct pcmcia_socket *skt) int ret; if (!(skt->state & SOCKET_SUSPEND)) - return CS_IN_USE; + return -EBUSY; skt->socket = dead_socket; skt->ops->init(skt); @@ -765,7 +765,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) break; } if (skt->state & SOCKET_SUSPEND) { - ret = CS_IN_USE; + ret = -EBUSY; break; } if (skt->state & SOCKET_CARDBUS) { diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 0ac3ea92a1c5..670465d4aac2 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -609,23 +609,30 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) c = p_dev->function_config; if (c->state & CONFIG_LOCKED) return -EACCES; - if (c->state & CONFIG_IO_REQ) - return CS_IN_USE; + if (c->state & CONFIG_IO_REQ) { + ds_dbg(s, 0, "IO already configured\n"); + return -EBUSY; + } if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) return CS_BAD_ATTRIBUTE; if ((req->NumPorts2 > 0) && (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) return CS_BAD_ATTRIBUTE; + ds_dbg(s, 1, "trying to allocate resource 1\n"); if (alloc_io_space(s, req->Attributes1, &req->BasePort1, - req->NumPorts1, req->IOAddrLines)) - return CS_IN_USE; + req->NumPorts1, req->IOAddrLines)) { + ds_dbg(s, 0, "allocation of resource 1 failed\n"); + return -EBUSY; + } if (req->NumPorts2) { + ds_dbg(s, 1, "trying to allocate resource 2\n"); if (alloc_io_space(s, req->Attributes2, &req->BasePort2, req->NumPorts2, req->IOAddrLines)) { + ds_dbg(s, 0, "allocation of resource 2 failed\n"); release_io_space(s, req->BasePort1, req->NumPorts1); - return CS_IN_USE; + return -EBUSY; } } @@ -658,7 +665,7 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) { struct pcmcia_socket *s = p_dev->socket; config_t *c; - int ret = CS_IN_USE, irq = 0; + int ret = -EINVAL, irq = 0; int type; if (!(s->state & SOCKET_PRESENT)) @@ -666,8 +673,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) c = p_dev->function_config; if (c->state & CONFIG_LOCKED) return -EACCES; - if (c->state & CONFIG_IRQ_REQ) - return CS_IN_USE; + if (c->state & CONFIG_IRQ_REQ) { + ds_dbg(s, 0, "IRQ already configured\n"); + return -EBUSY; + } /* Decide what type of interrupt we are registering */ type = 0; @@ -730,8 +739,10 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) } if (ret && (req->Attributes & IRQ_HANDLE_PRESENT)) { - if (request_irq(irq, req->Handler, type, p_dev->devname, req->Instance)) - return CS_IN_USE; + ret = request_irq(irq, req->Handler, type, + p_dev->devname, req->Instance); + if (ret) + return ret; } /* Make sure the fact the request type was overridden is passed back */ @@ -792,8 +803,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h /* Allocate system memory window */ for (w = 0; w < MAX_WIN; w++) if (!(s->state & SOCKET_WIN_REQ(w))) break; - if (w == MAX_WIN) - return CS_IN_USE; + if (w == MAX_WIN) { + ds_dbg(s, 0, "all windows are used already\n"); + return -EINVAL; + } win = &s->win[w]; win->magic = WINDOW_MAGIC; @@ -804,8 +817,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h if (!(s->features & SS_CAP_STATIC_MAP)) { win->ctl.res = pcmcia_find_mem_region(req->Base, req->Size, align, (req->Attributes & WIN_MAP_BELOW_1MB), s); - if (!win->ctl.res) - return CS_IN_USE; + if (!win->ctl.res) { + ds_dbg(s, 0, "allocating mem region failed\n"); + return -EINVAL; + } } (*p_dev)->_win |= CLIENT_WIN_REQ(w); diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index a517a5845af0..2dc1411b27c9 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -314,7 +314,7 @@ typedef struct error_info_t { #define CS_BAD_ARG_LENGTH -ENODEV #define CS_BAD_ARGS 0x1c #define CS_CONFIGURATION_LOCKED -EACCES -#define CS_IN_USE 0x1e +#define CS_IN_USE -EBUSY #define CS_NO_MORE_ITEMS 0x1f #define CS_OUT_OF_RESOURCE -ENOMEM #define CS_BAD_HANDLE -EINVAL -- cgit v1.2.3 From 635d19bea0e91df473a81391ec8f3db2d049a218 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:47:29 +0200 Subject: pcmcia: deprecate CS_NO_MORE_ITEMS CS_NO_MORE_ITEMS is returned by the CIS tuple reading and parsing code if the end of a tuple chain is reached. As at least one PCMCIA driver relies on matching this return value, replace it with -ENOSPC which is now uniquely used for this purpose within the in-kernel pcmcia subsystem. CC: Russell King CC: linux-serial@vger.kernel.org CC: Michael Buesch Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 10 +++++----- drivers/pcmcia/ds.c | 2 +- drivers/pcmcia/pcmcia_ioctl.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 2 +- drivers/serial/serial_cs.c | 2 +- drivers/ssb/pcmcia.c | 2 +- include/pcmcia/cs.h | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 660e162c502f..a59e09dd8557 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -450,7 +450,7 @@ int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple if (pccard_get_next_tuple(s, function, tuple) == 0) { tuple->DesiredTuple = CISTPL_LINKTARGET; if (pccard_get_next_tuple(s, function, tuple) != 0) - return CS_NO_MORE_ITEMS; + return -ENOSPC; } else tuple->CISOffset = tuple->TupleLink = 0; tuple->DesiredTuple = req; @@ -526,7 +526,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ /* End of chain? Follow long link if possible */ if (link[0] == CISTPL_END) { if ((ofs = follow_link(s, tuple)) < 0) - return CS_NO_MORE_ITEMS; + return -ENOSPC; attr = SPACE(tuple->Flags); read_cis_cache(s, attr, ofs, 2, link); } @@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ } if (i == MAX_TUPLES) { cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); - return CS_NO_MORE_ITEMS; + return -ENOSPC; } tuple->TupleCode = link[0]; @@ -606,7 +606,7 @@ int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple) return -EINVAL; if (tuple->TupleLink < tuple->TupleOffset) - return CS_NO_MORE_ITEMS; + return -ENOSPC; len = tuple->TupleLink - tuple->TupleOffset; tuple->TupleDataLen = tuple->TupleLink; if (len == 0) @@ -1490,7 +1490,7 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned cards have only a broken VERS_2 tuple; hence the bogus test. */ if ((pccard_read_tuple(s, function, CISTPL_MANFID, p) == 0) || (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || - (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != CS_NO_MORE_ITEMS)) + (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) ident_ok++; if (!dev_ok && !ident_ok) diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 7f38eb06c81e..591d9627bb2a 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -88,7 +88,7 @@ static const lookup_t error_table[] = { { CS_BAD_ARGS, "Bad arguments" }, { -EACCES, "Configuration locked" }, { CS_IN_USE, "Resource in use" }, - { CS_NO_MORE_ITEMS, "No more items" }, + { -ENOSPC, "No more items" }, { CS_OUT_OF_RESOURCE, "Out of resource" }, { CS_BAD_TUPLE, "Bad CIS tuple" } }; diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index ed8c4fb1e8c1..a6289e5a75e1 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -973,7 +973,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, err = -EBUSY; break; case CS_OUT_OF_RESOURCE: err = -ENOSPC; break; - case CS_NO_MORE_ITEMS: + case -ENOSPC: err = -ENODATA; break; case -ENOSYS: err = -ENOSYS; break; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 670465d4aac2..8f2c805e793b 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -211,7 +211,7 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, if (s->state & SOCKET_WIN_REQ(w)) break; if (w == MAX_WIN) - return CS_NO_MORE_ITEMS; + return -EINVAL; win = &s->win[w]; req->Base = win->ctl.res->start; req->Size = win->ctl.res->end - win->ctl.res->start + 1; diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index ea7e3c0e02d9..dbb3bf3065fa 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -432,7 +432,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) int i; i = pcmcia_get_first_tuple(handle, tuple); if (i != 0) - return CS_NO_MORE_ITEMS; + return i; i = pcmcia_get_tuple_data(handle, tuple); if (i != 0) return i; diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c index 96993080c7d1..fbfadbac67e8 100644 --- a/drivers/ssb/pcmcia.c +++ b/drivers/ssb/pcmcia.c @@ -733,7 +733,7 @@ int ssb_pcmcia_get_invariants(struct ssb_bus *bus, break; } res = pcmcia_get_next_tuple(bus->host_pcmcia, &tuple); - if (res == CS_NO_MORE_ITEMS) + if (res == -ENOSPC) break; GOTO_ERROR_ON(res != 0, "VEN next tpl"); res = pcmcia_get_tuple_data(bus->host_pcmcia, &tuple); diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 2dc1411b27c9..20440defd1d0 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -315,7 +315,7 @@ typedef struct error_info_t { #define CS_BAD_ARGS 0x1c #define CS_CONFIGURATION_LOCKED -EACCES #define CS_IN_USE -EBUSY -#define CS_NO_MORE_ITEMS 0x1f +#define CS_NO_MORE_ITEMS -ENOSPC #define CS_OUT_OF_RESOURCE -ENOMEM #define CS_BAD_HANDLE -EINVAL -- cgit v1.2.3 From 610e23749e87920136e1a221266a43cb7e3823f1 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 11:58:53 +0200 Subject: pcmcia: deprecate CS_BAD_ATTRIBUTE, CS_BAD_TYPE and CS_BAD_PAGE CS_BAD_TYPE was only used in cs.c and already properly annotated by error messages. CS_BAD_ATTRIBUTE and CS_BAD_PAGE mean a badly written driver, so ds_dbg() output and -EINVAL seems to be enough. (includes bugfix from and Signed-off-by: Harvey Harrison ) Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs.c | 6 +++--- drivers/pcmcia/ds.c | 9 +++------ drivers/pcmcia/pcmcia_ioctl.c | 16 ++++++++-------- drivers/pcmcia/pcmcia_resource.c | 30 ++++++++++++++++++++---------- include/pcmcia/cs.h | 6 +++--- 5 files changed, 37 insertions(+), 30 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 1c6c8c8f57c9..48386f31e610 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -451,7 +451,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) if (status & SS_CARDBUS) { if (!(skt->features & SS_CAP_CARDBUS)) { cs_err(skt, "cardbus cards are not supported.\n"); - return CS_BAD_TYPE; + return -EINVAL; } skt->state |= SOCKET_CARDBUS; } @@ -465,7 +465,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) skt->socket.Vcc = skt->socket.Vpp = 50; else { cs_err(skt, "unsupported voltage key.\n"); - return CS_BAD_TYPE; + return -EIO; } if (skt->power_hook) @@ -482,7 +482,7 @@ static int socket_setup(struct pcmcia_socket *skt, int initial_delay) skt->ops->get_status(skt, &status); if (!(status & SS_POWERON)) { cs_err(skt, "unable to apply power.\n"); - return CS_BAD_TYPE; + return -EIO; } status = socket_reset(skt); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 591d9627bb2a..4092a5976e62 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -74,22 +74,19 @@ typedef struct lookup_t { } lookup_t; static const lookup_t error_table[] = { - { CS_SUCCESS, "Operation succeeded" }, - { CS_BAD_ATTRIBUTE, "Bad attribute", }, + { 0, "Operation succeeded" }, { CS_BAD_BASE, "Bad base address" }, { CS_BAD_IRQ, "Bad IRQ" }, { CS_BAD_OFFSET, "Bad offset" }, - { CS_BAD_PAGE, "Bad page number" }, { CS_BAD_SIZE, "Bad size" }, - { CS_BAD_TYPE, "Bad type" }, { -EIO, "Input/Output error" }, { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, { CS_BAD_ARGS, "Bad arguments" }, { -EACCES, "Configuration locked" }, - { CS_IN_USE, "Resource in use" }, + { -EBUSY, "Resource in use" }, { -ENOSPC, "No more items" }, - { CS_OUT_OF_RESOURCE, "Out of resource" }, + { -ENOMEM, "Out of resource" }, { CS_BAD_TUPLE, "Bad CIS tuple" } }; diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index a6289e5a75e1..e27c71ebfda2 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -964,19 +964,19 @@ static int ds_ioctl(struct inode * inode, struct file * file, if ((err == 0) && (ret != 0)) { ds_dbg(2, "ds_ioctl: ret = %d\n", ret); switch (ret) { - case CS_BAD_SOCKET: case CS_NO_CARD: - err = -ENODEV; break; - case CS_BAD_ARGS: case CS_BAD_ATTRIBUTE: case CS_BAD_IRQ: + case -ENODEV: + case -EINVAL: + case -EBUSY: + case -ENOSYS: + err = ret; + break; + case CS_BAD_ARGS: case CS_BAD_IRQ: case CS_BAD_TUPLE: err = -EINVAL; break; - case CS_IN_USE: - err = -EBUSY; break; - case CS_OUT_OF_RESOURCE: + case -ENOMEM: err = -ENOSPC; break; case -ENOSPC: err = -ENODATA; break; - case -ENOSYS: - err = -ENOSYS; break; default: err = -EIO; break; } diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 8f2c805e793b..35a61577ae4e 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -251,9 +251,11 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) struct pcmcia_socket *s; if ((win == NULL) || (win->magic != WINDOW_MAGIC)) return -EINVAL; - if (req->Page != 0) - return CS_BAD_PAGE; s = win->sock; + if (req->Page != 0) { + ds_dbg(s, 0, "failure: requested page is zero\n"); + return -EINVAL; + } win->ctl.card_start = req->CardOffset; if (s->ops->set_mem_map(s, &win->ctl) != 0) return CS_BAD_OFFSET; @@ -420,8 +422,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) if (c->state & CONFIG_LOCKED) return -EACCES; - if (c->irq.Attributes != req->Attributes) - return CS_BAD_ATTRIBUTE; + if (c->irq.Attributes != req->Attributes) { + ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); + return -EINVAL; + } if (s->irq.AssignedIRQ != req->AssignedIRQ) return CS_BAD_IRQ; if (--s->irq.Config == 0) { @@ -613,11 +617,15 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) ds_dbg(s, 0, "IO already configured\n"); return -EBUSY; } - if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) - return CS_BAD_ATTRIBUTE; + if (req->Attributes1 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS)) { + ds_dbg(s, 0, "bad attribute setting for IO region 1\n"); + return -EINVAL; + } if ((req->NumPorts2 > 0) && - (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) - return CS_BAD_ATTRIBUTE; + (req->Attributes2 & (IO_SHARED | IO_FORCE_ALIAS_ACCESS))) { + ds_dbg(s, 0, "bad attribute setting for IO region 2\n"); + return -EINVAL; + } ds_dbg(s, 1, "trying to allocate resource 1\n"); if (alloc_io_space(s, req->Attributes1, &req->BasePort1, @@ -783,8 +791,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h if (!(s->state & SOCKET_PRESENT)) return -ENODEV; - if (req->Attributes & (WIN_PAGED | WIN_SHARED)) - return CS_BAD_ATTRIBUTE; + if (req->Attributes & (WIN_PAGED | WIN_SHARED)) { + ds_dbg(s, 0, "bad attribute setting for iomem region\n"); + return -EINVAL; + } /* Window size defaults to smallest available */ if (req->Size == 0) diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 20440defd1d0..70c32e97b492 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -290,16 +290,16 @@ typedef struct error_info_t { /* Return codes */ #define CS_SUCCESS 0x00 #define CS_BAD_ADAPTER -ENODEV -#define CS_BAD_ATTRIBUTE 0x02 +#define CS_BAD_ATTRIBUTE -EINVAL #define CS_BAD_BASE 0x03 #define CS_BAD_EDC -ENODEV #define CS_BAD_IRQ 0x06 #define CS_BAD_OFFSET 0x07 -#define CS_BAD_PAGE 0x08 +#define CS_BAD_PAGE -EINVAL #define CS_READ_FAILURE -EIO #define CS_BAD_SIZE 0x0a #define CS_BAD_SOCKET -EINVAL -#define CS_BAD_TYPE 0x0d +#define CS_BAD_TYPE -EINVAL #define CS_BAD_VCC -EINVAL #define CS_BAD_VPP -EINVAL #define CS_BAD_WINDOW -ENODEV -- cgit v1.2.3 From 69ba44331e81e4a15b504175ec70b7b4b4e5a8b9 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 12:10:53 +0200 Subject: pcmcia: deprecate CS_BAD_BASE, CS_BAD_IRQ, CS_BAD_OFFSET and CS_BAD_SIZE These four error values mostly mean a badly written driver, so ds_dbg() output and -EINVAL seems to be enough. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 4 ---- drivers/pcmcia/pcmcia_ioctl.c | 5 ++--- drivers/pcmcia/pcmcia_resource.c | 24 ++++++++++++++++-------- include/pcmcia/cs.h | 8 ++++---- 4 files changed, 22 insertions(+), 19 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 4092a5976e62..3ccf4091e877 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -75,10 +75,6 @@ typedef struct lookup_t { static const lookup_t error_table[] = { { 0, "Operation succeeded" }, - { CS_BAD_BASE, "Bad base address" }, - { CS_BAD_IRQ, "Bad IRQ" }, - { CS_BAD_OFFSET, "Bad offset" }, - { CS_BAD_SIZE, "Bad size" }, { -EIO, "Input/Output error" }, { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index e27c71ebfda2..99563134ac0f 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -149,7 +149,7 @@ static int adjust_irq(struct pcmcia_socket *s, adjust_t *adj) irq = adj->resource.irq.IRQ; if ((irq < 0) || (irq > 15)) - return CS_BAD_IRQ; + return -EINVAL; if (adj->Action != REMOVE_MANAGED_RESOURCE) return 0; @@ -970,8 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, case -ENOSYS: err = ret; break; - case CS_BAD_ARGS: case CS_BAD_IRQ: - case CS_BAD_TUPLE: + case CS_BAD_ARGS: case CS_BAD_TUPLE: err = -EINVAL; break; case -ENOMEM: err = -ENOSPC; break; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 35a61577ae4e..fee57139a96f 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -257,8 +257,10 @@ int pcmcia_map_mem_page(window_handle_t win, memreq_t *req) return -EINVAL; } win->ctl.card_start = req->CardOffset; - if (s->ops->set_mem_map(s, &win->ctl) != 0) - return CS_BAD_OFFSET; + if (s->ops->set_mem_map(s, &win->ctl) != 0) { + ds_dbg(s, 0, "failed to set_mem_map\n"); + return -EIO; + } return 0; } /* pcmcia_map_mem_page */ EXPORT_SYMBOL(pcmcia_map_mem_page); @@ -426,8 +428,10 @@ static int pcmcia_release_irq(struct pcmcia_device *p_dev, irq_req_t *req) ds_dbg(s, 0, "IRQ attributes must match assigned ones\n"); return -EINVAL; } - if (s->irq.AssignedIRQ != req->AssignedIRQ) - return CS_BAD_IRQ; + if (s->irq.AssignedIRQ != req->AssignedIRQ) { + ds_dbg(s, 0, "IRQ must match assigned one\n"); + return -EINVAL; + } if (--s->irq.Config == 0) { c->state &= ~CONFIG_IRQ_REQ; s->irq.AssignedIRQ = 0; @@ -802,11 +806,15 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h align = (((s->features & SS_CAP_MEM_ALIGN) || (req->Attributes & WIN_STRICT_ALIGN)) ? req->Size : s->map_size); - if (req->Size & (s->map_size-1)) - return CS_BAD_SIZE; + if (req->Size & (s->map_size-1)) { + ds_dbg(s, 0, "invalid map size\n"); + return -EINVAL; + } if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) || - (req->Base & (align-1))) - return CS_BAD_BASE; + (req->Base & (align-1))) { + ds_dbg(s, 0, "invalid base address\n"); + return -EINVAL; + } if (req->Base) align = 0; diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 70c32e97b492..4951eb94493a 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -291,13 +291,13 @@ typedef struct error_info_t { #define CS_SUCCESS 0x00 #define CS_BAD_ADAPTER -ENODEV #define CS_BAD_ATTRIBUTE -EINVAL -#define CS_BAD_BASE 0x03 +#define CS_BAD_BASE -EINVAL #define CS_BAD_EDC -ENODEV -#define CS_BAD_IRQ 0x06 -#define CS_BAD_OFFSET 0x07 +#define CS_BAD_IRQ -EINVAL +#define CS_BAD_OFFSET -EIO #define CS_BAD_PAGE -EINVAL #define CS_READ_FAILURE -EIO -#define CS_BAD_SIZE 0x0a +#define CS_BAD_SIZE -EINVAL #define CS_BAD_SOCKET -EINVAL #define CS_BAD_TYPE -EINVAL #define CS_BAD_VCC -EINVAL -- cgit v1.2.3 From 926c5402c287f6d911f7d00f936f09ea00880527 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 12:15:11 +0200 Subject: pcmcia: deprecate CS_BAD_ARGS CS_BAD_ARGS mean a badly written driver or invalid userspace ioctl access, so translate that to -EINVAL. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 1 - drivers/pcmcia/pcmcia_ioctl.c | 8 ++++---- drivers/pcmcia/pcmcia_resource.c | 10 ++++++---- include/pcmcia/cs.h | 4 ++-- 4 files changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 3ccf4091e877..5b24938ca154 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -78,7 +78,6 @@ static const lookup_t error_table[] = { { -EIO, "Input/Output error" }, { -ENODEV, "No card present" }, { -EINVAL, "Bad parameter" }, - { CS_BAD_ARGS, "Bad arguments" }, { -EACCES, "Configuration locked" }, { -EBUSY, "Resource in use" }, { -ENOSPC, "No more items" }, diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 99563134ac0f..f2352c227570 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -836,7 +836,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, case DS_GET_CONFIGURATION_INFO: if (buf->config.Function && (buf->config.Function >= s->functions)) - ret = CS_BAD_ARGS; + ret = -EINVAL; else { struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->config.Function); ret = pccard_get_configuration_info(s, p_dev, &buf->config); @@ -867,7 +867,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, case DS_GET_STATUS: if (buf->status.Function && (buf->status.Function >= s->functions)) - ret = CS_BAD_ARGS; + ret = -EINVAL; else { struct pcmcia_device *p_dev = get_pcmcia_device(s, buf->status.Function); ret = pccard_get_status(s, p_dev, &buf->status); @@ -898,7 +898,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, goto free_out; } - ret = CS_BAD_ARGS; + ret = -EINVAL; if (!(buf->conf_reg.Function && (buf->conf_reg.Function >= s->functions))) { @@ -970,7 +970,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, case -ENOSYS: err = ret; break; - case CS_BAD_ARGS: case CS_BAD_TUPLE: + case CS_BAD_TUPLE: err = -EINVAL; break; case -ENOMEM: err = -ENOSPC; break; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index fee57139a96f..de13c424101c 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -189,7 +189,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, pcmcia_write_cis_mem(s, 1, addr, 1, &val); break; default: - return CS_BAD_ARGS; + return -EINVAL; break; } return 0; @@ -401,7 +401,7 @@ static int pcmcia_release_io(struct pcmcia_device *p_dev, io_req_t *req) (c->io.NumPorts1 != req->NumPorts1) || (c->io.BasePort2 != req->BasePort2) || (c->io.NumPorts2 != req->NumPorts2)) - return CS_BAD_ARGS; + return -EINVAL; c->state &= ~CONFIG_IO_REQ; @@ -855,8 +855,10 @@ int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_h if (req->Attributes & WIN_USE_WAIT) win->ctl.flags |= MAP_USE_WAIT; win->ctl.card_start = 0; - if (s->ops->set_mem_map(s, &win->ctl) != 0) - return CS_BAD_ARGS; + if (s->ops->set_mem_map(s, &win->ctl) != 0) { + ds_dbg(s, 0, "failed to set memory mapping\n"); + return -EIO; + } s->state |= SOCKET_WIN_REQ(w); /* Return window handle */ diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 4951eb94493a..56f94e297500 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -294,7 +294,7 @@ typedef struct error_info_t { #define CS_BAD_BASE -EINVAL #define CS_BAD_EDC -ENODEV #define CS_BAD_IRQ -EINVAL -#define CS_BAD_OFFSET -EIO +#define CS_BAD_OFFSET -EINVAL #define CS_BAD_PAGE -EINVAL #define CS_READ_FAILURE -EIO #define CS_BAD_SIZE -EINVAL @@ -312,7 +312,7 @@ typedef struct error_info_t { #define CS_GENERAL_FAILURE -ETIMEDOUT #define CS_WRITE_PROTECTED -EPERM #define CS_BAD_ARG_LENGTH -ENODEV -#define CS_BAD_ARGS 0x1c +#define CS_BAD_ARGS -EINVAL #define CS_CONFIGURATION_LOCKED -EACCES #define CS_IN_USE -EBUSY #define CS_NO_MORE_ITEMS -ENOSPC -- cgit v1.2.3 From 3f9c5f4cb7e00d424a56a6431e9c98b3b17851e4 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 12:22:40 +0200 Subject: pcmcia: deprecate CS_BAD_TUPLE CS_BAD_TUPLE was used to denote a bad tuple being passed to the parse function. Therefore, replace it with -EINVAL and a verbose message. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 144 +++++++++++++++++++++++++++--------------- drivers/pcmcia/cs_internal.h | 6 ++ drivers/pcmcia/ds.c | 1 - drivers/pcmcia/pcmcia_ioctl.c | 2 - include/pcmcia/cs.h | 2 +- 5 files changed, 99 insertions(+), 56 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index a59e09dd8557..772fc96d5ec3 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -647,22 +647,28 @@ static int parse_device(tuple_t *tuple, cistpl_device_t *device) case 3: device->dev[i].speed = 150; break; case 4: device->dev[i].speed = 100; break; case 7: - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; device->dev[i].speed = SPEED_CVT(*p); while (*p & 0x80) - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; break; default: - return CS_BAD_TUPLE; + return -EINVAL; } - if (++p == q) return CS_BAD_TUPLE; - if (*p == 0xff) break; + if (++p == q) + return -EINVAL; + if (*p == 0xff) + break; scale = *p & 7; - if (scale == 7) return CS_BAD_TUPLE; + if (scale == 7) + return -EINVAL; device->dev[i].size = ((*p >> 3) + 1) * (512 << (scale*2)); device->ndev++; - if (++p == q) break; + if (++p == q) + break; } return 0; @@ -674,7 +680,7 @@ static int parse_checksum(tuple_t *tuple, cistpl_checksum_t *csum) { u_char *p; if (tuple->TupleDataLen < 5) - return CS_BAD_TUPLE; + return -EINVAL; p = (u_char *) tuple->TupleData; csum->addr = tuple->CISOffset + get_unaligned_le16(p) - 2; csum->len = get_unaligned_le16(p + 2); @@ -687,7 +693,7 @@ static int parse_checksum(tuple_t *tuple, cistpl_checksum_t *csum) static int parse_longlink(tuple_t *tuple, cistpl_longlink_t *link) { if (tuple->TupleDataLen < 4) - return CS_BAD_TUPLE; + return -EINVAL; link->addr = get_unaligned_le32(tuple->TupleData); return 0; } @@ -704,7 +710,7 @@ static int parse_longlink_mfc(tuple_t *tuple, link->nfn = *p; p++; if (tuple->TupleDataLen <= link->nfn*5) - return CS_BAD_TUPLE; + return -EINVAL; for (i = 0; i < link->nfn; i++) { link->fn[i].space = *p; p++; link->fn[i].addr = get_unaligned_le32(p); @@ -720,16 +726,19 @@ static int parse_strings(u_char *p, u_char *q, int max, { int i, j, ns; - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; ns = 0; j = 0; for (i = 0; i < max; i++) { - if (*p == 0xff) break; + if (*p == 0xff) + break; ofs[i] = j; ns++; for (;;) { s[j++] = (*p == 0xff) ? '\0' : *p; if ((*p == '\0') || (*p == 0xff)) break; - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; } if ((*p == 0xff) || (++p == q)) break; } @@ -737,7 +746,7 @@ static int parse_strings(u_char *p, u_char *q, int max, *found = ns; return 0; } else { - return (ns == max) ? 0 : CS_BAD_TUPLE; + return (ns == max) ? 0 : -EINVAL; } } @@ -752,7 +761,8 @@ static int parse_vers_1(tuple_t *tuple, cistpl_vers_1_t *vers_1) vers_1->major = *p; p++; vers_1->minor = *p; p++; - if (p >= q) return CS_BAD_TUPLE; + if (p >= q) + return -EINVAL; return parse_strings(p, q, CISTPL_VERS_1_MAX_PROD_STRINGS, vers_1->str, vers_1->ofs, &vers_1->ns); @@ -796,7 +806,7 @@ static int parse_jedec(tuple_t *tuple, cistpl_jedec_t *jedec) static int parse_manfid(tuple_t *tuple, cistpl_manfid_t *m) { if (tuple->TupleDataLen < 4) - return CS_BAD_TUPLE; + return -EINVAL; m->manf = get_unaligned_le16(tuple->TupleData); m->card = get_unaligned_le16(tuple->TupleData + 2); return 0; @@ -808,7 +818,7 @@ static int parse_funcid(tuple_t *tuple, cistpl_funcid_t *f) { u_char *p; if (tuple->TupleDataLen < 2) - return CS_BAD_TUPLE; + return -EINVAL; p = (u_char *)tuple->TupleData; f->func = p[0]; f->sysinit = p[1]; @@ -822,7 +832,7 @@ static int parse_funce(tuple_t *tuple, cistpl_funce_t *f) u_char *p; int i; if (tuple->TupleDataLen < 1) - return CS_BAD_TUPLE; + return -EINVAL; p = (u_char *)tuple->TupleData; f->type = p[0]; for (i = 1; i < tuple->TupleDataLen; i++) @@ -841,7 +851,7 @@ static int parse_config(tuple_t *tuple, cistpl_config_t *config) rasz = *p & 0x03; rmsz = (*p & 0x3c) >> 2; if (tuple->TupleDataLen < rasz+rmsz+4) - return CS_BAD_TUPLE; + return -EINVAL; config->last_idx = *(++p); p++; config->base = 0; @@ -1009,10 +1019,12 @@ static u_char *parse_mem(u_char *p, u_char *q, cistpl_mem_t *mem) static u_char *parse_irq(u_char *p, u_char *q, cistpl_irq_t *irq) { - if (p == q) return NULL; + if (p == q) + return NULL; irq->IRQInfo1 = *p; p++; if (irq->IRQInfo1 & IRQ_INFO2_VALID) { - if (p+2 > q) return NULL; + if (p+2 > q) + return NULL; irq->IRQInfo2 = (p[1]<<8) + p[0]; p += 2; } @@ -1033,7 +1045,8 @@ static int parse_cftable_entry(tuple_t *tuple, if (*p & 0x40) entry->flags |= CISTPL_CFTABLE_DEFAULT; if (*p & 0x80) { - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; if (*p & 0x10) entry->flags |= CISTPL_CFTABLE_BVDS; if (*p & 0x20) @@ -1047,30 +1060,35 @@ static int parse_cftable_entry(tuple_t *tuple, entry->interface = 0; /* Process optional features */ - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; features = *p; p++; /* Power options */ if ((features & 3) > 0) { p = parse_power(p, q, &entry->vcc); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vcc.present = 0; if ((features & 3) > 1) { p = parse_power(p, q, &entry->vpp1); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vpp1.present = 0; if ((features & 3) > 2) { p = parse_power(p, q, &entry->vpp2); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vpp2.present = 0; /* Timing options */ if (features & 0x04) { p = parse_timing(p, q, &entry->timing); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else { entry->timing.wait = 0; entry->timing.ready = 0; @@ -1080,14 +1098,16 @@ static int parse_cftable_entry(tuple_t *tuple, /* I/O window options */ if (features & 0x08) { p = parse_io(p, q, &entry->io); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->io.nwin = 0; /* Interrupt options */ if (features & 0x10) { p = parse_irq(p, q, &entry->irq); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->irq.IRQInfo1 = 0; @@ -1101,7 +1121,8 @@ static int parse_cftable_entry(tuple_t *tuple, entry->mem.win[0].card_addr = 0; entry->mem.win[0].host_addr = 0; p += 2; - if (p > q) return CS_BAD_TUPLE; + if (p > q) + return -EINVAL; break; case 0x40: entry->mem.nwin = 1; @@ -1109,20 +1130,24 @@ static int parse_cftable_entry(tuple_t *tuple, entry->mem.win[0].card_addr = get_unaligned_le16(p + 2) << 8; entry->mem.win[0].host_addr = 0; p += 4; - if (p > q) return CS_BAD_TUPLE; + if (p > q) + return -EINVAL; break; case 0x60: p = parse_mem(p, q, &entry->mem); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; break; } /* Misc features */ if (features & 0x80) { - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; entry->flags |= (*p << 8); while (*p & 0x80) - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; p++; } @@ -1139,7 +1164,7 @@ static int parse_bar(tuple_t *tuple, cistpl_bar_t *bar) { u_char *p; if (tuple->TupleDataLen < 6) - return CS_BAD_TUPLE; + return -EINVAL; p = (u_char *)tuple->TupleData; bar->attr = *p; p += 2; @@ -1153,7 +1178,7 @@ static int parse_config_cb(tuple_t *tuple, cistpl_config_t *config) p = (u_char *)tuple->TupleData; if ((*p != 3) || (tuple->TupleDataLen < 6)) - return CS_BAD_TUPLE; + return -EINVAL; config->last_idx = *(++p); p++; config->base = get_unaligned_le32(p); @@ -1174,29 +1199,34 @@ static int parse_cftable_entry_cb(tuple_t *tuple, entry->flags |= CISTPL_CFTABLE_DEFAULT; /* Process optional features */ - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; features = *p; p++; /* Power options */ if ((features & 3) > 0) { p = parse_power(p, q, &entry->vcc); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vcc.present = 0; if ((features & 3) > 1) { p = parse_power(p, q, &entry->vpp1); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vpp1.present = 0; if ((features & 3) > 2) { p = parse_power(p, q, &entry->vpp2); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->vpp2.present = 0; /* I/O window options */ if (features & 0x08) { - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; entry->io = *p; p++; } else entry->io = 0; @@ -1204,26 +1234,31 @@ static int parse_cftable_entry_cb(tuple_t *tuple, /* Interrupt options */ if (features & 0x10) { p = parse_irq(p, q, &entry->irq); - if (p == NULL) return CS_BAD_TUPLE; + if (p == NULL) + return -EINVAL; } else entry->irq.IRQInfo1 = 0; if (features & 0x20) { - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; entry->mem = *p; p++; } else entry->mem = 0; /* Misc features */ if (features & 0x80) { - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; entry->flags |= (*p << 8); if (*p & 0x80) { - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; entry->flags |= (*p << 16); } while (*p & 0x80) - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; p++; } @@ -1265,7 +1300,7 @@ static int parse_vers_2(tuple_t *tuple, cistpl_vers_2_t *v2) u_char *p, *q; if (tuple->TupleDataLen < 10) - return CS_BAD_TUPLE; + return -EINVAL; p = tuple->TupleData; q = p + tuple->TupleDataLen; @@ -1289,13 +1324,16 @@ static int parse_org(tuple_t *tuple, cistpl_org_t *org) p = tuple->TupleData; q = p + tuple->TupleDataLen; - if (p == q) return CS_BAD_TUPLE; + if (p == q) + return -EINVAL; org->data_org = *p; - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; for (i = 0; i < 30; i++) { org->desc[i] = *p; if (*p == '\0') break; - if (++p == q) return CS_BAD_TUPLE; + if (++p == q) + return -EINVAL; } return 0; } @@ -1307,7 +1345,7 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) u_char *p; if (tuple->TupleDataLen < 10) - return CS_BAD_TUPLE; + return -EINVAL; p = tuple->TupleData; @@ -1326,7 +1364,7 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) int ret = 0; if (tuple->TupleDataLen > tuple->TupleDataMax) - return CS_BAD_TUPLE; + return -EINVAL; switch (tuple->TupleCode) { case CISTPL_DEVICE: case CISTPL_DEVICE_A: @@ -1400,6 +1438,8 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) ret = -EINVAL; break; } + if (ret) + __cs_dbg(0, "parse_tuple failed %d\n", ret); return ret; } EXPORT_SYMBOL(pccard_parse_tuple); diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 384a76bd38eb..3fcdf4fbca0e 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -137,9 +137,15 @@ extern int cs_debug_level(int); dev_printk(KERN_DEBUG, &skt->dev, \ "cs: " fmt, ## arg); \ } while (0) +#define __cs_dbg(lvl, fmt, arg...) do { \ + if (cs_debug_level(lvl)) \ + printk(KERN_DEBUG \ + "cs: " fmt, ## arg); \ +} while (0) #else #define cs_dbg(skt, lvl, fmt, arg...) do { } while (0) +#define __cs_dbg(lvl, fmt, arg...) do { } while (0) #endif #define cs_err(skt, fmt, arg...) \ diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 5b24938ca154..55a46af33ca4 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -82,7 +82,6 @@ static const lookup_t error_table[] = { { -EBUSY, "Resource in use" }, { -ENOSPC, "No more items" }, { -ENOMEM, "Out of resource" }, - { CS_BAD_TUPLE, "Bad CIS tuple" } }; diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index f2352c227570..d4c3f9aa3d83 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -970,8 +970,6 @@ static int ds_ioctl(struct inode * inode, struct file * file, case -ENOSYS: err = ret; break; - case CS_BAD_TUPLE: - err = -EINVAL; break; case -ENOMEM: err = -ENOSPC; break; case -ENOSPC: diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 56f94e297500..d672fdefdf22 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -319,7 +319,7 @@ typedef struct error_info_t { #define CS_OUT_OF_RESOURCE -ENOMEM #define CS_BAD_HANDLE -EINVAL -#define CS_BAD_TUPLE 0x40 +#define CS_BAD_TUPLE -EINVAL #ifdef __KERNEL__ -- cgit v1.2.3 From 79ba6757277ea7228480bee4c56c0f028f806b91 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 3 Aug 2008 14:03:07 +0200 Subject: pcmcia: use dev_printk for cs_error() Use dev_printk() in cs_error()-based error reporting. While this function-turned-macro will hopefully go away soon, using dev_printk simplifies the code much. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c | 50 ++++++++++++++++++-------------------------------- include/pcmcia/ds.h | 13 ++++++++++++- 2 files changed, 30 insertions(+), 33 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 55a46af33ca4..e0624a8fb6e3 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -69,8 +69,8 @@ spinlock_t pcmcia_dev_list_lock; /* String tables for error messages */ typedef struct lookup_t { - int key; - char *msg; + const int key; + const char *msg; } lookup_t; static const lookup_t error_table[] = { @@ -137,46 +137,32 @@ static const lookup_t service_table[] = { { ReplaceCIS, "ReplaceCIS" } }; - -static int pcmcia_report_error(struct pcmcia_device *p_dev, error_info_t *err) +const char *pcmcia_error_func(int func) { int i; - char *serv; - - if (!p_dev) - printk(KERN_NOTICE); - else - printk(KERN_NOTICE "%s: ", p_dev->dev.bus_id); for (i = 0; i < ARRAY_SIZE(service_table); i++) - if (service_table[i].key == err->func) - break; - if (i < ARRAY_SIZE(service_table)) - serv = service_table[i].msg; - else - serv = "Unknown service number"; + if (service_table[i].key == func) + return service_table[i].msg; - for (i = 0; i < ARRAY_SIZE(error_table); i++) - if (error_table[i].key == err->retcode) - break; - if (i < ARRAY_SIZE(error_table)) - printk("%s: %s\n", serv, error_table[i].msg); - else - printk("%s: Unknown error code %#x\n", serv, err->retcode); + return "Unknown service number"; +} +EXPORT_SYMBOL(pcmcia_error_func); - return 0; -} /* report_error */ +const char *pcmcia_error_ret(int ret) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(error_table); i++) + if (error_table[i].key == ret) + return error_table[i].msg; -/* end of code which was in cs.c before */ + return "unknown"; +} +EXPORT_SYMBOL(pcmcia_error_ret); /*======================================================================*/ -void cs_error(struct pcmcia_device *p_dev, int func, int ret) -{ - error_info_t err = { func, ret }; - pcmcia_report_error(p_dev, &err); -} -EXPORT_SYMBOL(cs_error); static void pcmcia_check_driver(struct pcmcia_driver *p_drv) diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 9ff9de9ec3f0..a98bbf42023a 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -249,7 +249,18 @@ struct pcmcia_device { #define handle_to_dev(handle) (handle->dev) /* error reporting */ -void cs_error(struct pcmcia_device *handle, int func, int ret); + +const char *pcmcia_error_func(int func); +const char *pcmcia_error_ret(int ret); + +#define cs_error(p_dev, func, ret) \ + { \ + dev_printk(KERN_NOTICE, &p_dev->dev, \ + "%s : %s\n", \ + pcmcia_error_func(func), \ + pcmcia_error_ret(ret)); \ + } + #endif /* __KERNEL__ */ #endif /* _LINUX_DS_H */ -- cgit v1.2.3 From 33343723cfad49efa16a8f9d97cc1ae9fe088fa1 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 25 Aug 2008 23:12:20 +0200 Subject: pcmcia: cs_internal.h is internal cs_internal.h is meant for definitions internal to the PCMCIA core modules. It must not be included by PCMCIA socket drivers or by PCMCIA device drivers. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/au1000_pb1x00.c | 1 - drivers/pcmcia/au1000_xxs1500.c | 1 - drivers/pcmcia/hd64465_ss.c | 1 - drivers/pcmcia/pxa2xx_base.c | 1 - drivers/pcmcia/soc_common.h | 1 - 5 files changed, 5 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/au1000_pb1x00.c b/drivers/pcmcia/au1000_pb1x00.c index aa1cd4d3aa29..d6b4bd1db7d7 100644 --- a/drivers/pcmcia/au1000_pb1x00.c +++ b/drivers/pcmcia/au1000_pb1x00.c @@ -37,7 +37,6 @@ #include #include #include -#include "cs_internal.h" #include #include diff --git a/drivers/pcmcia/au1000_xxs1500.c b/drivers/pcmcia/au1000_xxs1500.c index 8a9b18cee847..9627390835ca 100644 --- a/drivers/pcmcia/au1000_xxs1500.c +++ b/drivers/pcmcia/au1000_xxs1500.c @@ -41,7 +41,6 @@ #include #include #include -#include "cs_internal.h" #include #include diff --git a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c index fb2bc1fb015d..117dc12ab438 100644 --- a/drivers/pcmcia/hd64465_ss.c +++ b/drivers/pcmcia/hd64465_ss.c @@ -46,7 +46,6 @@ #include #include #include -#include "cs_internal.h" #define MODNAME "hd64465_ss" diff --git a/drivers/pcmcia/pxa2xx_base.c b/drivers/pcmcia/pxa2xx_base.c index ccfdf1969a7f..7bdf36357846 100644 --- a/drivers/pcmcia/pxa2xx_base.c +++ b/drivers/pcmcia/pxa2xx_base.c @@ -35,7 +35,6 @@ #include #include -#include "cs_internal.h" #include "soc_common.h" #include "pxa2xx_base.h" diff --git a/drivers/pcmcia/soc_common.h b/drivers/pcmcia/soc_common.h index 8e4cc92bbe73..38c67375f363 100644 --- a/drivers/pcmcia/soc_common.h +++ b/drivers/pcmcia/soc_common.h @@ -15,7 +15,6 @@ #include #include #include -#include "cs_internal.h" struct device; -- cgit v1.2.3 From dc953e550bf1624a17465b9deb15487fdde98869 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 25 Aug 2008 23:18:20 +0200 Subject: pcmcia: cleanup cs_internal.h Small cleanup to cs_internal.h. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 154 +++++++++++++++++++++++++------------------ 1 file changed, 90 insertions(+), 64 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 3fcdf4fbca0e..95297c57cdb1 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -1,5 +1,5 @@ /* - * cs_internal.h + * cs_internal.h -- definitions internal to the PCMCIA core modules * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -10,6 +10,12 @@ * are Copyright (C) 1999 David A. Hinds. All Rights Reserved. * * (C) 1999 David A. Hinds + * (C) 2003 - 2008 Dominik Brodowski + * + * + * This file contains definitions _only_ needed by the PCMCIA core modules. + * It must not be included by PCMCIA socket drivers or by PCMCIA device + * drivers. */ #ifndef _LINUX_CS_INTERNAL_H @@ -18,29 +24,24 @@ #include /* Flags in client state */ -#define CLIENT_CONFIG_LOCKED 0x0001 -#define CLIENT_IRQ_REQ 0x0002 -#define CLIENT_IO_REQ 0x0004 -#define CLIENT_UNBOUND 0x0008 -#define CLIENT_STALE 0x0010 #define CLIENT_WIN_REQ(i) (0x1<<(i)) -#define CLIENT_CARDBUS 0x8000 /* Each card function gets one of these guys */ typedef struct config_t { struct kref ref; - u_int state; - u_int Attributes; - u_int IntType; - u_int ConfigBase; - u_char Status, Pin, Copy, Option, ExtStatus; - u_int CardValues; - io_req_t io; - struct { - u_int Attributes; - } irq; + unsigned int state; + unsigned int Attributes; + unsigned int IntType; + unsigned int ConfigBase; + unsigned char Status, Pin, Copy, Option, ExtStatus; + unsigned int CardValues; + io_req_t io; + struct { + u_int Attributes; + } irq; } config_t; + struct cis_cache_entry { struct list_head node; unsigned int addr; @@ -59,7 +60,6 @@ struct cis_cache_entry { #define SOCKET_INUSE 0x0010 #define SOCKET_SUSPEND 0x0080 #define SOCKET_WIN_REQ(i) (0x0100<<(i)) -#define SOCKET_REGION_INFO 0x4000 #define SOCKET_CARDBUS 0x8000 #define SOCKET_CARDBUS_CONFIG 0x10000 @@ -83,52 +83,6 @@ static inline void cs_socket_put(struct pcmcia_socket *skt) } } -/* In cardbus.c */ -int cb_alloc(struct pcmcia_socket *s); -void cb_free(struct pcmcia_socket *s); -int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, void *ptr); - -/* In cistpl.c */ -int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, - u_int addr, u_int len, void *ptr); -void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, - u_int addr, u_int len, void *ptr); -void release_cis_mem(struct pcmcia_socket *s); -void destroy_cis_cache(struct pcmcia_socket *s); -int verify_cis_cache(struct pcmcia_socket *s); -int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse); - -/* In rsrc_mgr */ -int pcmcia_validate_mem(struct pcmcia_socket *s); -struct resource *pcmcia_find_io_region(unsigned long base, int num, unsigned long align, - struct pcmcia_socket *s); -int pcmcia_adjust_io_region(struct resource *res, unsigned long r_start, - unsigned long r_end, struct pcmcia_socket *s); -struct resource *pcmcia_find_mem_region(u_long base, u_long num, u_long align, - int low, struct pcmcia_socket *s); -void release_resource_db(struct pcmcia_socket *s); - -/* In socket_sysfs.c */ -extern int pccard_sysfs_add_socket(struct device *dev); -extern void pccard_sysfs_remove_socket(struct device *dev); - -/* In cs.c */ -extern struct rw_semaphore pcmcia_socket_list_rwsem; -extern struct list_head pcmcia_socket_list; -int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); -int pccard_reset_card(struct pcmcia_socket *skt); - - -struct pcmcia_callback{ - struct module *owner; - int (*event) (struct pcmcia_socket *s, event_t event, int priority); - void (*requery) (struct pcmcia_socket *s, int new_cis); - int (*suspend) (struct pcmcia_socket *s); - int (*resume) (struct pcmcia_socket *s); -}; - -int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); - #ifdef CONFIG_PCMCIA_DEBUG extern int cs_debug_level(int); @@ -151,4 +105,76 @@ extern int cs_debug_level(int); #define cs_err(skt, fmt, arg...) \ dev_printk(KERN_ERR, &skt->dev, "cs: " fmt, ## arg) + +/* + * Stuff internal to module "pcmcia_core": + */ + +/* cistpl.c */ +int verify_cis_cache(struct pcmcia_socket *s); + +/* rsrc_mgr.c */ +void release_resource_db(struct pcmcia_socket *s); + +/* socket_sysfs.c */ +extern int pccard_sysfs_add_socket(struct device *dev); +extern void pccard_sysfs_remove_socket(struct device *dev); + +/* cardbus.c */ +int cb_alloc(struct pcmcia_socket *s); +void cb_free(struct pcmcia_socket *s); +int read_cb_mem(struct pcmcia_socket *s, int space, u_int addr, u_int len, + void *ptr); + + + +/* + * Stuff exported by module "pcmcia_core" to module "pcmcia" + */ + +struct pcmcia_callback{ + struct module *owner; + int (*event) (struct pcmcia_socket *s, + event_t event, int priority); + void (*requery) (struct pcmcia_socket *s, int new_cis); + int (*suspend) (struct pcmcia_socket *s); + int (*resume) (struct pcmcia_socket *s); +}; + +/* cs.c */ +extern struct rw_semaphore pcmcia_socket_list_rwsem; +extern struct list_head pcmcia_socket_list; +int pcmcia_get_window(struct pcmcia_socket *s, + window_handle_t *handle, + int idx, + win_req_t *req); +int pccard_reset_card(struct pcmcia_socket *skt); +int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); + +/* cistpl.c */ +int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, + u_int addr, u_int len, void *ptr); +void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, + u_int addr, u_int len, void *ptr); +void release_cis_mem(struct pcmcia_socket *s); +void destroy_cis_cache(struct pcmcia_socket *s); +int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, + cisdata_t code, void *parse); + +/* rsrc_mgr.c */ +int pcmcia_validate_mem(struct pcmcia_socket *s); +struct resource *pcmcia_find_io_region(unsigned long base, + int num, + unsigned long align, + struct pcmcia_socket *s); +int pcmcia_adjust_io_region(struct resource *res, + unsigned long r_start, + unsigned long r_end, + struct pcmcia_socket *s); +struct resource *pcmcia_find_mem_region(u_long base, + u_long num, + u_long align, + int low, + struct pcmcia_socket *s); + #endif /* _LINUX_CS_INTERNAL_H */ -- cgit v1.2.3 From b60a5ede1e3a6a09a881c3ff014164fbe4d481b4 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Mon, 25 Aug 2008 23:32:37 +0200 Subject: pcmcia: merge ds_internal.h into cs_internal.h Merge ds_internal.c into cs_internal.h. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 40 ++++++++++++++++++++++++++++++++++++++++ drivers/pcmcia/ds.c | 1 - drivers/pcmcia/ds_internal.h | 29 ----------------------------- drivers/pcmcia/pcmcia_ioctl.c | 1 - drivers/pcmcia/pcmcia_resource.c | 1 - 5 files changed, 40 insertions(+), 32 deletions(-) delete mode 100644 drivers/pcmcia/ds_internal.h (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 95297c57cdb1..8e43c4d563d1 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -177,4 +177,44 @@ struct resource *pcmcia_find_mem_region(u_long base, int low, struct pcmcia_socket *s); +/* + * Stuff internal to module "pcmcia". + */ +/* ds.c */ +extern struct bus_type pcmcia_bus_type; + +/* pcmcia_resource.c */ +extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); + +#ifdef CONFIG_PCMCIA_IOCTL +/* ds.c */ +extern spinlock_t pcmcia_dev_list_lock; + +extern struct pcmcia_device *pcmcia_get_dev(struct pcmcia_device *p_dev); +extern void pcmcia_put_dev(struct pcmcia_device *p_dev); + +struct pcmcia_device *pcmcia_device_add(struct pcmcia_socket *s, + unsigned int function); + +/* pcmcia_ioctl.c */ +extern void __init pcmcia_setup_ioctl(void); +extern void __exit pcmcia_cleanup_ioctl(void); +extern void handle_event(struct pcmcia_socket *s, event_t event); +extern int handle_request(struct pcmcia_socket *s, event_t event); + +#else /* CONFIG_PCMCIA_IOCTL */ + +static inline void __init pcmcia_setup_ioctl(void) { return; } +static inline void __exit pcmcia_cleanup_ioctl(void) { return; } +static inline void handle_event(struct pcmcia_socket *s, event_t event) +{ + return; +} +static inline int handle_request(struct pcmcia_socket *s, event_t event) +{ + return 0; +} + +#endif /* CONFIG_PCMCIA_IOCTL */ + #endif /* _LINUX_CS_INTERNAL_H */ diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index e0624a8fb6e3..604249a170c5 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -32,7 +32,6 @@ #include #include "cs_internal.h" -#include "ds_internal.h" /*====================================================================*/ diff --git a/drivers/pcmcia/ds_internal.h b/drivers/pcmcia/ds_internal.h deleted file mode 100644 index 14bc55aa1426..000000000000 --- a/drivers/pcmcia/ds_internal.h +++ /dev/null @@ -1,29 +0,0 @@ -/* ds_internal.h - internal header for 16-bit PCMCIA devices management */ - -extern spinlock_t pcmcia_dev_list_lock; -extern struct bus_type pcmcia_bus_type; - -extern struct pcmcia_device * pcmcia_get_dev(struct pcmcia_device *p_dev); -extern void pcmcia_put_dev(struct pcmcia_device *p_dev); - -struct pcmcia_device * pcmcia_device_add(struct pcmcia_socket *s, unsigned int function); - -extern int pcmcia_release_configuration(struct pcmcia_device *p_dev); - -#ifdef CONFIG_PCMCIA_IOCTL -extern void __init pcmcia_setup_ioctl(void); -extern void __exit pcmcia_cleanup_ioctl(void); -extern void handle_event(struct pcmcia_socket *s, event_t event); -extern int handle_request(struct pcmcia_socket *s, event_t event); -#else -static inline void __init pcmcia_setup_ioctl(void) { return; } -static inline void __exit pcmcia_cleanup_ioctl(void) { return; } -static inline void handle_event(struct pcmcia_socket *s, event_t event) -{ - return; -} -static inline int handle_request(struct pcmcia_socket *s, event_t event) -{ - return 0; -} -#endif diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index d4c3f9aa3d83..c400872f5d3b 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -38,7 +38,6 @@ #include #include "cs_internal.h" -#include "ds_internal.h" static int major_dev = -1; diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index de13c424101c..93a270e15cea 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -29,7 +29,6 @@ #include #include "cs_internal.h" -#include "ds_internal.h" /* Access speed for IO windows */ -- cgit v1.2.3 From c23889ca5afcce60bb01739cd831c3cbcbab2a06 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Tue, 26 Aug 2008 00:09:56 +0200 Subject: pcmcia: cleanup socket services header file The header file for use by (in-kernel) PCMCIA sockets deserved a major cleanup. Some stuff only used by the pcmcia core modules was moved to cs_internal.h Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs_internal.h | 27 ++++++ include/pcmcia/ss.h | 198 ++++++++++++++++++++----------------------- 2 files changed, 118 insertions(+), 107 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 8e43c4d563d1..2df8d8be1ff9 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -50,6 +50,30 @@ struct cis_cache_entry { unsigned char cache[0]; }; +struct pccard_resource_ops { + int (*validate_mem) (struct pcmcia_socket *s); + int (*adjust_io_region) (struct resource *res, + unsigned long r_start, + unsigned long r_end, + struct pcmcia_socket *s); + struct resource* (*find_io) (unsigned long base, int num, + unsigned long align, + struct pcmcia_socket *s); + struct resource* (*find_mem) (unsigned long base, unsigned long num, + unsigned long align, int low, + struct pcmcia_socket *s); + int (*add_io) (struct pcmcia_socket *s, + unsigned int action, + unsigned long r_start, + unsigned long r_end); + int (*add_mem) (struct pcmcia_socket *s, + unsigned int action, + unsigned long r_start, + unsigned long r_end); + int (*init) (struct pcmcia_socket *s); + void (*exit) (struct pcmcia_socket *s); +}; + /* Flags in config state */ #define CONFIG_LOCKED 0x01 #define CONFIG_IRQ_REQ 0x02 @@ -144,12 +168,15 @@ struct pcmcia_callback{ /* cs.c */ extern struct rw_semaphore pcmcia_socket_list_rwsem; extern struct list_head pcmcia_socket_list; +extern struct class pcmcia_socket_class; + int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); int pccard_reset_card(struct pcmcia_socket *skt); int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); +struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); /* cistpl.c */ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, diff --git a/include/pcmcia/ss.h b/include/pcmcia/ss.h index e34bef0fc74f..9b4ac9385f5d 100644 --- a/include/pcmcia/ss.h +++ b/include/pcmcia/ss.h @@ -53,10 +53,10 @@ /* for GetSocket, SetSocket */ typedef struct socket_state_t { - u_int flags; - u_int csc_mask; - u_char Vcc, Vpp; - u_char io_irq; + u_int flags; + u_int csc_mask; + u_char Vcc, Vpp; + u_char io_irq; } socket_state_t; extern socket_state_t dead_socket; @@ -86,79 +86,22 @@ extern socket_state_t dead_socket; #define HOOK_POWER_PRE 0x01 #define HOOK_POWER_POST 0x02 - typedef struct pccard_io_map { - u_char map; - u_char flags; - u_short speed; - u_int start, stop; + u_char map; + u_char flags; + u_short speed; + u_int start, stop; } pccard_io_map; typedef struct pccard_mem_map { - u_char map; - u_char flags; - u_short speed; - u_long static_start; - u_int card_start; - struct resource *res; + u_char map; + u_char flags; + u_short speed; + u_long static_start; + u_int card_start; + struct resource *res; } pccard_mem_map; -typedef struct cb_bridge_map { - u_char map; - u_char flags; - u_int start, stop; -} cb_bridge_map; - -/* - * Socket operations. - */ -struct pcmcia_socket; - -struct pccard_operations { - int (*init)(struct pcmcia_socket *sock); - int (*suspend)(struct pcmcia_socket *sock); - int (*get_status)(struct pcmcia_socket *sock, u_int *value); - int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state); - int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io); - int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem); -}; - -struct pccard_resource_ops { - int (*validate_mem) (struct pcmcia_socket *s); - int (*adjust_io_region) (struct resource *res, - unsigned long r_start, - unsigned long r_end, - struct pcmcia_socket *s); - struct resource* (*find_io) (unsigned long base, int num, - unsigned long align, - struct pcmcia_socket *s); - struct resource* (*find_mem) (unsigned long base, unsigned long num, - unsigned long align, int low, - struct pcmcia_socket *s); - int (*add_io) (struct pcmcia_socket *s, - unsigned int action, - unsigned long r_start, - unsigned long r_end); - int (*add_mem) (struct pcmcia_socket *s, - unsigned int action, - unsigned long r_start, - unsigned long r_end); - int (*init) (struct pcmcia_socket *s); - void (*exit) (struct pcmcia_socket *s); -}; -/* SS_CAP_STATIC_MAP */ -extern struct pccard_resource_ops pccard_static_ops; -/* !SS_CAP_STATIC_MAP */ -extern struct pccard_resource_ops pccard_nonstatic_ops; - -/* static mem, dynamic IO sockets */ -extern struct pccard_resource_ops pccard_iodyn_ops; - -/* - * Calls to set up low-level "Socket Services" drivers - */ -struct pcmcia_socket; - typedef struct io_window_t { u_int InUse, Config; struct resource *res; @@ -179,10 +122,25 @@ typedef struct window_t { /* Maximum number of memory windows per socket */ #define MAX_WIN 4 + +/* + * Socket operations. + */ +struct pcmcia_socket; +struct pccard_resource_ops; struct config_t; struct pcmcia_callback; struct user_info_t; +struct pccard_operations { + int (*init)(struct pcmcia_socket *s); + int (*suspend)(struct pcmcia_socket *s); + int (*get_status)(struct pcmcia_socket *s, u_int *value); + int (*set_socket)(struct pcmcia_socket *s, socket_state_t *state); + int (*set_io_map)(struct pcmcia_socket *s, struct pccard_io_map *io); + int (*set_mem_map)(struct pcmcia_socket *s, struct pccard_mem_map *mem); +}; + struct pcmcia_socket { struct module *owner; spinlock_t lock; @@ -218,12 +176,12 @@ struct pcmcia_socket { struct pci_dev * cb_dev; - /* socket setup is done so resources should be able to be allocated. Only - * if set to 1, calls to find_{io,mem}_region are handled, and insertion - * events are actually managed by the PCMCIA layer.*/ + /* socket setup is done so resources should be able to be allocated. + * Only if set to 1, calls to find_{io,mem}_region are handled, and + * insertio events are actually managed by the PCMCIA layer.*/ u8 resource_setup_done:1; - /* is set to one if resource setup is done using adjust_resource_info() */ + /* It's old if resource setup is done using adjust_resource_info() */ u8 resource_setup_old:1; u8 resource_setup_new:1; @@ -236,75 +194,101 @@ struct pcmcia_socket { /* Zoom video behaviour is so chip specific its not worth adding this to _ops */ - void (*zoom_video)(struct pcmcia_socket *, int); + void (*zoom_video)(struct pcmcia_socket *, + int); /* so is power hook */ int (*power_hook)(struct pcmcia_socket *sock, int operation); -#ifdef CONFIG_CARDBUS + /* allows tuning the CB bridge before loading driver for the CB card */ +#ifdef CONFIG_CARDBUS void (*tune_bridge)(struct pcmcia_socket *sock, struct pci_bus *bus); #endif /* state thread */ - struct mutex skt_mutex; /* protects socket h/w state */ - struct task_struct *thread; struct completion thread_done; - spinlock_t thread_lock; /* protects thread_events */ unsigned int thread_events; + /* protects socket h/w state */ + struct mutex skt_mutex; + /* protects thread_events */ + spinlock_t thread_lock; /* pcmcia (16-bit) */ struct pcmcia_callback *callback; #if defined(CONFIG_PCMCIA) || defined(CONFIG_PCMCIA_MODULE) - struct list_head devices_list; /* PCMCIA devices */ - u8 device_count; /* the number of devices, used - * only internally and subject - * to incorrectness and change */ + /* The following elements refer to 16-bit PCMCIA devices inserted + * into the socket */ + struct list_head devices_list; + + /* the number of devices, used only internally and subject to + * incorrectness and change */ + u8 device_count; + /* 16-bit state: */ struct { - u8 present:1, /* PCMCIA card is present in socket */ - busy:1, /* "master" ioctl is used */ - dead:1, /* pcmcia module is being unloaded */ - device_add_pending:1, /* a multifunction-device - * add event is pending */ - mfc_pfc:1, /* the pending event adds a mfc (1) or pfc (0) */ - reserved:3; - } pcmcia_state; - - struct work_struct device_add; /* for adding further pseudo-multifunction - * devices */ + /* PCMCIA card is present in socket */ + u8 present:1; + /* "master" ioctl is used */ + u8 busy:1; + /* pcmcia module is being unloaded */ + u8 dead:1; + /* a multifunction-device add event is pending */ + u8 device_add_pending:1; + /* the pending event adds a mfc (1) or pfc (0) */ + u8 mfc_pfc:1; + + u8 reserved:3; + } pcmcia_state; + + + /* for adding further pseudo-multifunction devices */ + struct work_struct device_add; #ifdef CONFIG_PCMCIA_IOCTL struct user_info_t *user; wait_queue_head_t queue; -#endif -#endif +#endif /* CONFIG_PCMCIA_IOCTL */ +#endif /* CONFIG_PCMCIA */ /* cardbus (32-bit) */ #ifdef CONFIG_CARDBUS struct resource * cb_cis_res; void __iomem *cb_cis_virt; -#endif +#endif /* CONFIG_CARDBUS */ /* socket device */ struct device dev; - void *driver_data; /* data internal to the socket driver */ - + /* data internal to the socket driver */ + void *driver_data; }; -struct pcmcia_socket * pcmcia_get_socket_by_nr(unsigned int nr); +/* socket drivers must define the resource operations type they use. There + * are three options: + * - pccard_static_ops iomem and ioport areas are assigned statically + * - pccard_iodyn_ops iomem areas is assigned statically, ioport + * areas dynamically + * - pccard_nonstatic_ops iomem and ioport areas are assigned dynamically. + * If this option is selected, use + * "select PCCARD_NONSTATIC" in Kconfig. + */ +extern struct pccard_resource_ops pccard_static_ops; +extern struct pccard_resource_ops pccard_iodyn_ops; +extern struct pccard_resource_ops pccard_nonstatic_ops; +/* socket drivers are expected to use these callbacks in their .drv struct */ +extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state); +extern int pcmcia_socket_dev_resume(struct device *dev); + +/* socket drivers use this callback in their IRQ handler */ +extern void pcmcia_parse_events(struct pcmcia_socket *socket, + unsigned int events); -extern void pcmcia_parse_events(struct pcmcia_socket *socket, unsigned int events); +/* to register and unregister a socket */ extern int pcmcia_register_socket(struct pcmcia_socket *socket); extern void pcmcia_unregister_socket(struct pcmcia_socket *socket); -extern struct class pcmcia_socket_class; - -/* socket drivers are expected to use these callbacks in their .drv struct */ -extern int pcmcia_socket_dev_suspend(struct device *dev, pm_message_t state); -extern int pcmcia_socket_dev_resume(struct device *dev); #endif /* _LINUX_SS_H */ -- cgit v1.2.3 From d39bd56452b509f8d6054883b8a0129950ba50cc Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Thu, 28 Aug 2008 01:05:34 +0200 Subject: pcmcia: encapsulate ioaddr_t By now, ioaddr_t should only be used by the deprecated ioctl, as it does not correctly reflect the maximum ioport range at least on some architectures. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/au1000_generic.c | 2 +- drivers/pcmcia/au1000_generic.h | 2 +- drivers/usb/host/sl811_cs.c | 3 ++- include/pcmcia/cs_types.h | 8 -------- include/pcmcia/ds.h | 8 ++++++++ 5 files changed, 12 insertions(+), 11 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/pcmcia/au1000_generic.c b/drivers/pcmcia/au1000_generic.c index 75e8f8505e47..fc1de46fd20a 100644 --- a/drivers/pcmcia/au1000_generic.c +++ b/drivers/pcmcia/au1000_generic.c @@ -292,7 +292,7 @@ au1x00_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *map) skt->spd_io[map->map] = speed; } - map->start=(ioaddr_t)(u32)skt->virt_io; + map->start=(unsigned int)(u32)skt->virt_io; map->stop=map->start+MAP_SIZE; return 0; diff --git a/drivers/pcmcia/au1000_generic.h b/drivers/pcmcia/au1000_generic.h index a53ef5902518..13a4fbc58711 100644 --- a/drivers/pcmcia/au1000_generic.h +++ b/drivers/pcmcia/au1000_generic.h @@ -116,7 +116,7 @@ struct au1000_pcmcia_socket { struct resource res_attr; void * virt_io; - ioaddr_t phys_io; + unsigned int phys_io; unsigned int phys_attr; unsigned int phys_mem; unsigned short speed_io, speed_attr, speed_mem; diff --git a/drivers/usb/host/sl811_cs.c b/drivers/usb/host/sl811_cs.c index ca733b7caea4..516848dd9b48 100644 --- a/drivers/usb/host/sl811_cs.c +++ b/drivers/usb/host/sl811_cs.c @@ -112,7 +112,8 @@ static struct platform_device platform_dev = { .num_resources = ARRAY_SIZE(resources), }; -static int sl811_hc_init(struct device *parent, ioaddr_t base_addr, int irq) +static int sl811_hc_init(struct device *parent, resource_size_t base_addr, + int irq) { if (platform_dev.dev.parent) return -EBUSY; diff --git a/include/pcmcia/cs_types.h b/include/pcmcia/cs_types.h index f402a0f435b4..315965a37930 100644 --- a/include/pcmcia/cs_types.h +++ b/include/pcmcia/cs_types.h @@ -21,14 +21,6 @@ #include #endif -#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \ - defined(__bfin__) -/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */ -typedef u_int ioaddr_t; -#else -typedef u_short ioaddr_t; -#endif - typedef u_short socket_t; typedef u_int event_t; typedef u_char cisdata_t; diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index bdf7d5e474f7..279df0fb036e 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -171,6 +171,14 @@ const char *pcmcia_error_ret(int ret); #if defined(CONFIG_PCMCIA_IOCTL) || !defined(__KERNEL__) +#if defined(__arm__) || defined(__mips__) || defined(__avr32__) || \ + defined(__bfin__) +/* This (ioaddr_t) is exposed to userspace & hence cannot be changed. */ +typedef u_int ioaddr_t; +#else +typedef u_short ioaddr_t; +#endif + /* for AdjustResourceInfo */ typedef struct adjust_t { u_int Action; -- cgit v1.2.3 From 994917f8b718f1cd7114317cc3cbf04fe46c1841 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 31 Aug 2008 15:20:26 +0200 Subject: pcmcia: card services header cleanup 16-bit PCMCIA device handling function definitions are moved to ds.h, internal definitions to cs_internal.h. Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/ipwireless/main.c | 2 +- drivers/net/pcmcia/nmclan_cs.c | 2 +- drivers/net/wireless/orinoco_cs.c | 2 +- drivers/pcmcia/cs.c | 4 +-- drivers/pcmcia/cs_internal.h | 12 ++++++- drivers/pcmcia/pcmcia_ioctl.c | 2 +- include/pcmcia/cistpl.h | 6 ++-- include/pcmcia/cs.h | 67 ----------------------------------- include/pcmcia/ds.h | 56 ++++++++++++++++++++++++++++- 9 files changed, 76 insertions(+), 77 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index 24ffe0324e53..dcf2b59ca8c5 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -65,7 +65,7 @@ static void signalled_reboot_work(struct work_struct *work_reboot) struct ipw_dev *ipw = container_of(work_reboot, struct ipw_dev, work_reboot); struct pcmcia_device *link = ipw->link; - int ret = pccard_reset_card(link->socket); + int ret = pcmcia_reset_card(link->socket); if (ret != 0) cs_error(link, ResetCard, ret); diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index cfcbea9b7e2e..54df34f21c5f 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c @@ -925,7 +925,7 @@ static void mace_tx_timeout(struct net_device *dev) printk(KERN_NOTICE "%s: transmit timed out -- ", dev->name); #if RESET_ON_TIMEOUT printk("resetting card\n"); - pcmcia_reset_card(link, NULL); + pcmcia_reset_card(link->socket); #else /* #if RESET_ON_TIMEOUT */ printk("NOT resetting card\n"); #endif /* #if RESET_ON_TIMEOUT */ diff --git a/drivers/net/wireless/orinoco_cs.c b/drivers/net/wireless/orinoco_cs.c index c7b57d9d499d..f8d9de2fb4cf 100644 --- a/drivers/net/wireless/orinoco_cs.c +++ b/drivers/net/wireless/orinoco_cs.c @@ -80,7 +80,7 @@ orinoco_cs_hard_reset(struct orinoco_private *priv) /* We need atomic ops here, because we're not holding the lock */ set_bit(0, &card->hard_reset_in_progress); - err = pcmcia_reset_card(link, NULL); + err = pcmcia_reset_card(link->socket); if (err) return err; diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 48386f31e610..c68c5d338285 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -752,7 +752,7 @@ EXPORT_SYMBOL(pccard_register_pcmcia); * CIS register. */ -int pccard_reset_card(struct pcmcia_socket *skt) +int pcmcia_reset_card(struct pcmcia_socket *skt) { int ret; @@ -791,7 +791,7 @@ int pccard_reset_card(struct pcmcia_socket *skt) return ret; } /* reset_card */ -EXPORT_SYMBOL(pccard_reset_card); +EXPORT_SYMBOL(pcmcia_reset_card); /* These shut down or wake up a socket. They are sort of user diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 2df8d8be1ff9..d71eeee4992b 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -174,10 +174,18 @@ int pcmcia_get_window(struct pcmcia_socket *s, window_handle_t *handle, int idx, win_req_t *req); -int pccard_reset_card(struct pcmcia_socket *skt); int pccard_register_pcmcia(struct pcmcia_socket *s, struct pcmcia_callback *c); struct pcmcia_socket *pcmcia_get_socket_by_nr(unsigned int nr); +int pcmcia_suspend_card(struct pcmcia_socket *skt); +int pcmcia_resume_card(struct pcmcia_socket *skt); + +int pcmcia_eject_card(struct pcmcia_socket *skt); +int pcmcia_insert_card(struct pcmcia_socket *skt); + +struct pcmcia_socket *pcmcia_get_socket(struct pcmcia_socket *skt); +void pcmcia_put_socket(struct pcmcia_socket *skt); + /* cistpl.c */ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, u_int len, void *ptr); @@ -187,6 +195,8 @@ void release_cis_mem(struct pcmcia_socket *s); void destroy_cis_cache(struct pcmcia_socket *s); int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse); +int pcmcia_replace_cis(struct pcmcia_socket *s, + const u8 *data, const size_t len); /* rsrc_mgr.c */ int pcmcia_validate_mem(struct pcmcia_socket *s); diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index c400872f5d3b..579ec9455706 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -861,7 +861,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); break; case DS_RESET_CARD: - ret = pccard_reset_card(s); + ret = pcmcia_reset_card(s); break; case DS_GET_STATUS: if (buf->status.Function && diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 75a9d34c6346..7e8c2bcf11a7 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -580,8 +580,8 @@ typedef struct cisinfo_t { #define CISTPL_MAX_CIS_SIZE 0x200 -int pcmcia_replace_cis(struct pcmcia_socket *s, - const u8 *data, const size_t len); +#ifdef __KERNEL__ +struct pcmcia_socket; /* don't use outside of PCMCIA core yet */ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); @@ -615,4 +615,6 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, void *priv_data), void *priv_data); +#endif /* __KERNEL__ */ + #endif /* LINUX_CISTPL_H */ diff --git a/include/pcmcia/cs.h b/include/pcmcia/cs.h index 42c8759f0bdc..6944a74d3a7c 100644 --- a/include/pcmcia/cs.h +++ b/include/pcmcia/cs.h @@ -201,16 +201,6 @@ typedef struct win_req_t { #define WIN_BAR_MASK 0xe000 #define WIN_BAR_SHIFT 13 -/* Attributes for RegisterClient -- UNUSED -- */ -#define INFO_MASTER_CLIENT 0x01 -#define INFO_IO_CLIENT 0x02 -#define INFO_MTD_CLIENT 0x04 -#define INFO_MEM_CLIENT 0x08 -#define MAX_NUM_CLIENTS 3 - -#define INFO_CARD_SHARE 0x10 -#define INFO_CARD_EXCL 0x20 - typedef struct cs_status_t { u_char Function; event_t CardState; @@ -252,61 +242,4 @@ typedef struct error_info_t { #define CS_EVENT_3VCARD 0x200000 #define CS_EVENT_XVCARD 0x400000 - -#ifdef __KERNEL__ - -/* - * The main Card Services entry point - */ - -enum service { - AccessConfigurationRegister, AddSocketServices, - AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, - DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo, - GetClientInfo, GetConfigurationInfo, GetEventMask, - GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, - GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, - GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, - MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, - OpenMemory, ParseTuple, ReadMemory, RegisterClient, - RegisterEraseQueue, RegisterMTD, RegisterTimer, - ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ, - ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices, - RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ, - RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, - SetEventMask, SetRegion, ValidateCIS, VendorSpecific, - WriteMemory, BindDevice, BindMTD, ReportError, - SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, - GetFirstWindow, GetNextWindow, GetMemPage -}; - -struct pcmcia_socket; - -int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, conf_reg_t *reg); -int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); -int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); -int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); -int pcmcia_release_window(window_handle_t win); -int pcmcia_request_configuration(struct pcmcia_device *p_dev, config_req_t *req); -int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); -int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); -int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, window_handle_t *wh); -int pcmcia_suspend_card(struct pcmcia_socket *skt); -int pcmcia_resume_card(struct pcmcia_socket *skt); -int pcmcia_eject_card(struct pcmcia_socket *skt); -int pcmcia_insert_card(struct pcmcia_socket *skt); -int pccard_reset_card(struct pcmcia_socket *skt); - -struct pcmcia_device * pcmcia_dev_present(struct pcmcia_device *p_dev); -void pcmcia_disable_device(struct pcmcia_device *p_dev); - -struct pcmcia_socket * pcmcia_get_socket(struct pcmcia_socket *skt); -void pcmcia_put_socket(struct pcmcia_socket *skt); - -/* compatibility functions */ -#define pcmcia_reset_card(p_dev, req) \ - pccard_reset_card(p_dev->socket) - -#endif /* __KERNEL__ */ - #endif /* _LINUX_CS_H */ diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h index 279df0fb036e..29e403230899 100644 --- a/include/pcmcia/ds.h +++ b/include/pcmcia/ds.h @@ -145,7 +145,26 @@ struct pcmcia_device { * or dev_dbg() directly in the driver, without referring to pcmcia_error_func() * and/or pcmcia_error_ret() for those functions will go away soon. */ - +enum service { + AccessConfigurationRegister, AddSocketServices, + AdjustResourceInfo, CheckEraseQueue, CloseMemory, CopyMemory, + DeregisterClient, DeregisterEraseQueue, GetCardServicesInfo, + GetClientInfo, GetConfigurationInfo, GetEventMask, + GetFirstClient, GetFirstPartion, GetFirstRegion, GetFirstTuple, + GetNextClient, GetNextPartition, GetNextRegion, GetNextTuple, + GetStatus, GetTupleData, MapLogSocket, MapLogWindow, MapMemPage, + MapPhySocket, MapPhyWindow, ModifyConfiguration, ModifyWindow, + OpenMemory, ParseTuple, ReadMemory, RegisterClient, + RegisterEraseQueue, RegisterMTD, RegisterTimer, + ReleaseConfiguration, ReleaseExclusive, ReleaseIO, ReleaseIRQ, + ReleaseSocketMask, ReleaseWindow, ReplaceSocketServices, + RequestConfiguration, RequestExclusive, RequestIO, RequestIRQ, + RequestSocketMask, RequestWindow, ResetCard, ReturnSSEntry, + SetEventMask, SetRegion, ValidateCIS, VendorSpecific, + WriteMemory, BindDevice, BindMTD, ReportError, + SuspendCard, ResumeCard, EjectCard, InsertCard, ReplaceCIS, + GetFirstWindow, GetNextWindow, GetMemPage +}; const char *pcmcia_error_func(int func); const char *pcmcia_error_ret(int ret); @@ -158,6 +177,32 @@ const char *pcmcia_error_ret(int ret); } +/* is the device still there? */ +struct pcmcia_device *pcmcia_dev_present(struct pcmcia_device *p_dev); + +/* low-level interface reset */ +int pcmcia_reset_card(struct pcmcia_socket *skt); + +/* CIS config */ +int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, + conf_reg_t *reg); + +/* device configuration */ +int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req); +int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req); +int pcmcia_request_configuration(struct pcmcia_device *p_dev, + config_req_t *req); + +int pcmcia_request_window(struct pcmcia_device **p_dev, win_req_t *req, + window_handle_t *wh); +int pcmcia_release_window(window_handle_t win); + +int pcmcia_get_mem_page(window_handle_t win, memreq_t *req); +int pcmcia_map_mem_page(window_handle_t win, memreq_t *req); + +int pcmcia_modify_configuration(struct pcmcia_device *p_dev, modconf_t *mod); +void pcmcia_disable_device(struct pcmcia_device *p_dev); + #endif /* __KERNEL__ */ @@ -341,6 +386,15 @@ typedef union ds_ioctl_arg_t { /* used in userspace only */ #define CS_IN_USE 0x1e +#define INFO_MASTER_CLIENT 0x01 +#define INFO_IO_CLIENT 0x02 +#define INFO_MTD_CLIENT 0x04 +#define INFO_MEM_CLIENT 0x08 +#define MAX_NUM_CLIENTS 3 + +#define INFO_CARD_SHARE 0x10 +#define INFO_CARD_EXCL 0x20 + #endif /* !defined(__KERNEL__) || defined(CONFIG_PCMCIA_IOCTL) */ -- cgit v1.2.3 From 2f3061eb1086f98990d6495b8c63a1b83f2f59aa Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Sun, 31 Aug 2008 15:50:33 +0200 Subject: pcmcia: remove unused argument to pcmcia_parse_tuple() Since we're just parsing the tuple being passed to this function, we don't need any device-specific information. Also, remove the call to pcmcia_validate_cis() from pcmciamtd.c, since it is already called by the PCMCIA core. Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/ipwireless/main.c | 6 +++--- drivers/char/pcmcia/synclink_cs.c | 2 +- drivers/mtd/maps/pcmciamtd.c | 7 +------ drivers/net/pcmcia/fmvj18x_cs.c | 2 +- drivers/net/pcmcia/smc91c92_cs.c | 4 ++-- drivers/net/pcmcia/xirc2ps_cs.c | 4 ++-- drivers/net/wireless/b43/pcmcia.c | 2 +- drivers/net/wireless/hostap/hostap_cs.c | 2 +- drivers/net/wireless/libertas/if_cs.c | 2 +- drivers/pcmcia/cistpl.c | 6 +++--- drivers/pcmcia/cs_internal.h | 2 ++ drivers/pcmcia/pcmcia_ioctl.c | 2 +- drivers/pcmcia/pcmcia_resource.c | 2 +- drivers/serial/serial_cs.c | 2 +- include/pcmcia/cistpl.h | 11 ++--------- 15 files changed, 23 insertions(+), 33 deletions(-) (limited to 'drivers/pcmcia') diff --git a/drivers/char/pcmcia/ipwireless/main.c b/drivers/char/pcmcia/ipwireless/main.c index dcf2b59ca8c5..5216fce0c62d 100644 --- a/drivers/char/pcmcia/ipwireless/main.c +++ b/drivers/char/pcmcia/ipwireless/main.c @@ -127,7 +127,7 @@ static int config_ipwireless(struct ipw_dev *ipw) goto exit0; } - ret = pcmcia_parse_tuple(link, &tuple, &parse); + ret = pcmcia_parse_tuple(&tuple, &parse); if (ret != 0) { cs_error(link, ParseTuple, ret); @@ -163,7 +163,7 @@ static int config_ipwireless(struct ipw_dev *ipw) goto exit0; } - ret = pcmcia_parse_tuple(link, &tuple, &parse); + ret = pcmcia_parse_tuple(&tuple, &parse); if (ret != 0) { cs_error(link, GetTupleData, ret); @@ -206,7 +206,7 @@ static int config_ipwireless(struct ipw_dev *ipw) goto exit1; } - ret = pcmcia_parse_tuple(link, &tuple, &parse); + ret = pcmcia_parse_tuple(&tuple, &parse); if (ret != 0) { cs_error(link, ParseTuple, ret); diff --git a/drivers/char/pcmcia/synclink_cs.c b/drivers/char/pcmcia/synclink_cs.c index d1fceabe3aef..05bf9c55ecc2 100644 --- a/drivers/char/pcmcia/synclink_cs.c +++ b/drivers/char/pcmcia/synclink_cs.c @@ -604,7 +604,7 @@ static int mgslpc_config(struct pcmcia_device *link) cfg = &(parse.cftable_entry); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); if (cfg->flags & CISTPL_CFTABLE_DEFAULT) dflt = *cfg; if (cfg->index == 0) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 27b3d96b7124..d600c2deff73 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -374,7 +374,7 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, cs_error(link, GetTupleData, rc); break; } - rc = pcmcia_parse_tuple(link, &tuple, &parse); + rc = pcmcia_parse_tuple(&tuple, &parse); if (rc != 0) { cs_error(link, ParseTuple, rc); break; @@ -498,11 +498,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) DEBUG(3, "link=0x%p", link); - DEBUG(2, "Validating CIS"); - ret = pcmcia_validate_cis(link, NULL); - if (ret != 0) - cs_error(link, GetTupleData, ret); - card_settings(dev, link, &new_name); dev->pcmcia_map.phys = NO_XIP; diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 0ffd981502e1..69d916daa7bb 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c @@ -362,7 +362,7 @@ static int fmvj18x_config(struct pcmcia_device *link) tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple)); CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple)); - CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, &parse)); + CS_CHECK(ParseTuple, pcmcia_parse_tuple(&tuple, &parse)); link->conf.ConfigIndex = parse.cftable_entry.index; switch (link->manf_id) { case MANFID_TDK: diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 918b4a3eca57..c74d6656d266 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c @@ -415,7 +415,7 @@ static int first_tuple(struct pcmcia_device *handle, tuple_t *tuple, i = pcmcia_get_tuple_data(handle, tuple); if (i != 0) return i; - return pcmcia_parse_tuple(handle, tuple, parse); + return pcmcia_parse_tuple(tuple, parse); } static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, @@ -426,7 +426,7 @@ static int next_tuple(struct pcmcia_device *handle, tuple_t *tuple, if ((i = pcmcia_get_next_tuple(handle, tuple)) != 0 || (i = pcmcia_get_tuple_data(handle, tuple)) != 0) return i; - return pcmcia_parse_tuple(handle, tuple, parse); + return pcmcia_parse_tuple(tuple, parse); } /*====================================================================== diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index d97e6e917c3c..8366bfc7d28c 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c @@ -377,7 +377,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) if ((err = pcmcia_get_first_tuple(handle, tuple)) == 0 && (err = pcmcia_get_tuple_data(handle, tuple)) == 0) - err = pcmcia_parse_tuple(handle, tuple, parse); + err = pcmcia_parse_tuple(tuple, parse); return err; } @@ -388,7 +388,7 @@ next_tuple(struct pcmcia_device *handle, tuple_t *tuple, cisparse_t *parse) if ((err = pcmcia_get_next_tuple(handle, tuple)) == 0 && (err = pcmcia_get_tuple_data(handle, tuple)) == 0) - err = pcmcia_parse_tuple(handle, tuple, parse); + err = pcmcia_parse_tuple(tuple, parse); return err; } diff --git a/drivers/net/wireless/b43/pcmcia.c b/drivers/net/wireless/b43/pcmcia.c index ab42fb6addf6..3cfc30307a27 100644 --- a/drivers/net/wireless/b43/pcmcia.c +++ b/drivers/net/wireless/b43/pcmcia.c @@ -87,7 +87,7 @@ static int __devinit b43_pcmcia_probe(struct pcmcia_device *dev) res = pcmcia_get_tuple_data(dev, &tuple); if (res != 0) goto err_kfree_ssb; - res = pcmcia_parse_tuple(dev, &tuple, &parse); + res = pcmcia_parse_tuple(&tuple, &parse); if (res != 0) goto err_kfree_ssb; diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c index 2826e674a8e7..633740277352 100644 --- a/drivers/net/wireless/hostap/hostap_cs.c +++ b/drivers/net/wireless/hostap/hostap_cs.c @@ -305,7 +305,7 @@ static int sandisk_enable_wireless(struct net_device *dev) tuple.DesiredTuple = CISTPL_LONGLINK_MFC; if (pcmcia_get_first_tuple(hw_priv->link, &tuple) || pcmcia_get_tuple_data(hw_priv->link, &tuple) || - pcmcia_parse_tuple(hw_priv->link, &tuple, parse) || + pcmcia_parse_tuple(&tuple, parse) || parse->longlink_mfc.nfn < 2) { /* No multi-function links found */ ret = -ENODEV; diff --git a/drivers/net/wireless/libertas/if_cs.c b/drivers/net/wireless/libertas/if_cs.c index 04d7a251e3f0..e2fe2d677324 100644 --- a/drivers/net/wireless/libertas/if_cs.c +++ b/drivers/net/wireless/libertas/if_cs.c @@ -798,7 +798,7 @@ static int if_cs_probe(struct pcmcia_device *p_dev) tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY; if ((ret = pcmcia_get_first_tuple(p_dev, &tuple)) != 0 || (ret = pcmcia_get_tuple_data(p_dev, &tuple)) != 0 || - (ret = pcmcia_parse_tuple(p_dev, &tuple, &parse)) != 0) + (ret = pcmcia_parse_tuple(&tuple, &parse)) != 0) { lbs_pr_err("error in pcmcia_get_first_tuple etc\n"); goto out1; diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 772fc96d5ec3..dcce9f5d8465 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1359,7 +1359,7 @@ static int parse_format(tuple_t *tuple, cistpl_format_t *fmt) /*====================================================================*/ -int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) +int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) { int ret = 0; @@ -1442,7 +1442,7 @@ int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse) __cs_dbg(0, "parse_tuple failed %d\n", ret); return ret; } -EXPORT_SYMBOL(pccard_parse_tuple); +EXPORT_SYMBOL(pcmcia_parse_tuple); /*====================================================================== @@ -1472,7 +1472,7 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t ret = pccard_get_tuple_data(s, &tuple); if (ret != 0) goto done; - ret = pccard_parse_tuple(&tuple, parse); + ret = pcmcia_parse_tuple(&tuple, parse); done: kfree(buf); return ret; diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index d71eeee4992b..79615e6d540b 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -197,6 +197,8 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t code, void *parse); int pcmcia_replace_cis(struct pcmcia_socket *s, const u8 *data, const size_t len); +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, + unsigned int *count); /* rsrc_mgr.c */ int pcmcia_validate_mem(struct pcmcia_socket *s); diff --git a/drivers/pcmcia/pcmcia_ioctl.c b/drivers/pcmcia/pcmcia_ioctl.c index 579ec9455706..1703b20cad5d 100644 --- a/drivers/pcmcia/pcmcia_ioctl.c +++ b/drivers/pcmcia/pcmcia_ioctl.c @@ -858,7 +858,7 @@ static int ds_ioctl(struct inode * inode, struct file * file, break; case DS_PARSE_TUPLE: buf->tuple.TupleData = buf->tuple_parse.data; - ret = pccard_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); + ret = pcmcia_parse_tuple(&buf->tuple, &buf->tuple_parse.parse); break; case DS_RESET_CARD: ret = pcmcia_reset_card(s); diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 93a270e15cea..afea2b2558b5 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -937,7 +937,7 @@ int pcmcia_loop_config(struct pcmcia_device *p_dev, if (pcmcia_get_tuple_data(p_dev, tuple)) goto next_entry; - if (pcmcia_parse_tuple(p_dev, tuple, &cfg_mem->parse)) + if (pcmcia_parse_tuple(tuple, &cfg_mem->parse)) goto next_entry; /* default values */ diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index dbb3bf3065fa..7546aa887fa7 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -436,7 +436,7 @@ first_tuple(struct pcmcia_device *handle, tuple_t * tuple, cisparse_t * parse) i = pcmcia_get_tuple_data(handle, tuple); if (i != 0) return i; - return pcmcia_parse_tuple(handle, tuple, parse); + return pcmcia_parse_tuple(tuple, parse); } /*====================================================================*/ diff --git a/include/pcmcia/cistpl.h b/include/pcmcia/cistpl.h index 7e8c2bcf11a7..353abe74be74 100644 --- a/include/pcmcia/cistpl.h +++ b/include/pcmcia/cistpl.h @@ -583,13 +583,12 @@ typedef struct cisinfo_t { #ifdef __KERNEL__ struct pcmcia_socket; +int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse); + /* don't use outside of PCMCIA core yet */ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int func, tuple_t *tuple); int pccard_get_first_tuple(struct pcmcia_socket *s, unsigned int function, tuple_t *tuple); int pccard_get_tuple_data(struct pcmcia_socket *s, tuple_t *tuple); -int pccard_parse_tuple(tuple_t *tuple, cisparse_t *parse); - -int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *count); /* ... but use these wrappers instead */ #define pcmcia_get_first_tuple(p_dev, tuple) \ @@ -601,12 +600,6 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned #define pcmcia_get_tuple_data(p_dev, tuple) \ pccard_get_tuple_data(p_dev->socket, tuple) -#define pcmcia_parse_tuple(p_dev, tuple, parse) \ - pccard_parse_tuple(tuple, parse) - -#define pcmcia_validate_cis(p_dev, info) \ - pccard_validate_cis(p_dev->socket, p_dev->func, info) - int pcmcia_loop_config(struct pcmcia_device *p_dev, int (*conf_check) (struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cf, -- cgit v1.2.3