RE: [PATCH 5/9] pcmcia: add new CIS access helpers
Hi, The pcmcia_do_get_mac has a bug, tuple->TupleDataLen should be ETH_ALEN + 3; static int pcmcia_do_get_mac(struct pcmcia_device *p_dev, tuple_t *tuple, void *priv) { struct net_device *dev = priv; int i; if (tuple->TupleData[0] != CISTPL_FUNCE_LAN_NODE_ID) return -EINVAL; - if (tuple->TupleDataLen != ETH_ALEN + 2) + if (tuple->TupleDataLen != ETH_ALEN + 3) return -EINVAL; if (tuple->TupleData[1] != ETH_ALEN) return -EINVAL; for (i = 0; i < 6; i++) dev->dev_addr[i] = tuple->TupleData[i+2]; return 0; }; Best Regards Komuro ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH 16/16] pcmcia: use dev_dbg and dev_print in pd6729.c
Hi, minir fixes. add "\n" to some dev_dbg. > pd6729_set_io_map > /* Check error conditions */ > if (map > 1) { > - dprintk("pd6729_set_io_map with invalid map"); > + dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map"); > return -EINVAL; > } > if (map > 1) { - dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map"); + dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map\n"); return -EINVAL; } > pd6729_set_mem_map if (map > 4) { - printk("pd6729_set_mem_map: invalid map"); + printk("pd6729_set_mem_map: invalid map\n"); return -EINVAL; } if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) { - printk("pd6729_set_mem_map: invalid address / speed"); + printk("pd6729_set_mem_map: invalid address / speed\n"); return -EINVAL; } Best Regards Komuro ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH 16/16] pcmcia: use dev_dbg and dev_print in pd6729.c
> > I'd also include dev_err, dev_warn and dev_info :) > > What's their advantage? They are a bit shorter and much more common AFAICT. > > > > if (csc & I365_CSC_DETECT) { > > > events |= SS_DETECT; > > > - dprintk("Card detected in socket %i!\n", i); > > > + dev_dbg(&socket[i].socket.dev, > > > + "Card detected in socket %i!\n", i); > > > > Dunno, in days of dynamic_printk it might be better to skip debug outputs > > in ISRs, no? > > Why? They may not be compiled out although they are not used. Dunno, maybe I'm a bit biased because I often fight latencies ;) Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | signature.asc Description: Digital signature ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH 16/16] pcmcia: use dev_dbg and dev_print in pd6729.c
On Sun, Oct 25, 2009 at 12:19:25AM +0200, Wolfram Sang wrote: > On Sat, Oct 24, 2009 at 09:43:06PM +0200, Dominik Brodowski wrote: > > As suggested by Wolfram Sang , use dev_dbg() and > > dev_printk() in pd6729.c. > > I'd also include dev_err, dev_warn and dev_info :) What's their advantage? > > if (csc & I365_CSC_DETECT) { > > events |= SS_DETECT; > > - dprintk("Card detected in socket %i!\n", i); > > + dev_dbg(&socket[i].socket.dev, > > + "Card detected in socket %i!\n", i); > > Dunno, in days of dynamic_printk it might be better to skip debug outputs > in ISRs, no? Why? Best, Dominik ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH 16/16] pcmcia: use dev_dbg and dev_print in pd6729.c
On Sat, Oct 24, 2009 at 09:43:06PM +0200, Dominik Brodowski wrote: > As suggested by Wolfram Sang , use dev_dbg() and > dev_printk() in pd6729.c. I'd also include dev_err, dev_warn and dev_info :) > > CC: Wolfram Sang > Signed-off-by: Dominik Brodowski > --- > drivers/pcmcia/pd6729.c | 69 > ++- > drivers/pcmcia/pd6729.h |7 - > 2 files changed, 38 insertions(+), 38 deletions(-) > > diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c > index 70a3346..509a648 100644 > --- a/drivers/pcmcia/pd6729.c > +++ b/drivers/pcmcia/pd6729.c > @@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) > > if (csc & I365_CSC_DETECT) { > events |= SS_DETECT; > - dprintk("Card detected in socket %i!\n", i); > + dev_dbg(&socket[i].socket.dev, > + "Card detected in socket %i!\n", i); Dunno, in days of dynamic_printk it might be better to skip debug outputs in ISRs, no? > } > > if (indirect_read(&socket[i], I365_INTCTL) > @@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket > *sock, socket_state_t *state) > reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ > > if (state->flags & SS_PWR_AUTO) { > - dprintk("Auto power\n"); > + dev_dbg(&sock->dev, "Auto power\n"); > reg |= I365_PWR_AUTO; /* automatic power mngmnt */ > } > if (state->flags & SS_OUTPUT_ENA) { > - dprintk("Power Enabled\n"); > + dev_dbg(&sock->dev, "Power Enabled\n"); > reg |= I365_PWR_OUT;/* enable power */ > } > > @@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket > *sock, socket_state_t *state) > case 0: > break; > case 33: > - dprintk("setting voltage to Vcc to 3.3V on socket %i\n", > + dev_dbg(&sock->dev, > + "setting voltage to Vcc to 3.3V on socket %i\n", > socket->number); > reg |= I365_VCC_5V; > indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); > break; > case 50: > - dprintk("setting voltage to Vcc to 5V on socket %i\n", > + dev_dbg(&sock->dev, > + "setting voltage to Vcc to 5V on socket %i\n", > socket->number); > reg |= I365_VCC_5V; > indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); > break; > default: > - dprintk("pd6729: pd6729_set_socket called with " > - "invalid VCC power value: %i\n", > - state->Vcc); > + dev_dbg(&sock->dev, > + "pd6729_set_socket called with invalid VCC power " > + "value: %i\n", state->Vcc); > return -EINVAL; > } > > switch (state->Vpp) { > case 0: > - dprintk("not setting Vpp on socket %i\n", socket->number); > + dev_dbg(&sock->dev, "not setting Vpp on socket %i\n", > + socket->number); > break; > case 33: > case 50: > - dprintk("setting Vpp to Vcc for socket %i\n", socket->number); > + dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n", > + socket->number); > reg |= I365_VPP1_5V; > break; > case 120: > - dprintk("setting Vpp to 12.0\n"); > + dev_dbg(&sock->dev, "setting Vpp to 12.0\n"); > reg |= I365_VPP1_12V; > break; > default: > - dprintk("pd6729: pd6729_set_socket called with invalid VPP > power value: %i\n", > - state->Vpp); > + dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with " > + "invalid VPP power value: %i\n", state->Vpp); > return -EINVAL; > } > > @@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, > > /* Check error conditions */ > if (map > 1) { > - dprintk("pd6729_set_io_map with invalid map"); > + dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map"); > return -EINVAL; > } > > @@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, > if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) > indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); > > - /* dprintk("set_io_map: Setting range to %x - %x\n", > + /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n", > io->start, io->stop);*/ > > /* write the new values */ > @@ -529,12 +534,12 @@ static int pd6729_set_mem_map(stru
Re: [PATCH 11/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (scsi)
On Sat, Oct 24, 2009 at 10:16:49PM +0200, Rolf Eike Beer wrote: > Dominik Brodowski wrote: > > > @@ -164,19 +152,21 @@ static int aha152x_config_cs(struct pcmcia_device > > *link) { > > scsi_info_t *info = link->priv; > > struct aha152x_setup s; > > -int last_ret, last_fn; > > +int ret > > struct Scsi_Host *host; > > This looks not even compile tested, there is a semicolon missing. Indeed, for this driver is !64BIT Updated patch (aha152x_stub.c only) attached. Thanks for noticing this issue. Dominik diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 67cde01..4329e4e 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -54,15 +54,6 @@ #include #include -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0644); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif /**/ @@ -103,7 +94,7 @@ static int aha152x_probe(struct pcmcia_device *link) { scsi_info_t *info; -DEBUG(0, "aha152x_attach()\n"); +dev_dbg(&link->dev, "aha152x_attach()\n"); /* Create new SCSI device */ info = kzalloc(sizeof(*info), GFP_KERNEL); @@ -127,7 +118,7 @@ static int aha152x_probe(struct pcmcia_device *link) static void aha152x_detach(struct pcmcia_device *link) { -DEBUG(0, "aha152x_detach(0x%p)\n", link); +dev_dbg(&link->dev, "aha152x_detach\n"); aha152x_release_cs(link); @@ -137,9 +128,6 @@ static void aha152x_detach(struct pcmcia_device *link) /**/ -#define CS_CHECK(fn, ret) \ -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, @@ -164,19 +152,22 @@ static int aha152x_config_cs(struct pcmcia_device *link) { scsi_info_t *info = link->priv; struct aha152x_setup s; -int last_ret, last_fn; +int ret; struct Scsi_Host *host; -DEBUG(0, "aha152x_config(0x%p)\n", link); +dev_dbg(&link->dev, "aha152x_config\n"); -last_ret = pcmcia_loop_config(link, aha152x_config_check, NULL); -if (last_ret) { - cs_error(link, RequestIO, last_ret); - goto failed; -} +ret = pcmcia_loop_config(link, aha152x_config_check, NULL); +if (ret) + goto failed; -CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); -CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); +ret = pcmcia_request_irq(link, &link->irq); +if (ret) + goto failed; + +ret = pcmcia_request_configuration(link, &link->conf); +if (ret) + goto failed; /* Set configuration options for the aha152x driver */ memset(&s, 0, sizeof(s)); @@ -194,7 +185,7 @@ static int aha152x_config_cs(struct pcmcia_device *link) host = aha152x_probe_one(&s); if (host == NULL) { printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); - goto cs_failed; + goto failed; } sprintf(info->node.dev_name, "scsi%d", host->host_no); @@ -203,8 +194,6 @@ static int aha152x_config_cs(struct pcmcia_device *link) return 0; -cs_failed: -cs_error(link, last_fn, last_ret); failed: aha152x_release_cs(link); return -ENODEV; ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH 11/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (scsi)
Dominik Brodowski wrote: > @@ -164,19 +152,21 @@ static int aha152x_config_cs(struct pcmcia_device > *link) { > scsi_info_t *info = link->priv; > struct aha152x_setup s; > -int last_ret, last_fn; > +int ret > struct Scsi_Host *host; This looks not even compile tested, there is a semicolon missing. Eike signature.asc Description: This is a digitally signed message part. ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 07/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (isdn)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Karsten Keil Signed-off-by: Dominik Brodowski --- drivers/isdn/hardware/avm/avm_cs.c |2 - drivers/isdn/hisax/avma1_cs.c | 26 ++- drivers/isdn/hisax/elsa_cs.c | 45 +++- drivers/isdn/hisax/sedlbauer_cs.c | 58 --- drivers/isdn/hisax/teles_cs.c | 37 -- 5 files changed, 42 insertions(+), 126 deletions(-) diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c index c725655..d388ead 100644 --- a/drivers/isdn/hardware/avm/avm_cs.c +++ b/drivers/isdn/hardware/avm/avm_cs.c @@ -198,7 +198,6 @@ static int avmcs_config(struct pcmcia_device *link) */ i = pcmcia_request_irq(link, &link->irq); if (i != 0) { - cs_error(link, RequestIRQ, i); /* undo */ pcmcia_disable_device(link); break; @@ -209,7 +208,6 @@ static int avmcs_config(struct pcmcia_device *link) */ i = pcmcia_request_configuration(link, &link->conf); 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 23560c8..6d963f9 100644 --- a/drivers/isdn/hisax/avma1_cs.c +++ b/drivers/isdn/hisax/avma1_cs.c @@ -30,22 +30,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for AVM A1/Fritz!PCMCIA car MODULE_AUTHOR("Carsten Paeth"); MODULE_LICENSE("GPL"); -/* - All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If - you do not define PCMCIA_DEBUG at all, all the debug code will be - left out. If you compile with PCMCIA_DEBUG=0, the debug code will - be present but disabled -- but it can then be enabled for specific - modules at load time with a 'pc_debug=#' option to insmod. -*/ -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); -static char *version = -"avma1_cs.c 1.00 1998/01/23 10:00:00 (Carsten Paeth)"; -#else -#define DEBUG(n, args...) -#endif /**/ @@ -119,7 +103,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) { local_info_t *local; -DEBUG(0, "avma1cs_attach()\n"); +dev_dbg(&p_dev->dev, "avma1cs_attach()\n"); /* Allocate space for private device-specific data */ local = kzalloc(sizeof(local_info_t), GFP_KERNEL); @@ -161,7 +145,7 @@ static int avma1cs_probe(struct pcmcia_device *p_dev) static void avma1cs_detach(struct pcmcia_device *link) { - DEBUG(0, "avma1cs_detach(0x%p)\n", link); + dev_dbg(&link->dev, "avma1cs_detach(0x%p)\n", link); avma1cs_release(link); kfree(link->priv); } /* avma1cs_detach */ @@ -203,7 +187,7 @@ static int avma1cs_config(struct pcmcia_device *link) dev = link->priv; -DEBUG(0, "avma1cs_config(0x%p)\n", link); +dev_dbg(&link->dev, "avma1cs_config(0x%p)\n", link); devname[0] = 0; if (link->prod_id[1]) @@ -218,7 +202,6 @@ static int avma1cs_config(struct pcmcia_device *link) */ i = pcmcia_request_irq(link, &link->irq); if (i != 0) { - cs_error(link, RequestIRQ, i); /* undo */ pcmcia_disable_device(link); break; @@ -229,7 +212,6 @@ static int avma1cs_config(struct pcmcia_device *link) */ i = pcmcia_request_configuration(link, &link->conf); if (i != 0) { - cs_error(link, RequestConfiguration, i); pcmcia_disable_device(link); break; } @@ -281,7 +263,7 @@ static void avma1cs_release(struct pcmcia_device *link) { local_info_t *local = link->priv; - DEBUG(0, "avma1cs_release(0x%p)\n", link); + dev_dbg(&link->dev, "avma1cs_release(0x%p)\n", link); /* now unregister function with hisax */ HiSax_closecard(local->node.minor); diff --git a/drivers/isdn/hisax/elsa_cs.c b/drivers/isdn/hisax/elsa_cs.c index f4d0fe2..1bb3ec9 100644 --- a/drivers/isdn/hisax/elsa_cs.c +++ b/drivers/isdn/hisax/elsa_cs.c @@ -57,23 +57,6 @@ MODULE_DESCRIPTION("ISDN4Linux: PCMCIA client driver for Elsa PCM cards"); MODULE_AUTHOR("Klaus Lichtenwalder"); MODULE_LICENSE("Dual MPL/GPL"); -/* - All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If - you do not define PCMCIA_DEBUG at all, all the debug code will be - left out. If you compile with PCMCIA_DEBUG=0, the debug code will - be present but disabled --
[PATCH 05/16] pcmcia: deprecate CS_CHECK (bluetooth)
Remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-blueto...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/bluetooth/bluecard_cs.c | 12 +++- drivers/bluetooth/bt3c_cs.c |9 ++--- drivers/bluetooth/btuart_cs.c |9 ++--- drivers/bluetooth/dtl1_cs.c |8 ++-- 4 files changed, 9 insertions(+), 29 deletions(-) diff --git a/drivers/bluetooth/bluecard_cs.c b/drivers/bluetooth/bluecard_cs.c index b0e569b..1e0c4d8 100644 --- a/drivers/bluetooth/bluecard_cs.c +++ b/drivers/bluetooth/bluecard_cs.c @@ -905,22 +905,16 @@ static int bluecard_config(struct pcmcia_device *link) break; } - if (i != 0) { - cs_error(link, RequestIO, i); + if (i != 0) goto failed; - } i = pcmcia_request_irq(link, &link->irq); - if (i != 0) { - cs_error(link, RequestIRQ, i); + if (i != 0) link->irq.AssignedIRQ = 0; - } i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) goto failed; - } if (bluecard_open(info) != 0) goto failed; diff --git a/drivers/bluetooth/bt3c_cs.c b/drivers/bluetooth/bt3c_cs.c index d58e22b..9787fda 100644 --- a/drivers/bluetooth/bt3c_cs.c +++ b/drivers/bluetooth/bt3c_cs.c @@ -740,21 +740,16 @@ static int bt3c_config(struct pcmcia_device *link) goto found_port; BT_ERR("No usable port range found"); - cs_error(link, RequestIO, -ENODEV); goto failed; found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != 0) { - cs_error(link, RequestIRQ, i); + if (i != 0) link->irq.AssignedIRQ = 0; - } i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) goto failed; - } if (bt3c_open(info) != 0) goto failed; diff --git a/drivers/bluetooth/btuart_cs.c b/drivers/bluetooth/btuart_cs.c index efd689a..f44d752 100644 --- a/drivers/bluetooth/btuart_cs.c +++ b/drivers/bluetooth/btuart_cs.c @@ -669,21 +669,16 @@ static int btuart_config(struct pcmcia_device *link) goto found_port; BT_ERR("No usable port range found"); - cs_error(link, RequestIO, -ENODEV); goto failed; found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != 0) { - cs_error(link, RequestIRQ, i); + if (i != 0) link->irq.AssignedIRQ = 0; - } i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) goto failed; - } if (btuart_open(info) != 0) goto failed; diff --git a/drivers/bluetooth/dtl1_cs.c b/drivers/bluetooth/dtl1_cs.c index b881a9c..7cd8614 100644 --- a/drivers/bluetooth/dtl1_cs.c +++ b/drivers/bluetooth/dtl1_cs.c @@ -622,16 +622,12 @@ static int dtl1_config(struct pcmcia_device *link) goto failed; i = pcmcia_request_irq(link, &link->irq); - if (i != 0) { - cs_error(link, RequestIRQ, i); + if (i != 0) link->irq.AssignedIRQ = 0; - } i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) goto failed; - } if (dtl1_open(info) != 0) goto failed; -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 03/16] pcmcia: extend error reporting and debug messages in core
Add a few more error and debug messages to the PCMCIA core. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cs.c |3 ++ drivers/pcmcia/pcmcia_resource.c | 63 +- 2 files changed, 51 insertions(+), 15 deletions(-) diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index b0ec9c6..b229f6d 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -752,14 +752,17 @@ int pcmcia_reset_card(struct pcmcia_socket *skt) mutex_lock(&skt->skt_mutex); do { if (!(skt->state & SOCKET_PRESENT)) { + dev_dbg(&skt->dev, "can't reset, not present\n"); ret = -ENODEV; break; } if (skt->state & SOCKET_SUSPEND) { + dev_dbg(&skt->dev, "can't reset, suspended\n"); ret = -EBUSY; break; } if (skt->state & SOCKET_CARDBUS) { + dev_dbg(&skt->dev, "can't reset, is cardbus\n"); ret = -EPERM; break; } diff --git a/drivers/pcmcia/pcmcia_resource.c b/drivers/pcmcia/pcmcia_resource.c index 1c1ad26..18c7362 100644 --- a/drivers/pcmcia/pcmcia_resource.c +++ b/drivers/pcmcia/pcmcia_resource.c @@ -159,8 +159,10 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, s = p_dev->socket; c = p_dev->function_config; - if (!(c->state & CONFIG_LOCKED)) + if (!(c->state & CONFIG_LOCKED)) { + dev_dbg(&s->dev, "Configuration isnt't locked\n"); return -EACCES; + } addr = (c->ConfigBase + reg->Offset) >> 1; @@ -174,6 +176,7 @@ int pcmcia_access_configuration_register(struct pcmcia_device *p_dev, pcmcia_write_cis_mem(s, 1, addr, 1, &val); break; default: + dev_dbg(&s->dev, "Invalid conf register request\n"); return -EINVAL; break; } @@ -264,10 +267,14 @@ int pcmcia_modify_configuration(struct pcmcia_device *p_dev, s = p_dev->socket; c = p_dev->function_config; - if (!(s->state & SOCKET_PRESENT)) + if (!(s->state & SOCKET_PRESENT)) { + dev_dbg(&s->dev, "No card present\n"); return -ENODEV; - if (!(c->state & CONFIG_LOCKED)) + } + if (!(c->state & CONFIG_LOCKED)) { + dev_dbg(&s->dev, "Configuration isnt't locked\n"); return -EACCES; + } if (mod->Attributes & CONF_IRQ_CHANGE_VALID) { if (mod->Attributes & CONF_ENABLE_IRQ) { @@ -442,8 +449,10 @@ int pcmcia_release_window(window_handle_t win) if ((win == NULL) || (win->magic != WINDOW_MAGIC)) return -EINVAL; s = win->sock; - if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) + if (!(win->handle->_win & CLIENT_WIN_REQ(win->index))) { + dev_dbg(&s->dev, "not releasing unknown window\n"); return -EINVAL; + } /* Shut down memory window */ win->ctl.flags &= ~MAP_ACTIVE; @@ -482,8 +491,10 @@ int pcmcia_request_configuration(struct pcmcia_device *p_dev, return -EINVAL; } c = p_dev->function_config; - if (c->state & CONFIG_LOCKED) + if (c->state & CONFIG_LOCKED) { + dev_dbg(&s->dev, "Configuration is locked\n"); return -EACCES; + } /* Do power control. We don't allow changes in Vcc. */ s->socket.Vpp = req->Vpp; @@ -595,14 +606,18 @@ int pcmcia_request_io(struct pcmcia_device *p_dev, io_req_t *req) struct pcmcia_socket *s = p_dev->socket; config_t *c; - if (!(s->state & SOCKET_PRESENT)) + if (!(s->state & SOCKET_PRESENT)) { + dev_dbg(&s->dev, "No card present\n"); return -ENODEV; + } if (!req) return -EINVAL; c = p_dev->function_config; - if (c->state & CONFIG_LOCKED) + if (c->state & CONFIG_LOCKED) { + dev_dbg(&s->dev, "Configuration is locked\n"); return -EACCES; + } if (c->state & CONFIG_IO_REQ) { dev_dbg(&s->dev, "IO already configured\n"); return -EBUSY; @@ -666,11 +681,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req) int ret = -EINVAL, irq = 0; int type; - if (!(s->state & SOCKET_PRESENT)) + if (!(s->state & SOCKET_PRESENT)) { + dev_dbg(&s->dev, "No card present\n"); return -ENODEV; + } c = p_dev->function_config; - if (c->state & CONFIG_LOCKED) + if (c->state & CONFIG_LOCKED) { + dev_dbg(&s->dev, "Configuration is locked\n"); return -EACCES; + } if (c->state & CONFIG_I
[PATCH 09/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (ray-cs.c)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-wirel...@vger.kernel.org CC: net...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/net/wireless/ray_cs.c | 347 - 1 files changed, 169 insertions(+), 178 deletions(-) diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c index 88cd58e..28db791 100644 --- a/drivers/net/wireless/ray_cs.c +++ b/drivers/net/wireless/ray_cs.c @@ -71,25 +71,7 @@ typedef u_char mac_addr[ETH_ALEN]; /* Hardware address */ #include "rayctl.h" #include "ray_cs.h" -/* All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If - you do not define PCMCIA_DEBUG at all, all the debug code will be - left out. If you compile with PCMCIA_DEBUG=0, the debug code will - be present but disabled -- but it can then be enabled for specific - modules at load time with a 'pc_debug=#' option to insmod. -*/ -#ifdef RAYLINK_DEBUG -#define PCMCIA_DEBUG RAYLINK_DEBUG -#endif -#ifdef PCMCIA_DEBUG -static int ray_debug; -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0); -/* #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args); */ -#define DEBUG(n, args...) if (pc_debug > (n)) printk(args); -#else -#define DEBUG(n, args...) -#endif /** Prototypes based on PCMCIA skeleton driver ***/ static int ray_config(struct pcmcia_device *link); static void ray_release(struct pcmcia_device *link); @@ -325,7 +307,7 @@ static int ray_probe(struct pcmcia_device *p_dev) ray_dev_t *local; struct net_device *dev; - DEBUG(1, "ray_attach()\n"); + dev_dbg(&p_dev->dev, "ray_attach()\n"); /* Allocate space for private device-specific data */ dev = alloc_etherdev(sizeof(ray_dev_t)); @@ -357,7 +339,7 @@ static int ray_probe(struct pcmcia_device *p_dev) local->card_status = CARD_INSERTED; local->authentication_state = UNAUTHENTICATED; local->num_multi = 0; - DEBUG(2, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", + dev_dbg(&p_dev->dev, "ray_attach p_dev = %p, dev = %p, local = %p, intr = %p\n", p_dev, dev, local, &ray_interrupt); /* Raylink entries in the device structure */ @@ -370,7 +352,7 @@ static int ray_probe(struct pcmcia_device *p_dev) #endif /* WIRELESS_SPY */ - DEBUG(2, "ray_cs ray_attach calling ether_setup.)\n"); + dev_dbg(&p_dev->dev, "ray_cs ray_attach calling ether_setup.)\n"); netif_stop_queue(dev); init_timer(&local->timer); @@ -393,7 +375,7 @@ static void ray_detach(struct pcmcia_device *link) struct net_device *dev; ray_dev_t *local; - DEBUG(1, "ray_detach(0x%p)\n", link); + dev_dbg(&link->dev, "ray_detach\n"); this_device = NULL; dev = link->priv; @@ -408,7 +390,7 @@ static void ray_detach(struct pcmcia_device *link) unregister_netdev(dev); free_netdev(dev); } - DEBUG(2, "ray_cs ray_detach ending\n"); + dev_dbg(&link->dev, "ray_cs ray_detach ending\n"); } /* ray_detach */ /*= @@ -416,19 +398,17 @@ static void ray_detach(struct pcmcia_device *link) is received, to configure the PCMCIA socket, and to make the ethernet device available to the system. =*/ -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) #define MAX_TUPLE_SIZE 128 static int ray_config(struct pcmcia_device *link) { - int last_fn = 0, last_ret = 0; + int ret = 0; int i; win_req_t req; memreq_t mem; struct net_device *dev = (struct net_device *)link->priv; ray_dev_t *local = netdev_priv(dev); - DEBUG(1, "ray_config(0x%p)\n", link); + dev_dbg(&link->dev, "ray_config\n"); /* Determine card type and firmware version */ printk(KERN_INFO "ray_cs Detected: %s%s%s%s\n", @@ -440,14 +420,17 @@ static int ray_config(struct pcmcia_device *link) /* Now allocate an interrupt line. Note that this does not actually assign a handler to the interrupt. */ - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); + ret = pcmcia_request_irq(link, &link->irq); + if (ret) + goto failed; dev->irq = link->irq.AssignedIRQ; /* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping. */ -
[PATCH 04/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (ide)
ide-cs.c is the only PCMCIA device driver making use of CONFIG_PCMCIA_DEBUG, so convert it to use the dynamic debug infrastructure. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/ata/pata_pcmcia.c | 16 drivers/ide/ide-cs.c | 32 +++- 2 files changed, 19 insertions(+), 29 deletions(-) diff --git a/drivers/ata/pata_pcmcia.c b/drivers/ata/pata_pcmcia.c index dc99e26..5f94e21 100644 --- a/drivers/ata/pata_pcmcia.c +++ b/drivers/ata/pata_pcmcia.c @@ -177,9 +177,6 @@ static struct ata_port_operations pcmcia_8bit_port_ops = { .drain_fifo = pcmcia_8bit_drain_fifo, }; -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) - struct pcmcia_config_check { unsigned long ctl_base; @@ -252,7 +249,7 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) struct ata_port *ap; struct ata_pcmcia_info *info; struct pcmcia_config_check *stk = NULL; - int last_ret = 0, last_fn = 0, is_kme = 0, ret = -ENOMEM, p; + int is_kme = 0, ret = -ENOMEM, p; unsigned long io_base, ctl_base; void __iomem *io_addr, *ctl_addr; int n_ports = 1; @@ -296,8 +293,13 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) } io_base = pdev->io.BasePort1; ctl_base = stk->ctl_base; - CS_CHECK(RequestIRQ, pcmcia_request_irq(pdev, &pdev->irq)); - CS_CHECK(RequestConfiguration, pcmcia_request_configuration(pdev, &pdev->conf)); + ret = pcmcia_request_irq(pdev, &pdev->irq); + if (ret) + goto failed; + + ret = pcmcia_request_configuration(pdev, &pdev->conf); + if (ret) + goto failed; /* iomap */ ret = -ENOMEM; @@ -351,8 +353,6 @@ static int pcmcia_init_one(struct pcmcia_device *pdev) kfree(stk); return 0; -cs_failed: - cs_error(pdev, last_fn, last_ret); failed: kfree(stk); info->ndev = 0; diff --git a/drivers/ide/ide-cs.c b/drivers/ide/ide-cs.c index 063b933..6cee6c8 100644 --- a/drivers/ide/ide-cs.c +++ b/drivers/ide/ide-cs.c @@ -60,15 +60,6 @@ MODULE_AUTHOR("David Hinds "); MODULE_DESCRIPTION("PCMCIA ATA/IDE card driver"); MODULE_LICENSE("Dual MPL/GPL"); -#define INT_MODULE_PARM(n, v) static int n = v; module_param(n, int, 0) - -#ifdef CONFIG_PCMCIA_DEBUG -INT_MODULE_PARM(pc_debug, 0); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -#else -#define DEBUG(n, args...) -#endif - /**/ typedef struct ide_info_t { @@ -98,7 +89,7 @@ static int ide_probe(struct pcmcia_device *link) { ide_info_t *info; -DEBUG(0, "ide_attach()\n"); +dev_dbg(&link->dev, "ide_attach()\n"); /* Create new ide device */ info = kzalloc(sizeof(*info), GFP_KERNEL); @@ -134,7 +125,7 @@ static void ide_detach(struct pcmcia_device *link) ide_hwif_t *hwif = info->host->ports[0]; unsigned long data_addr, ctl_addr; -DEBUG(0, "ide_detach(0x%p)\n", link); +dev_dbg(&link->dev, "ide_detach(0x%p)\n", link); data_addr = hwif->io_ports.data_addr; ctl_addr = hwif->io_ports.ctl_addr; @@ -217,9 +208,6 @@ out_release: ==*/ -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) - struct pcmcia_config_check { unsigned long ctl_base; int skip_vcc; @@ -282,11 +270,11 @@ static int ide_config(struct pcmcia_device *link) { ide_info_t *info = link->priv; struct pcmcia_config_check *stk = NULL; -int last_ret = 0, last_fn = 0, is_kme = 0; +int ret = 0, is_kme = 0; unsigned long io_base, ctl_base; struct ide_host *host; -DEBUG(0, "ide_config(0x%p)\n", link); +dev_dbg(&link->dev, "ide_config(0x%p)\n", link); is_kme = ((link->manf_id == MANFID_KME) && ((link->card_id == PRODID_KME_KXLC005_A) || @@ -306,8 +294,12 @@ static int ide_config(struct pcmcia_device *link) io_base = link->io.BasePort1; ctl_base = stk->ctl_base; -CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); -CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); +ret = pcmcia_request_irq(link, &link->irq); +if (ret) + goto failed; +ret = pcmcia_request_configuration(link, &link->conf); +if (ret) + goto failed; /* disable drive interrupts during IDE probe */ outb(0x02, ctl_base); @@ -342,8 +334,6 @@ err_mem: printk(KERN_NOTICE "ide-cs: ide_config failed memory allocation\n"); goto fai
[PATCH 10/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (wireless)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-wirel...@vger.kernel.org CC: net...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/net/wireless/airo_cs.c | 48 +-- drivers/net/wireless/atmel_cs.c| 46 +-- drivers/net/wireless/hostap/hostap_cs.c| 23 +++- drivers/net/wireless/netwave_cs.c | 88 +++ drivers/net/wireless/orinoco/orinoco_cs.c | 27 +++- drivers/net/wireless/orinoco/spectrum_cs.c | 54 +- drivers/net/wireless/wavelan_cs.c | 24 drivers/net/wireless/wl3501_cs.c | 67 -- 8 files changed, 136 insertions(+), 241 deletions(-) diff --git a/drivers/net/wireless/airo_cs.c b/drivers/net/wireless/airo_cs.c index d0593ed..a1b84fc 100644 --- a/drivers/net/wireless/airo_cs.c +++ b/drivers/net/wireless/airo_cs.c @@ -43,21 +43,6 @@ #include "airo.h" -/* - All the PCMCIA modules use PCMCIA_DEBUG to control debugging. If - you do not define PCMCIA_DEBUG at all, all the debug code will be - left out. If you compile with PCMCIA_DEBUG=0, the debug code will - be present but disabled -- but it can then be enabled for specific - modules at load time with a 'pc_debug=#' option to insmod. -*/ -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0); -static char *version = "$Revision: 1.2 $"; -#define DEBUG(n, args...) if (pc_debug > (n)) printk(KERN_DEBUG args); -#else -#define DEBUG(n, args...) -#endif /**/ @@ -145,7 +130,7 @@ static int airo_probe(struct pcmcia_device *p_dev) { local_info_t *local; - DEBUG(0, "airo_attach()\n"); + dev_dbg(&p_dev->dev, "airo_attach()\n"); /* Interrupt setup */ p_dev->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING; @@ -184,7 +169,7 @@ static int airo_probe(struct pcmcia_device *p_dev) static void airo_detach(struct pcmcia_device *link) { - DEBUG(0, "airo_detach(0x%p)\n", link); + dev_dbg(&link->dev, "airo_detach\n"); airo_release(link); @@ -204,9 +189,6 @@ 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) - static int airo_cs_config_check(struct pcmcia_device *p_dev, cistpl_cftable_entry_t *cfg, cistpl_cftable_entry_t *dflt, @@ -291,11 +273,11 @@ static int airo_config(struct pcmcia_device *link) { local_info_t *dev; win_req_t *req; - int last_fn, last_ret; + int ret; dev = link->priv; - DEBUG(0, "airo_config(0x%p)\n", link); + dev_dbg(&link->dev, "airo_config\n"); req = kzalloc(sizeof(win_req_t), GFP_KERNEL); if (!req) @@ -315,8 +297,8 @@ 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, req); - if (last_ret) + ret = pcmcia_loop_config(link, airo_cs_config_check, req); + if (ret) goto failed; /* @@ -324,21 +306,25 @@ static int airo_config(struct pcmcia_device *link) handler to the interrupt, unless the 'Handler' member of the irq structure is initialized. */ - if (link->conf.Attributes & CONF_ENABLE_IRQ) - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); + if (link->conf.Attributes & CONF_ENABLE_IRQ) { + ret = pcmcia_request_irq(link, &link->irq); + if (ret) + goto failed; + } /* This actually configures the PCMCIA socket -- setting up the I/O windows and the interrupt mapping, and putting the card and host interface into "Memory and IO" mode. */ - CS_CHECK(RequestConfiguration, -pcmcia_request_configuration(link, &link->conf)); + ret = pcmcia_request_configuration(link, &link->conf); + if (ret) + goto failed; ((local_info_t *)link->priv)->eth_dev = init_airo_card(link->irq.AssignedIRQ, link->io.BasePort1, 1, &handle_to_dev(link)); if (!((local_info_t *)link->priv)->eth_dev) - goto cs_failed; + goto failed; /* At this point,
[PATCH 11/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (scsi)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-s...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/scsi/pcmcia/aha152x_stub.c | 40 +++- drivers/scsi/pcmcia/fdomain_stub.c | 43 -- drivers/scsi/pcmcia/qlogic_stub.c | 44 +-- drivers/scsi/pcmcia/sym53c500_cs.c | 41 +++-- 4 files changed, 59 insertions(+), 109 deletions(-) diff --git a/drivers/scsi/pcmcia/aha152x_stub.c b/drivers/scsi/pcmcia/aha152x_stub.c index 67cde01..43ad074 100644 --- a/drivers/scsi/pcmcia/aha152x_stub.c +++ b/drivers/scsi/pcmcia/aha152x_stub.c @@ -54,15 +54,6 @@ #include #include -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0644); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"aha152x_cs.c 1.54 2000/06/12 21:27:25 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif /**/ @@ -103,7 +94,7 @@ static int aha152x_probe(struct pcmcia_device *link) { scsi_info_t *info; -DEBUG(0, "aha152x_attach()\n"); +dev_dbg(&link->dev, "aha152x_attach()\n"); /* Create new SCSI device */ info = kzalloc(sizeof(*info), GFP_KERNEL); @@ -127,7 +118,7 @@ static int aha152x_probe(struct pcmcia_device *link) static void aha152x_detach(struct pcmcia_device *link) { -DEBUG(0, "aha152x_detach(0x%p)\n", link); +dev_dbg(&link->dev, "aha152x_detach\n"); aha152x_release_cs(link); @@ -137,9 +128,6 @@ static void aha152x_detach(struct pcmcia_device *link) /**/ -#define CS_CHECK(fn, ret) \ -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, @@ -164,19 +152,21 @@ static int aha152x_config_cs(struct pcmcia_device *link) { scsi_info_t *info = link->priv; struct aha152x_setup s; -int last_ret, last_fn; +int ret struct Scsi_Host *host; -DEBUG(0, "aha152x_config(0x%p)\n", link); +dev_dbg(&link->dev, "aha152x_config\n"); -last_ret = pcmcia_loop_config(link, aha152x_config_check, NULL); -if (last_ret) { - cs_error(link, RequestIO, last_ret); - goto failed; -} +ret = pcmcia_loop_config(link, aha152x_config_check, NULL); +if (ret) + goto failed; -CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); -CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); +ret = pcmcia_request_irq(link, &link->irq); +if (ret) + goto failed; +ret = pcmcia_request_configuration(link, &link->conf); +if (ret) + goto failed; /* Set configuration options for the aha152x driver */ memset(&s, 0, sizeof(s)); @@ -194,7 +184,7 @@ static int aha152x_config_cs(struct pcmcia_device *link) host = aha152x_probe_one(&s); if (host == NULL) { printk(KERN_INFO "aha152x_cs: no SCSI devices found\n"); - goto cs_failed; + goto failed; } sprintf(info->node.dev_name, "scsi%d", host->host_no); @@ -203,8 +193,6 @@ static int aha152x_config_cs(struct pcmcia_device *link) return 0; -cs_failed: -cs_error(link, last_fn, last_ret); failed: aha152x_release_cs(link); return -ENODEV; diff --git a/drivers/scsi/pcmcia/fdomain_stub.c b/drivers/scsi/pcmcia/fdomain_stub.c index 06254f4..5792b55 100644 --- a/drivers/scsi/pcmcia/fdomain_stub.c +++ b/drivers/scsi/pcmcia/fdomain_stub.c @@ -59,16 +59,6 @@ MODULE_AUTHOR("David Hinds "); MODULE_DESCRIPTION("Future Domain PCMCIA SCSI driver"); MODULE_LICENSE("Dual MPL/GPL"); -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"fdomain_cs.c 1.47 2001/10/13 00:08:52 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif - /**/ typedef struct scsi_info_t { @@ -86,7 +76,7 @@ static int fdomain_probe(struct pcmcia_device *link) { scsi_info_t *info; - DEBUG(0, "fdomain_attach()\n"); + dev_dbg(&link->dev, "fdomain_attach()\n"); /* Create new SCSI device */ info = kzalloc(sizeof(*info), GFP_KERNEL); @@ -111,7 +101,7 @@ static int fdomain_probe(struct pcmcia_devi
[PATCH 01/16] pcmcia: use dynamic debug instead of custom infrastructure
Use the generic "dynamic debug" infrastructure instead of CONIG_PCMCIA_DEBUG in the PCMCIA core (pcmcia.ko and pcmcia_core.ko). To enable debugging, enable CONFIG_DYNAMIC_DEBUG, mount debugfs and $ echo -n 'module pcmcia_core +p' > /sys/kernel/debug/dynamic_debug/control for the complete module "pcmcia_core", for example. For more detailled instructions, please see Documentation/dynamic-debug-howto.txt Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cardbus.c |4 +- drivers/pcmcia/cistpl.c | 10 ++-- drivers/pcmcia/cs.c | 57 ++-- drivers/pcmcia/cs_internal.h | 22 -- drivers/pcmcia/ds.c | 87 +++-- drivers/pcmcia/pcmcia_ioctl.c| 31 - drivers/pcmcia/pcmcia_resource.c | 63 ++- 7 files changed, 100 insertions(+), 174 deletions(-) diff --git a/drivers/pcmcia/cardbus.c b/drivers/pcmcia/cardbus.c index db77e1f..4cd70d0 100644 --- a/drivers/pcmcia/cardbus.c +++ b/drivers/pcmcia/cardbus.c @@ -91,7 +91,7 @@ static u_int xlate_rom_addr(void __iomem *b, u_int addr) static void cb_release_cis_mem(struct pcmcia_socket * s) { if (s->cb_cis_virt) { - cs_dbg(s, 1, "cb_release_cis_mem()\n"); + dev_dbg(&s->dev, "cb_release_cis_mem()\n"); iounmap(s->cb_cis_virt); s->cb_cis_virt = NULL; s->cb_cis_res = NULL; @@ -132,7 +132,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void struct pci_dev *dev; struct resource *res; - cs_dbg(s, 3, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); + dev_dbg(&s->dev, "read_cb_mem(%d, %#x, %u)\n", space, addr, len); dev = pci_get_slot(s->cb_dev->subordinate, 0); if (!dev) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 24dd3c1..8c1b73c 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -138,7 +138,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, void __iomem *sys, *end; unsigned char *buf = ptr; -cs_dbg(s, 3, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); +dev_dbg(&s->dev, "pcmcia_read_cis_mem(%d, %#x, %u)\n", attr, addr, len); if (attr & IS_INDIRECT) { /* Indirect accesses use a bunch of special registers at fixed @@ -190,7 +190,7 @@ int pcmcia_read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, addr = 0; } } -cs_dbg(s, 3, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", +dev_dbg(&s->dev, " %#2.2x %#2.2x %#2.2x %#2.2x ...\n", *(u_char *)(ptr+0), *(u_char *)(ptr+1), *(u_char *)(ptr+2), *(u_char *)(ptr+3)); return 0; @@ -204,7 +204,7 @@ void pcmcia_write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, void __iomem *sys, *end; unsigned char *buf = ptr; -cs_dbg(s, 3, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); +dev_dbg(&s->dev, "pcmcia_write_cis_mem(%d, %#x, %u)\n", attr, addr, len); if (attr & IS_INDIRECT) { /* Indirect accesses use a bunch of special registers at fixed @@ -584,7 +584,7 @@ int pccard_get_next_tuple(struct pcmcia_socket *s, unsigned int function, tuple_ ofs += link[1] + 2; } if (i == MAX_TUPLES) { - cs_dbg(s, 1, "cs: overrun in pcmcia_get_next_tuple\n"); + dev_dbg(&s->dev, "cs: overrun in pcmcia_get_next_tuple\n"); return -ENOSPC; } @@ -1440,7 +1440,7 @@ int pcmcia_parse_tuple(tuple_t *tuple, cisparse_t *parse) break; } if (ret) - __cs_dbg(0, "parse_tuple failed %d\n", ret); + pr_debug("parse_tuple failed %d\n", ret); return ret; } EXPORT_SYMBOL(pcmcia_parse_tuple); diff --git a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c index 934d4be..b0ec9c6 100644 --- a/drivers/pcmcia/cs.c +++ b/drivers/pcmcia/cs.c @@ -61,17 +61,6 @@ INT_MODULE_PARM(unreset_limit, 30);/* unreset_check's */ /* Access speed for attribute memory windows */ INT_MODULE_PARM(cis_speed, 300); /* ns */ -#ifdef CONFIG_PCMCIA_DEBUG -static int pc_debug; - -module_param(pc_debug, int, 0644); - -int cs_debug_level(int level) -{ - return pc_debug > level; -} -#endif - socket_state_t dead_socket = { .csc_mask = SS_DETECT, @@ -182,7 +171,7 @@ int pcmcia_register_socket(struct pcmcia_socket *socket) if (!socket || !socket->ops || !socket->dev.parent || !socket->resource_ops) return -EINVAL; - cs_dbg(socket, 0, "pcmcia_register_socket(0x%p)\n", socket->ops); + dev_dbg(&socket->dev, "pcmcia_register_socket(0x%p)\n", socket->ops); spin_lock_init(&socket->lock); @@ -274,7 +263,7 @@ void pcmcia_unregister_socket(struct pcmcia_socket *socket) if (!socket) return; - cs_dbg(socket, 0, "pcmcia_unregister_socket(0x%p)\n", socket->ops); +
[RFC] more PCMCIA cleanup patches for 2.6.33
Hej, In addition to the patches already submitted as RFC on Oct 19th, I'm interested in your input to this patch series. They'll be sent to the PCMCIA list shortly, with CC to other lists if deemed appropriate. If all goes well, I'll ask Linus to pull both patch series once 2.6.32 is released. pcmcia: use dynamic debug instead of custom infrastructure pcmcia: use dynamic debug in PCMCIA socket drivers pcmcia: extend error reporting and debug messages in core pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (ide) pcmcia: deprecate CS_CHECK (bluetooth) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (char) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (isdn) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (net) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (ray-cs.c) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (wireless) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (scsi) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (serial_cs) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (sound) pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (misc drivers) pcmcia: remove now-defunct cs_error, pcmcia_error_{func,ret} pcmcia: use dev_dbg and dev_print in pd6729.c Documentation/pcmcia/driver-changes.txt|5 + drivers/ata/pata_pcmcia.c | 16 +- drivers/bluetooth/bluecard_cs.c| 12 +- drivers/bluetooth/bt3c_cs.c|9 +- drivers/bluetooth/btuart_cs.c |9 +- drivers/bluetooth/dtl1_cs.c|8 +- drivers/char/pcmcia/cm4000_cs.c| 69 ++ drivers/char/pcmcia/cm4040_cs.c| 42 ++-- drivers/char/pcmcia/ipwireless/main.c | 34 +-- drivers/char/pcmcia/synclink_cs.c | 23 +- drivers/ide/ide-cs.c | 32 +-- drivers/isdn/hardware/avm/avm_cs.c |2 - drivers/isdn/hisax/avma1_cs.c | 26 +-- drivers/isdn/hisax/elsa_cs.c | 45 +--- drivers/isdn/hisax/sedlbauer_cs.c | 58 ++--- drivers/isdn/hisax/teles_cs.c | 37 +--- drivers/mtd/maps/pcmciamtd.c | 14 +- drivers/net/pcmcia/3c574_cs.c | 66 +++--- drivers/net/pcmcia/3c589_cs.c | 75 ++ drivers/net/pcmcia/axnet_cs.c | 53 ++--- drivers/net/pcmcia/com20020_cs.c | 55 ++--- drivers/net/pcmcia/fmvj18x_cs.c| 109 +++-- drivers/net/pcmcia/ibmtr_cs.c | 54 ++--- drivers/net/pcmcia/nmclan_cs.c | 148 +--- drivers/net/pcmcia/pcnet_cs.c | 67 ++ drivers/net/pcmcia/smc91c92_cs.c | 85 +++- drivers/net/pcmcia/xirc2ps_cs.c| 111 -- drivers/net/wireless/airo_cs.c | 48 ++--- drivers/net/wireless/atmel_cs.c| 46 ++--- drivers/net/wireless/hostap/hostap_cs.c| 23 +-- drivers/net/wireless/netwave_cs.c | 88 +++ drivers/net/wireless/orinoco/orinoco_cs.c | 27 +-- drivers/net/wireless/orinoco/spectrum_cs.c | 54 +++--- drivers/net/wireless/ray_cs.c | 347 ++-- drivers/net/wireless/wavelan_cs.c | 24 -- drivers/net/wireless/wl3501_cs.c | 67 ++ drivers/parport/parport_cs.c | 37 +-- drivers/pcmcia/Kconfig | 36 ++-- drivers/pcmcia/cardbus.c |4 +- drivers/pcmcia/cistpl.c| 10 +- drivers/pcmcia/cs.c| 60 +++--- drivers/pcmcia/cs_internal.h | 22 -- drivers/pcmcia/ds.c| 188 +++ drivers/pcmcia/i82365.c| 37 +-- drivers/pcmcia/m32r_cfc.c | 105 - drivers/pcmcia/m32r_pcc.c | 51 ++--- drivers/pcmcia/m8xx_pcmcia.c | 40 ++-- drivers/pcmcia/pcmcia_ioctl.c | 31 +-- drivers/pcmcia/pcmcia_resource.c | 126 ++- drivers/pcmcia/pd6729.c| 69 +++--- drivers/pcmcia/pd6729.h|7 - drivers/pcmcia/tcic.c | 29 +-- drivers/scsi/pcmcia/aha152x_stub.c | 40 ++-- drivers/scsi/pcmcia/fdomain_stub.c | 43 ++--- drivers/scsi/pcmcia/qlogic_stub.c | 44 ++--- drivers/scsi/pcmcia/sym53c500_cs.c | 41 ++--- drivers/serial/serial_cs.c | 53 ++--- drivers/telephony/ixj_pcmcia.c | 36 +-- drivers/usb/host/sl811_cs.c| 46 +--- include/pcmcia/ds.h| 36 --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 21 +- sound/pcmcia/vx/vxpocket.c | 21 +- 62 files changed, 1204 insertions(+), 2017 deletions(-) Best,
[PATCH 02/16] pcmcia: use dynamic debug in PCMCIA socket drivers
Make use of the dynamic debug infrastructure in various PCMCIA socket drivers. By doing so, only the drivers relying on soc_common make use of CONFIG_PCMCIA_DEBUG. Therefore, update the Kconfig entry accordingly. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/Kconfig | 36 +++--- drivers/pcmcia/i82365.c | 37 -- drivers/pcmcia/m32r_cfc.c| 105 ++--- drivers/pcmcia/m32r_pcc.c| 51 drivers/pcmcia/m8xx_pcmcia.c | 40 ++-- drivers/pcmcia/tcic.c| 29 +++- 6 files changed, 118 insertions(+), 180 deletions(-) diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index 17f38a7..0c44ddd 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig @@ -17,24 +17,6 @@ menuconfig PCCARD if PCCARD -config PCMCIA_DEBUG - bool "Enable PCCARD debugging" - help - Say Y here to enable PCMCIA subsystem debugging. You - will need to choose the debugging level either via the - kernel command line, or module options depending whether - you build the PCMCIA as modules. - - The kernel command line options are: - pcmcia_core.pc_debug=N - pcmcia.pc_debug=N - sa11xx_core.pc_debug=N - - The module option is called pc_debug=N - - In all the above examples, N is the debugging verbosity - level. - config PCMCIA tristate "16-bit PCMCIA support" select CRC32 @@ -225,6 +207,24 @@ config PCMCIA_PXA2XX help Say Y here to include support for the PXA2xx PCMCIA controller +config PCMCIA_DEBUG + bool "Enable debugging" + depends on (PCMCIA_SA || PCMCIA_SA1100 || PCMCIA_PXA2XX) + help + Say Y here to enable debugging for the SoC PCMCIA layer. + You will need to choose the debugging level either via the + kernel command line, or module options depending whether + you build the drivers as modules. + + The kernel command line options are: + sa11xx_core.pc_debug=N + pxa2xx_core.pc_debug=N + + The module option is called pc_debug=N + + In all the above examples, N is the debugging verbosity + level. + config PCMCIA_PROBE bool default y if ISA && !ARCH_SA1100 && !ARCH_CLPS711X && !PARISC diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index a4aacb8..c13fd93 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -63,21 +63,6 @@ #include "vg468.h" #include "ricoh.h" -#ifdef CONFIG_PCMCIA_DEBUG -static const char version[] = -"i82365.c 1.265 1999/11/10 18:36:21 (David Hinds)"; - -static int pc_debug; - -module_param(pc_debug, int, 0644); - -#define debug(lvl, fmt, arg...) do { \ - if (pc_debug > (lvl)) \ - printk(KERN_DEBUG "i82365: " fmt , ## arg); \ -} while (0) -#else -#define debug(lvl, fmt, arg...) do { } while (0) -#endif static irqreturn_t i365_count_irq(int, void *); static inline int _check_irq(int irq, int flags) @@ -501,13 +486,13 @@ static irqreturn_t i365_count_irq(int irq, void *dev) { i365_get(irq_sock, I365_CSC); irq_hits++; -debug(2, "-> hit on irq %d\n", irq); +pr_debug("i82365: -> hit on irq %d\n", irq); return IRQ_HANDLED; } static u_int __init test_irq(u_short sock, int irq) { -debug(2, " testing ISA irq %d\n", irq); +pr_debug("i82365: testing ISA irq %d\n", irq); if (request_irq(irq, i365_count_irq, IRQF_PROBE_SHARED, "scan", i365_count_irq) != 0) return 1; @@ -515,7 +500,7 @@ static u_int __init test_irq(u_short sock, int irq) msleep(10); if (irq_hits) { free_irq(irq, i365_count_irq); - debug(2, "spurious hit!\n"); + pr_debug("i82365:spurious hit!\n"); return 1; } @@ -528,7 +513,7 @@ static u_int __init test_irq(u_short sock, int irq) /* mask all interrupts */ i365_set(sock, I365_CSCINT, 0); -debug(2, "hits = %d\n", irq_hits); +pr_debug("i82365:hits = %d\n", irq_hits); return (irq_hits != 1); } @@ -854,7 +839,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) u_long flags = 0; int handled = 0; -debug(4, "pcic_interrupt(%d)\n", irq); +pr_debug("pcic_interrupt(%d)\n", irq); for (j = 0; j < 20; j++) { active = 0; @@ -878,7 +863,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) events |= (csc & I365_CSC_READY) ? SS_READY : 0; } ISA_UNLOCK(i, flags); - debug(2, "socket %d event 0x%02x\n", i, events); + pr_debug("socket %d event 0x%02x\n", i, events); if (events) pcmcia_parse_events(&socket[i].socket, events); @@ -890,7 +875,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev) if (j ==
[PATCH 14/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (misc drivers)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-...@lists.infradead.org CC: linux-...@vger.kernel.org Signed-off-by: Dominik Brodowski --- drivers/mtd/maps/pcmciamtd.c | 14 +-- drivers/parport/parport_cs.c | 37 +++ drivers/telephony/ixj_pcmcia.c | 36 +++ drivers/usb/host/sl811_cs.c| 46 +++ 4 files changed, 41 insertions(+), 92 deletions(-) diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 52c07f2..fa00919 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c @@ -119,10 +119,8 @@ static caddr_t remap_window(struct map_info *map, unsigned long to) dev->offset, mrq.CardOffset); mrq.Page = 0; ret = pcmcia_map_mem_page(win, &mrq); - if (ret != 0) { - cs_error(dev->p_dev, MapMemPage, ret); + if (ret != 0) return NULL; - } dev->offset = mrq.CardOffset; } return dev->win_base + (to & (dev->win_size-1)); @@ -327,8 +325,6 @@ 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 != 0) - cs_error(link, ModifyConfiguration, ret); } @@ -488,16 +484,12 @@ static void card_settings(struct pcmciamtd_dev *dev, struct pcmcia_device *link, * MTD device available to the system. */ -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) - static int pcmciamtd_config(struct pcmcia_device *link) { struct pcmciamtd_dev *dev = link->priv; struct mtd_info *mtd = NULL; cs_status_t status; win_req_t req; - int last_ret = 0, last_fn = 0; int ret; int i; static char *probes[] = { "jedec_probe", "cfi_probe" }; @@ -584,7 +576,6 @@ static int pcmciamtd_config(struct pcmcia_device *link) DEBUG(2, "Setting Configuration"); ret = pcmcia_request_configuration(link, &link->conf); if (ret != 0) { - cs_error(link, RequestConfiguration, ret); if (dev->win_base) { iounmap(dev->win_base); dev->win_base = NULL; @@ -659,8 +650,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) link->dev_node = &dev->node; return 0; - cs_failed: - cs_error(link, last_fn, last_ret); + failed: err("CS Error, exiting"); pcmciamtd_release(link); return -ENODEV; diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c index 8fdfa4f..e56a4de 100644 --- a/drivers/parport/parport_cs.c +++ b/drivers/parport/parport_cs.c @@ -67,14 +67,6 @@ MODULE_LICENSE("Dual MPL/GPL"); INT_MODULE_PARM(epp_mode, 1); -#ifdef PCMCIA_DEBUG -INT_MODULE_PARM(pc_debug, PCMCIA_DEBUG); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = -"parport_cs.c 1.29 2002/10/11 06:57:41 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif /**/ @@ -103,7 +95,7 @@ static int parport_probe(struct pcmcia_device *link) { parport_info_t *info; -DEBUG(0, "parport_attach()\n"); +dev_dbg(&link->dev, "parport_attach()\n"); /* Create new parport device */ info = kzalloc(sizeof(*info), GFP_KERNEL); @@ -132,7 +124,7 @@ static int parport_probe(struct pcmcia_device *link) static void parport_detach(struct pcmcia_device *link) { -DEBUG(0, "parport_detach(0x%p)\n", link); +dev_dbg(&link->dev, "parport_detach\n"); parport_cs_release(link); @@ -147,9 +139,6 @@ static void parport_detach(struct pcmcia_device *link) ==*/ -#define CS_CHECK(fn, ret) \ -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, @@ -178,18 +167,20 @@ static int parport_config(struct pcmcia_device *link) { parport_info_t *info = link->priv; struct parport *p; -int last_ret, last_fn; +int ret; -DEBUG(0, "parport_config(0x%p)\n", link); +dev_dbg(&link->dev, "parport_config\n"); -last_ret = pcmcia_loop_config(link, parport_config_check, NULL); -if (last_ret) { -
[PATCH 16/16] pcmcia: use dev_dbg and dev_print in pd6729.c
As suggested by Wolfram Sang , use dev_dbg() and dev_printk() in pd6729.c. CC: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pd6729.c | 69 ++- drivers/pcmcia/pd6729.h |7 - 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 70a3346..509a648 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -213,7 +213,8 @@ static irqreturn_t pd6729_interrupt(int irq, void *dev) if (csc & I365_CSC_DETECT) { events |= SS_DETECT; - dprintk("Card detected in socket %i!\n", i); + dev_dbg(&socket[i].socket.dev, + "Card detected in socket %i!\n", i); } if (indirect_read(&socket[i], I365_INTCTL) @@ -331,11 +332,11 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) reg = I365_PWR_NORESET; /* default: disable resetdrv on resume */ if (state->flags & SS_PWR_AUTO) { - dprintk("Auto power\n"); + dev_dbg(&sock->dev, "Auto power\n"); reg |= I365_PWR_AUTO; /* automatic power mngmnt */ } if (state->flags & SS_OUTPUT_ENA) { - dprintk("Power Enabled\n"); + dev_dbg(&sock->dev, "Power Enabled\n"); reg |= I365_PWR_OUT;/* enable power */ } @@ -343,40 +344,44 @@ static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state) case 0: break; case 33: - dprintk("setting voltage to Vcc to 3.3V on socket %i\n", + dev_dbg(&sock->dev, + "setting voltage to Vcc to 3.3V on socket %i\n", socket->number); reg |= I365_VCC_5V; indirect_setbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); break; case 50: - dprintk("setting voltage to Vcc to 5V on socket %i\n", + dev_dbg(&sock->dev, + "setting voltage to Vcc to 5V on socket %i\n", socket->number); reg |= I365_VCC_5V; indirect_resetbit(socket, PD67_MISC_CTL_1, PD67_MC1_VCC_3V); break; default: - dprintk("pd6729: pd6729_set_socket called with " - "invalid VCC power value: %i\n", - state->Vcc); + dev_dbg(&sock->dev, + "pd6729_set_socket called with invalid VCC power " + "value: %i\n", state->Vcc); return -EINVAL; } switch (state->Vpp) { case 0: - dprintk("not setting Vpp on socket %i\n", socket->number); + dev_dbg(&sock->dev, "not setting Vpp on socket %i\n", + socket->number); break; case 33: case 50: - dprintk("setting Vpp to Vcc for socket %i\n", socket->number); + dev_dbg(&sock->dev, "setting Vpp to Vcc for socket %i\n", + socket->number); reg |= I365_VPP1_5V; break; case 120: - dprintk("setting Vpp to 12.0\n"); + dev_dbg(&sock->dev, "setting Vpp to 12.0\n"); reg |= I365_VPP1_12V; break; default: - dprintk("pd6729: pd6729_set_socket called with invalid VPP power value: %i\n", - state->Vpp); + dev_dbg(&sock->dev, "pd6729: pd6729_set_socket called with " + "invalid VPP power value: %i\n", state->Vpp); return -EINVAL; } @@ -438,7 +443,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, /* Check error conditions */ if (map > 1) { - dprintk("pd6729_set_io_map with invalid map"); + dev_dbg(&sock->dev, "pd6729_set_io_map with invalid map"); return -EINVAL; } @@ -446,7 +451,7 @@ static int pd6729_set_io_map(struct pcmcia_socket *sock, if (indirect_read(socket, I365_ADDRWIN) & I365_ENA_IO(map)) indirect_resetbit(socket, I365_ADDRWIN, I365_ENA_IO(map)); - /* dprintk("set_io_map: Setting range to %x - %x\n", + /* dev_dbg(&sock->dev, "set_io_map: Setting range to %x - %x\n", io->start, io->stop);*/ /* write the new values */ @@ -529,12 +534,12 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, if (mem->flags & MAP_WRPROT) i |= I365_MEM_WRPROT; if (mem->flags & MAP_ATTRIB) { - /* dprintk("requesting attribute memory for socket %i\n", - socket->number);*/ + /* dev_d
[PATCH 06/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (char)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Only some rare extra debug checks in cm4000_cs.c cm4040_cs.c are now hidden behind a "#ifdef CM4000_DEBUG" or "#ifdef CM4040_DEBUG". Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Harald Welte CC: Jiri Kosina CC: David Sterba Signed-off-by: Dominik Brodowski --- drivers/char/pcmcia/cm4000_cs.c | 69 - drivers/char/pcmcia/cm4040_cs.c | 42 drivers/char/pcmcia/ipwireless/main.c | 34 drivers/char/pcmcia/synclink_cs.c | 23 +-- 4 files changed, 61 insertions(+), 107 deletions(-) diff --git a/drivers/char/pcmcia/cm4000_cs.c b/drivers/char/pcmcia/cm4000_cs.c index c250a31..2904d5f 100644 --- a/drivers/char/pcmcia/cm4000_cs.c +++ b/drivers/char/pcmcia/cm4000_cs.c @@ -23,8 +23,6 @@ * All rights reserved. Licensed under dual BSD/GPL license. */ -/* #define PCMCIA_DEBUG 6 */ - #include #include #include @@ -47,18 +45,17 @@ /* #define ATR_CSUM */ -#ifdef PCMCIA_DEBUG #define reader_to_dev(x) (&handle_to_dev(x->p_dev)) -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0600); -#define DEBUGP(n, rdr, x, args...) do {\ - if (pc_debug >= (n))\ - dev_printk(KERN_DEBUG, reader_to_dev(rdr), "%s:" x, \ - __func__ , ## args); \ + +/* n (debug level) is ignored */ +/* additional debug output may be enabled by re-compiling with + * CM4000_DEBUG set */ +/* #define CM4000_DEBUG */ +#define DEBUGP(n, rdr, x, args...) do {\ + dev_dbg(reader_to_dev(rdr), "%s:" x,\ + __func__ , ## args); \ } while (0) -#else -#define DEBUGP(n, rdr, x, args...) -#endif + static char *version = "cm4000_cs.c v2.4.0gm6 - All bugs added by Harald Welte"; #defineT_1SEC (HZ) @@ -174,14 +171,13 @@ static unsigned char fi_di_table[10][14] = { /* 9 */ {0x09,0x19,0x29,0x39,0x49,0x59,0x69,0x11,0x11,0x99,0xA9,0xB9,0xC9,0xD9} }; -#ifndef PCMCIA_DEBUG +#ifndef CM4000_DEBUG #definexoutb outb #definexinbinb #else static inline void xoutb(unsigned char val, unsigned short port) { - if (pc_debug >= 7) - printk(KERN_DEBUG "outb(val=%.2x,port=%.4x)\n", val, port); + pr_debug("outb(val=%.2x,port=%.4x)\n", val, port); outb(val, port); } static inline unsigned char xinb(unsigned short port) @@ -189,8 +185,7 @@ static inline unsigned char xinb(unsigned short port) unsigned char val; val = inb(port); - if (pc_debug >= 7) - printk(KERN_DEBUG "%.2x=inb(%.4x)\n", val, port); + pr_debug("%.2x=inb(%.4x)\n", val, port); return val; } @@ -514,12 +509,10 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) for (i = 0; i < 4; i++) { xoutb(i, REG_BUF_ADDR(iobase)); xoutb(dev->pts[i], REG_BUF_DATA(iobase)); /* buf data */ -#ifdef PCMCIA_DEBUG - if (pc_debug >= 5) - printk("0x%.2x ", dev->pts[i]); +#ifdef CM4000_DEBUG + pr_debug("0x%.2x ", dev->pts[i]); } - if (pc_debug >= 5) - printk("\n"); + pr_debug("\n"); #else } #endif @@ -579,14 +572,13 @@ static int set_protocol(struct cm4000_dev *dev, struct ptsreq *ptsreq) pts_reply[i] = inb(REG_BUF_DATA(iobase)); } -#ifdef PCMCIA_DEBUG +#ifdef CM4000_DEBUG DEBUGP(2, dev, "PTSreply: "); for (i = 0; i < num_bytes_read; i++) { - if (pc_debug >= 5) - printk("0x%.2x ", pts_reply[i]); + pr_debug("0x%.2x ", pts_reply[i]); } - printk("\n"); -#endif /* PCMCIA_DEBUG */ + pr_debug("\n"); +#endif /* CM4000_DEBUG */ DEBUGP(5, dev, "Clear Tactive in Flags1\n"); xoutb(0x20, REG_FLAGS1(iobase)); @@ -655,7 +647,7 @@ static void terminate_monitor(struct cm4000_dev *dev) DEBUGP(5, dev, "Delete timer\n"); del_timer_sync(&dev->timer); -#ifdef PCMCIA_DEBUG +#ifdef CM4000_DEBUG dev->monitor_running = 0; #endif @@ -898,7 +890,7 @@ static void monitor_card(unsigned long p) DEBUGP(4, dev, "ATR checksum (0x%.2x, should " "be zero) failed\n", dev->atr_csum); } -#ifdef PCMCIA_DEBUG +#ifdef CM4000_DEBUG else if (test_bit(IS_BAD_LENGTH, &dev->flags)) { DEBUGP(4, dev, "ATR length error\n");
[PATCH 15/16] pcmcia: remove now-defunct cs_error, pcmcia_error_{func, ret}
As all in-tree drivers have been converted to not use cs_error() any more, drop these functions and definitions, and update the Documentation. Signed-off-by: Dominik Brodowski --- Documentation/pcmcia/driver-changes.txt |5 ++ drivers/pcmcia/ds.c | 101 --- include/pcmcia/ds.h | 36 --- 3 files changed, 5 insertions(+), 137 deletions(-) diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt index adfb83e..446f43b 100644 --- a/Documentation/pcmcia/driver-changes.txt +++ b/Documentation/pcmcia/driver-changes.txt @@ -1,5 +1,10 @@ This file details changes in 2.6 which affect PCMCIA card driver authors: +* no cs_error / CS_CHECK / CONFIG_PCMCIA_DEBUG (as of 2.6.33) + Instead of the cs_error() callback or the CS_CHECK() macro, please use + Linux-style checking of return values, and -- if necessary -- debug + messages using "dev_dbg()" or "pr_debug()". + * New CIS tuple access (as of 2.6.33) Instead of pcmcia_get_{first,next}_tuple(), pcmcia_get_tuple_data() and pcmcia_parse_tuple(), a driver shall use "pcmcia_get_tuple()" if it is diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 5b069ae..05893d4 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -46,107 +46,6 @@ spinlock_t pcmcia_dev_list_lock; /**/ -/* code which was in cs.c before */ - -/* String tables for error messages */ - -typedef struct lookup_t { -const int key; -const char *msg; -} lookup_t; - -static const lookup_t error_table[] = { -{ 0, "Operation succeeded" }, -{ -EIO,"Input/Output error" }, -{ -ENODEV, "No card present" }, -{ -EINVAL, "Bad parameter" }, -{ -EACCES, "Configuration locked" }, -{ -EBUSY, "Resource in use" }, -{ -ENOSPC, "No more items" }, -{ -ENOMEM, "Out of resource" }, -}; - - -static const lookup_t service_table[] = { -{ AccessConfigurationRegister, "AccessConfigurationRegister" }, -{ AddSocketServices, "AddSocketServices" }, -{ AdjustResourceInfo, "AdjustResourceInfo" }, -{ CheckEraseQueue, "CheckEraseQueue" }, -{ CloseMemory, "CloseMemory" }, -{ DeregisterClient,"DeregisterClient" }, -{ DeregisterEraseQueue,"DeregisterEraseQueue" }, -{ GetCardServicesInfo, "GetCardServicesInfo" }, -{ GetClientInfo, "GetClientInfo" }, -{ GetConfigurationInfo,"GetConfigurationInfo" }, -{ GetEventMask,"GetEventMask" }, -{ GetFirstClient, "GetFirstClient" }, -{ GetFirstRegion, "GetFirstRegion" }, -{ GetFirstTuple, "GetFirstTuple" }, -{ GetNextClient, "GetNextClient" }, -{ GetNextRegion, "GetNextRegion" }, -{ GetNextTuple,"GetNextTuple" }, -{ GetStatus, "GetStatus" }, -{ GetTupleData,"GetTupleData" }, -{ MapMemPage, "MapMemPage" }, -{ ModifyConfiguration, "ModifyConfiguration" }, -{ ModifyWindow,"ModifyWindow" }, -{ OpenMemory, "OpenMemory" }, -{ ParseTuple, "ParseTuple" }, -{ ReadMemory, "ReadMemory" }, -{ RegisterClient, "RegisterClient" }, -{ RegisterEraseQueue, "RegisterEraseQueue" }, -{ RegisterMTD, "RegisterMTD" }, -{ ReleaseConfiguration,"ReleaseConfiguration" }, -{ ReleaseIO, "ReleaseIO" }, -{ ReleaseIRQ, "ReleaseIRQ" }, -{ ReleaseWindow, "ReleaseWindow" }, -{ RequestConfiguration,"RequestConfiguration" }, -{ RequestIO, "RequestIO" }, -{ RequestIRQ, "RequestIRQ" }, -{ RequestSocketMask, "RequestSocketMask" }, -{ RequestWindow, "RequestWindow" }, -{ ResetCard, "ResetCard" }, -{ SetEventMask,"SetEventMask" }, -{ ValidateCIS, "ValidateCIS" }, -{ WriteMemory, "WriteMemory" }, -{ BindDevice, "BindDevice" }, -{ BindMTD, "BindMTD" }, -{ ReportError, "ReportError" }, -{ SuspendCard, "SuspendCard" }, -{ ResumeCard, "ResumeCard" }, -{ EjectCard, "EjectCard" }, -{ InsertCard, "InsertCard" }, -
[PATCH 12/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (serial_cs)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: linux-ser...@vger.kernel.org CC: Russell King Signed-off-by: Dominik Brodowski --- drivers/serial/serial_cs.c | 53 ++- 1 files changed, 17 insertions(+), 36 deletions(-) diff --git a/drivers/serial/serial_cs.c b/drivers/serial/serial_cs.c index 7bf02cf..3b31bee 100644 --- a/drivers/serial/serial_cs.c +++ b/drivers/serial/serial_cs.c @@ -54,14 +54,6 @@ #include "8250.h" -#ifdef PCMCIA_DEBUG -static int pc_debug = PCMCIA_DEBUG; -module_param(pc_debug, int, 0644); -#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) -static char *version = "serial_cs.c 1.134 2002/05/04 05:48:53 (David Hinds)"; -#else -#define DEBUG(n, args...) -#endif /**/ @@ -121,24 +113,20 @@ static void quirk_setup_brainboxes_0104(struct pcmcia_device *link, struct uart_ static int quirk_post_ibm(struct pcmcia_device *link) { conf_reg_t reg = { 0, CS_READ, 0x800, 0 }; - int last_ret, last_fn; + int ret; + + ret = pcmcia_access_configuration_register(link, ®); + if (ret) + goto failed; - last_ret = pcmcia_access_configuration_register(link, ®); - if (last_ret) { - last_fn = AccessConfigurationRegister; - goto cs_failed; - } reg.Action = CS_WRITE; reg.Value = reg.Value | 1; - last_ret = pcmcia_access_configuration_register(link, ®); - if (last_ret) { - last_fn = AccessConfigurationRegister; - goto cs_failed; - } + ret = pcmcia_access_configuration_register(link, ®); + if (ret) + goto failed; return 0; - cs_failed: - cs_error(link, last_fn, last_ret); + failed: return -ENODEV; } @@ -283,7 +271,7 @@ static void serial_remove(struct pcmcia_device *link) struct serial_info *info = link->priv; int i; - DEBUG(0, "serial_release(0x%p)\n", link); + dev_dbg(&link->dev, "serial_release\n"); /* * Recheck to see if the device is still configured. @@ -334,7 +322,7 @@ static int serial_probe(struct pcmcia_device *link) { struct serial_info *info; - DEBUG(0, "serial_attach()\n"); + dev_dbg(&link->dev, "serial_attach()\n"); /* Create new serial device */ info = kzalloc(sizeof (*info), GFP_KERNEL); @@ -370,7 +358,7 @@ static void serial_detach(struct pcmcia_device *link) { struct serial_info *info = link->priv; - DEBUG(0, "serial_detach(0x%p)\n", link); + dev_dbg(&link->dev, "serial_detach\n"); /* * Ensure any outstanding scheduled tasks are completed. @@ -507,15 +495,13 @@ static int simple_config(struct pcmcia_device *link) printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n"); - cs_error(link, RequestIO, i); return -1; found_port: i = pcmcia_request_irq(link, &link->irq); - if (i != 0) { - cs_error(link, RequestIRQ, i); + if (i != 0) link->irq.AssignedIRQ = 0; - } + if (info->multi && (info->manfid == MANFID_3COM)) link->conf.ConfigIndex &= ~(0x08); @@ -526,10 +512,8 @@ found_port: info->quirk->config(link); i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) return -1; - } return setup_serial(link, info, link->io.BasePort1, link->irq.AssignedIRQ); } @@ -598,7 +582,6 @@ static int multi_config(struct pcmcia_device *link) /* FIXME: comment does not fit, error handling does not fit */ printk(KERN_NOTICE "serial_cs: no usable port range found, giving up\n"); - cs_error(link, RequestIRQ, i); link->irq.AssignedIRQ = 0; } @@ -609,10 +592,8 @@ static int multi_config(struct pcmcia_device *link) info->quirk->config(link); i = pcmcia_request_configuration(link, &link->conf); - if (i != 0) { - cs_error(link, RequestConfiguration, i); + if (i != 0) return -ENODEV; - } /* The Oxford Semiconductor OXCF950 cards are in fact single-port: * 8 registers are for the UART, the others are extra registers. @@ -682,7 +663,7 @@ static int serial_config(struct pcmcia_device * link) struct serial_info *info = link->priv; int i; - DEBUG(0, "ser
[PATCH 13/16] pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (sound)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Also, remove all usages of the CS_CHECK macro and replace them with proper Linux style calling and return value checking. The extra error reporting may be dropped, as the PCMCIA core already complains about any (non-driver-author) errors. CC: Jaroslav Kysela CC: alsa-de...@alsa-project.org Signed-off-by: Dominik Brodowski --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 21 - sound/pcmcia/vx/vxpocket.c | 21 - 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 7dea74b..64b8599 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -217,20 +217,25 @@ static void snd_pdacf_detach(struct pcmcia_device *link) * configuration callback */ -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) - static int pdacf_config(struct pcmcia_device *link) { struct snd_pdacf *pdacf = link->priv; - int last_fn, last_ret; + int ret; snd_printdd(KERN_DEBUG "pdacf_config called\n"); link->conf.ConfigIndex = 0x5; - CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); - CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); + ret = pcmcia_request_io(link, &link->io); + if (ret) + goto failed; + + ret = pcmcia_request_irq(link, &link->irq); + if (ret) + goto failed; + + ret = pcmcia_request_configuration(link, &link->conf); + if (ret) + goto failed; if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) goto failed; @@ -238,8 +243,6 @@ static int pdacf_config(struct pcmcia_device *link) link->dev_node = &pdacf->node; return 0; -cs_failed: - cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); return -ENODEV; diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 7445cc8..1492744 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -213,14 +213,11 @@ static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq * configuration callback */ -#define CS_CHECK(fn, ret) \ -do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) - static int vxpocket_config(struct pcmcia_device *link) { struct vx_core *chip = link->priv; struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; - int last_fn, last_ret; + int ret; snd_printdd(KERN_DEBUG "vxpocket_config called\n"); @@ -235,9 +232,17 @@ static int vxpocket_config(struct pcmcia_device *link) strcpy(chip->card->driver, vxp440_hw.name); } - CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); - CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); - CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); + ret = pcmcia_request_io(link, &link->io); + if (ret) + goto failed; + + ret = pcmcia_request_irq(link, &link->irq); + if (ret) + goto failed; + + ret = pcmcia_request_configuration(link, &link->conf); + if (ret) + goto failed; chip->dev = &handle_to_dev(link); snd_card_set_dev(chip->card, chip->dev); @@ -248,8 +253,6 @@ static int vxpocket_config(struct pcmcia_device *link) link->dev_node = &vxp->node; return 0; -cs_failed: - cs_error(link, last_fn, last_ret); failed: pcmcia_disable_device(link); return -ENODEV; -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[git pull - v2] PCMCIA fixes for 2.6.32
[ update: patch "pcmcia: do not load the pd6729 driver if io_base is NULL" now checks for NULL and does not do any castings. Thanks to Wolfram Sang for noticing this issue. ] Linus, some PCMCIA bugfixes for 2.6.32 are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6/ urgent-v2 Please pull from that location. The diffstat and list of changes follows, the individual diffs are sent (at least) to the linux-pcmcia list. Thanks, Dominik Dominik Brodowski (2): pcmcia: pccard_read_tuple and TUPLE_RETURN_COMMON cleanup pcmcia: do not try to store more than 4 version strings Frans Pop (1): pcmcia: properly close previous dev_printk if kzalloc fails in do_io_probe Komuro (1): pcmcia: do not load the pd6729 driver if io_base is NULL Randy Dunlap (1): pcmcia: fix controller printk format warnings Wolfram Sang (1): pcmcia: Fix possible printk format warnings drivers/pcmcia/cistpl.c | 20 +++- drivers/pcmcia/cs_internal.h|3 +-- drivers/pcmcia/ds.c |8 drivers/pcmcia/i82365.c |4 ++-- drivers/pcmcia/m32r_cfc.c | 10 ++ drivers/pcmcia/m32r_pcc.c | 10 ++ drivers/pcmcia/m8xx_pcmcia.c| 15 +-- drivers/pcmcia/pcmcia_ioctl.c |2 +- drivers/pcmcia/pd6729.c |6 ++ drivers/pcmcia/rsrc_nonstatic.c |3 ++- drivers/pcmcia/soc_common.c |5 +++-- drivers/pcmcia/socket_sysfs.c |2 +- drivers/pcmcia/tcic.c |4 ++-- 13 files changed, 54 insertions(+), 38 deletions(-) ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH] pcmcia: does not load the pd6729 driver, if io_base is 0
Hey, On Sat, Oct 24, 2009 at 12:25:44PM +0200, Wolfram Sang wrote: > Maybe > > +if (!pci_resource_start(dev, 0)) { > > to save the cast and use the more common way to check for a NULL-pointer. yes, that's better (see below). Thanks. > > + printk(KERN_INFO "pd6729: failed to load the driver." > > +"since the io_base is 0.\n"); > > I'd strongly suggest dev_err or dev_warn here. They should be replaced all over the driver, not just here -- therefore, I'd suggest delaying this until post-2.6.32. Best, Dominik From: Komuro Date: Sat, 24 Oct 2009 08:07:39 +0900 Subject: [PATCH] pcmcia: do not load the pd6729 driver if io_base is NULL The CL-PD6729 chip in some docking station is not initialized properly under Linux. In that case, do not load the pd6729 driver. [Dominik Brodowski : spelling fixes, check for NULL not 0] Signed-off-by: Komuro Signed-off-by: Dominik Brodowski diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 1c39d34..70a3346 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, if ((ret = pci_enable_device(dev))) goto err_out_free_mem; + if (!pci_resource_start(dev, 0)) { + printk(KERN_INFO "pd6729: refusing to load the driver " +"as the io_base is 0.\n"); + goto err_out_free_mem; + } + printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " "at 0x%llx on irq %d\n", (unsigned long long)pci_resource_start(dev, 0), dev->irq); ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH] pcmcia: does not load the pd6729 driver, if io_base is 0
On Sat, Oct 24, 2009 at 08:07:39AM +0900, Komuro wrote: > > The CL-PD6729 chip in some docking station is not initialized properly under > Linux. > in that case, does not load the pd6729 driver. > > > Signed-off-by: Komuro > > --- > > --- linux-2.6.31/drivers/pcmcia/pd6729.c.orig 2009-09-12 11:14:37.0 > +0900 > +++ linux-2.6.31/drivers/pcmcia/pd6729.c 2009-09-12 11:40:01.0 > +0900 > @@ -641,6 +641,12 @@ > if ((ret = pci_enable_device(dev))) > goto err_out_free_mem; > > + if ((unsigned long long)pci_resource_start(dev, 0) == 0) { Maybe + if (!pci_resource_start(dev, 0)) { to save the cast and use the more common way to check for a NULL-pointer. > + printk(KERN_INFO "pd6729: failed to load the driver." > + "since the io_base is 0.\n"); I'd strongly suggest dev_err or dev_warn here. > + goto err_out_free_mem; > + } > + > printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " > "at 0x%llx on irq %d\n", > (unsigned long long)pci_resource_start(dev, 0), dev->irq); > > ___ > Linux PCMCIA reimplementation list > http://lists.infradead.org/mailman/listinfo/linux-pcmcia Regards, Wolfram -- Pengutronix e.K. | Wolfram Sang| Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5064 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917- | signature.asc Description: Digital signature ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 2/6] pcmcia: properly close previous dev_printk if kzalloc fails in do_io_probe
From: Frans Pop Signed-off-by: Frans Pop Signed-off-by: Dominik Brodowski --- drivers/pcmcia/rsrc_nonstatic.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/pcmcia/rsrc_nonstatic.c b/drivers/pcmcia/rsrc_nonstatic.c index 9ca22c7..909b196 100644 --- a/drivers/pcmcia/rsrc_nonstatic.c +++ b/drivers/pcmcia/rsrc_nonstatic.c @@ -206,6 +206,7 @@ static void do_io_probe(struct pcmcia_socket *s, unsigned int base, /* First, what does a floating port look like? */ b = kzalloc(256, GFP_KERNEL); if (!b) { + printk("\n"); dev_printk(KERN_ERR, &s->dev, "do_io_probe: unable to kmalloc 256 bytes"); return; -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[git pull] PCMCIA fixes for 2.6.32
Linus, some PCMCIA bugfixes for 2.6.32 are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/brodo/pcmcia-2.6/ urgent Please pull from that location. The diffstat and list of changes follows, the individual diffs are sent (at least) to the linux-pcmcia list. Thanks, Dominik Dominik Brodowski (2): pcmcia: pccard_read_tuple and TUPLE_RETURN_COMMON cleanup pcmcia: do not try to store more than 4 version strings Frans Pop (1): pcmcia: properly close previous dev_printk if kzalloc fails in do_io_probe Komuro (1): pcmcia: do not load the pd6729 driver if io_base is 0 Randy Dunlap (1): pcmcia: fix controller printk format warnings Wolfram Sang (1): pcmcia: Fix possible printk format warnings drivers/pcmcia/cistpl.c | 20 +++- drivers/pcmcia/cs_internal.h|3 +-- drivers/pcmcia/ds.c |8 drivers/pcmcia/i82365.c |4 ++-- drivers/pcmcia/m32r_cfc.c | 10 ++ drivers/pcmcia/m32r_pcc.c | 10 ++ drivers/pcmcia/m8xx_pcmcia.c| 15 +-- drivers/pcmcia/pcmcia_ioctl.c |2 +- drivers/pcmcia/pd6729.c |6 ++ drivers/pcmcia/rsrc_nonstatic.c |3 ++- drivers/pcmcia/soc_common.c |5 +++-- drivers/pcmcia/socket_sysfs.c |2 +- drivers/pcmcia/tcic.c |4 ++-- 13 files changed, 54 insertions(+), 38 deletions(-) ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 3/6] pcmcia: pccard_read_tuple and TUPLE_RETURN_COMMON cleanup
pccard_read_tuple(), which is only used by the PCMCIA core, should handle TUPLE_RETURN_COMMON more sensibly: If a specific function (which may be 0) is requested, set tuple.Attributes = 0 as was done in all PCMCIA drivers. If, however, BIND_FN_ALL is requested, return the "common" tuple. As to the callers of pccard_read_tuple(): - All calls to pcmcia_validate_cis() had set the "function" parameter to BIND_FN_ALL. Therefore, remove the "function" parameter and make the parameter to pccard_read_tuple explicit. - Calls to CISTPL_VERS_1 and CISTPL_MANFID now set BIND_FN_ALL. This was already the case for calls to CISTPL_LONGLINK_MFC. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/cistpl.c | 20 +++- drivers/pcmcia/cs_internal.h|3 +-- drivers/pcmcia/ds.c |6 +++--- drivers/pcmcia/pcmcia_ioctl.c |2 +- drivers/pcmcia/rsrc_nonstatic.c |2 +- drivers/pcmcia/socket_sysfs.c |2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/drivers/pcmcia/cistpl.c b/drivers/pcmcia/cistpl.c index 4a110b7..6c4a4fc 100644 --- a/drivers/pcmcia/cistpl.c +++ b/drivers/pcmcia/cistpl.c @@ -1463,7 +1463,9 @@ int pccard_read_tuple(struct pcmcia_socket *s, unsigned int function, cisdata_t return -ENOMEM; } tuple.DesiredTuple = code; -tuple.Attributes = TUPLE_RETURN_COMMON; +tuple.Attributes = 0; +if (function == BIND_FN_ALL) + tuple.Attributes = TUPLE_RETURN_COMMON; ret = pccard_get_first_tuple(s, function, &tuple); if (ret != 0) goto done; @@ -1490,7 +1492,7 @@ EXPORT_SYMBOL(pccard_read_tuple); ==*/ -int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned int *info) +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *info) { tuple_t *tuple; cisparse_t *p; @@ -1515,30 +1517,30 @@ int pccard_validate_cis(struct pcmcia_socket *s, unsigned int function, unsigned count = reserved = 0; tuple->DesiredTuple = RETURN_FIRST_TUPLE; tuple->Attributes = TUPLE_RETURN_COMMON; -ret = pccard_get_first_tuple(s, function, tuple); +ret = pccard_get_first_tuple(s, BIND_FN_ALL, tuple); 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) == 0) || - (pccard_read_tuple(s, function, CISTPL_CFTABLE_ENTRY_CB, p) == 0)) + (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_CFTABLE_ENTRY, p) == 0) || + (pccard_read_tuple(s, BIND_FN_ALL, 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) == 0) || - (pccard_read_tuple(s, function, CISTPL_VERS_1, p) == 0) || - (pccard_read_tuple(s, function, CISTPL_VERS_2, p) != -ENOSPC)) +if ((pccard_read_tuple(s, BIND_FN_ALL, CISTPL_MANFID, p) == 0) || + (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_1, p) == 0) || + (pccard_read_tuple(s, BIND_FN_ALL, CISTPL_VERS_2, p) != -ENOSPC)) ident_ok++; if (!dev_ok && !ident_ok) goto done; for (count = 1; count < MAX_TUPLES; count++) { - ret = pccard_get_next_tuple(s, function, tuple); + ret = pccard_get_next_tuple(s, BIND_FN_ALL, tuple); if (ret != 0) break; if (((tuple->TupleCode > 0x23) && (tuple->TupleCode < 0x40)) || diff --git a/drivers/pcmcia/cs_internal.h b/drivers/pcmcia/cs_internal.h index 79615e6..1f4098f 100644 --- a/drivers/pcmcia/cs_internal.h +++ b/drivers/pcmcia/cs_internal.h @@ -197,8 +197,7 @@ 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); +int pccard_validate_cis(struct pcmcia_socket *s, unsigned int *count); /* rsrc_mgr.c */ int pcmcia_validate_mem(struct pcmcia_socket *s); diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index 9f300d3..c70fb3b 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -547,7 +547,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) if (!vers1) return -ENOMEM; - if (!pccard_read_tuple(p_dev->socket, p_dev->func, + if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_MANFID, &manf_id)) { p_dev->manf_id = manf_id.manf;
[no subject]
___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 5/6] pcmcia: Fix possible printk format warnings
From: Wolfram Sang Fix more possible warnings introduced by my commit 1d80766554322236aee50d6023693b3210b9cf38 as fixed by the previous patch from Randy Dunlap. Not tested due to no hardware. Signed-off-by: Wolfram Sang Signed-off-by: Dominik Brodowski --- drivers/pcmcia/m32r_cfc.c| 10 ++ drivers/pcmcia/m32r_pcc.c| 10 ++ drivers/pcmcia/m8xx_pcmcia.c | 15 +-- drivers/pcmcia/soc_common.c |5 +++-- 4 files changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/pcmcia/m32r_cfc.c b/drivers/pcmcia/m32r_cfc.c index d1d89c4..7dfbee1 100644 --- a/drivers/pcmcia/m32r_cfc.c +++ b/drivers/pcmcia/m32r_cfc.c @@ -537,8 +537,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) u_char map; debug(3, "m32r_cfc: SetIOMap(%d, %d, %#2.2x, %d ns, " - "%#lx-%#lx)\n", sock, io->map, io->flags, - io->speed, io->start, io->stop); + "%#llx-%#llx)\n", sock, io->map, io->flags, + io->speed, (unsigned long long)io->start, + (unsigned long long)io->stop); map = io->map; return 0; @@ -554,8 +555,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) pcc_socket_t *t = &socket[sock]; debug(3, "m32r_cfc: SetMemMap(%d, %d, %#2.2x, %d ns, " -"%#lx, %#x)\n", sock, map, mem->flags, -mem->speed, mem->static_start, mem->card_start); +"%#llx, %#x)\n", sock, map, mem->flags, +mem->speed, (unsigned long long)mem->static_start, +mem->card_start); /* * sanity check diff --git a/drivers/pcmcia/m32r_pcc.c b/drivers/pcmcia/m32r_pcc.c index a065583..c6524f9 100644 --- a/drivers/pcmcia/m32r_pcc.c +++ b/drivers/pcmcia/m32r_pcc.c @@ -492,8 +492,9 @@ static int _pcc_set_io_map(u_short sock, struct pccard_io_map *io) u_char map; debug(3, "m32r-pcc: SetIOMap(%d, %d, %#2.2x, %d ns, " - "%#x-%#x)\n", sock, io->map, io->flags, - io->speed, io->start, io->stop); + "%#llx-%#llx)\n", sock, io->map, io->flags, + io->speed, (unsigned long long)io->start, + (unsigned long long)io->stop); map = io->map; return 0; @@ -515,8 +516,9 @@ static int _pcc_set_mem_map(u_short sock, struct pccard_mem_map *mem) #endif debug(3, "m32r-pcc: SetMemMap(%d, %d, %#2.2x, %d ns, " -"%#lx, %#x)\n", sock, map, mem->flags, -mem->speed, mem->static_start, mem->card_start); +"%#llx, %#x)\n", sock, map, mem->flags, +mem->speed, (unsigned long long)mem->static_start, +mem->card_start); /* * sanity check diff --git a/drivers/pcmcia/m8xx_pcmcia.c b/drivers/pcmcia/m8xx_pcmcia.c index c69f2c4..403559b 100644 --- a/drivers/pcmcia/m8xx_pcmcia.c +++ b/drivers/pcmcia/m8xx_pcmcia.c @@ -975,8 +975,9 @@ static int m8xx_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) #define M8XX_BASE (PCMCIA_IO_WIN_BASE + io->start) dprintk("SetIOMap(%d, %d, %#2.2x, %d ns, " - "%#4.4x-%#4.4x)\n", lsock, io->map, io->flags, - io->speed, io->start, io->stop); + "%#4.4llx-%#4.4llx)\n", lsock, io->map, io->flags, + io->speed, (unsigned long long)io->start, + (unsigned long long)io->stop); if ((io->map >= PCMCIA_IO_WIN_NO) || (io->start > 0x) || (io->stop > 0x) || (io->stop < io->start)) @@ -1055,8 +1056,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, pcmconf8xx_t *pcmcia = s->pcmcia; dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " - "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, - mem->speed, mem->static_start, mem->card_start); + "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, + mem->speed, (unsigned long long)mem->static_start, + mem->card_start); if ((mem->map >= PCMCIA_MEM_WIN_NO) // || ((mem->s) >= PCMCIA_MEM_WIN_SIZE) @@ -1107,8 +1109,9 @@ static int m8xx_set_mem_map(struct pcmcia_socket *sock, } dprintk("SetMemMap(%d, %d, %#2.2x, %d ns, " - "%#5.5lx, %#5.5x)\n", lsock, mem->map, mem->flags, - mem->speed, mem->static_start, mem->card_start); + "%#5.5llx, %#5.5x)\n", lsock, mem->map, mem->flags, + mem->speed, (unsigned long long)mem->static_start, + mem->card_start); /* copy the struct and modify the copy */ diff --git a/drivers/pcmcia/soc_common.c b/drivers/pcmcia/soc_common.c index 163cf98..ef7e9e5 100644 --- a/drivers/pcmcia/soc_common.c +++ b/drivers/pcmcia/soc_common.c @@ -336,8 +336,9 @@ soc_common_pcmcia_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *m struct soc_pcmcia_socket *skt = to_s
[PATCH 4/6] pcmcia: do not try to store more than 4 version strings
... for struct pcmcia_device only provides for 4 anyway. Signed-off-by: Dominik Brodowski --- drivers/pcmcia/ds.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index c70fb3b..f5b7079 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c @@ -583,7 +583,7 @@ static int pcmcia_device_query(struct pcmcia_device *p_dev) if (!pccard_read_tuple(p_dev->socket, BIND_FN_ALL, CISTPL_VERS_1, vers1)) { - for (i=0; i < vers1->ns; i++) { + for (i = 0; i < min_t(unsigned int, 4, vers1->ns); i++) { char *tmp; unsigned int length; -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 1/6] pcmcia: fix controller printk format warnings
From: Randy Dunlap Fix new pcmcia printk format warnings: [This has now moved from linux-next to mainline. Originally sent 2009-SEP-17.] drivers/pcmcia/i82365.c:1055: warning: format '%#x' expects type 'unsigned int', but argument 6 has type 'phys_addr_t' drivers/pcmcia/i82365.c:1055: warning: format '%#x' expects type 'unsigned int', but argument 7 has type 'phys_addr_t' drivers/pcmcia/tcic.c:734: warning: format '%#x' expects type 'unsigned int', but argument 6 has type 'phys_addr_t' drivers/pcmcia/tcic.c:734: warning: format '%#x' expects type 'unsigned int', but argument 7 has type 'phys_addr_t' Signed-off-by: Randy Dunlap Signed-off-by: Dominik Brodowski --- drivers/pcmcia/i82365.c |4 ++-- drivers/pcmcia/tcic.c |4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c index b906abe..a4aacb8 100644 --- a/drivers/pcmcia/i82365.c +++ b/drivers/pcmcia/i82365.c @@ -1053,8 +1053,8 @@ static int i365_set_io_map(u_short sock, struct pccard_io_map *io) u_char map, ioctl; debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " - "%#x-%#x)\n", sock, io->map, io->flags, - io->speed, io->start, io->stop); + "%#llx-%#llx)\n", sock, io->map, io->flags, io->speed, + (unsigned long long)io->start, (unsigned long long)io->stop); map = io->map; if ((map > 1) || (io->start > 0x) || (io->stop > 0x) || (io->stop < io->start)) return -EINVAL; diff --git a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c index 582413f..6918849 100644 --- a/drivers/pcmcia/tcic.c +++ b/drivers/pcmcia/tcic.c @@ -732,8 +732,8 @@ static int tcic_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io) u_short base, len, ioctl; debug(1, "SetIOMap(%d, %d, %#2.2x, %d ns, " - "%#x-%#x)\n", psock, io->map, io->flags, - io->speed, io->start, io->stop); + "%#llx-%#llx)\n", psock, io->map, io->flags, io->speed, + (unsigned long long)io->start, (unsigned long long)io->stop); if ((io->map > 1) || (io->start > 0x) || (io->stop > 0x) || (io->stop < io->start)) return -EINVAL; tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT)); -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
[PATCH 6/6] pcmcia: do not load the pd6729 driver if io_base is 0
From: Komuro The CL-PD6729 chip in some docking station is not initialized properly under Linux. In that case, do not load the pd6729 driver. [Dominik Brodowski : spelling fixes] Signed-off-by: Komuro Signed-off-by: Dominik Brodowski --- drivers/pcmcia/pd6729.c |6 ++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/drivers/pcmcia/pd6729.c b/drivers/pcmcia/pd6729.c index 1c39d34..bb81f68 100644 --- a/drivers/pcmcia/pd6729.c +++ b/drivers/pcmcia/pd6729.c @@ -641,6 +641,12 @@ static int __devinit pd6729_pci_probe(struct pci_dev *dev, if ((ret = pci_enable_device(dev))) goto err_out_free_mem; + if ((unsigned long long)pci_resource_start(dev, 0) == 0) { + printk(KERN_INFO "pd6729: refusing to load the driver " +"as the io_base is 0.\n"); + goto err_out_free_mem; + } + printk(KERN_INFO "pd6729: Cirrus PD6729 PCI to PCMCIA Bridge " "at 0x%llx on irq %d\n", (unsigned long long)pci_resource_start(dev, 0), dev->irq); -- 1.6.0.4 ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia
Re: [PATCH] pcmcia: does not load the pd6729 driver, if io_base is 0
On Sat, Oct 24, 2009 at 08:07:39AM +0900, Komuro wrote: > The CL-PD6729 chip in some docking station is not initialized properly under > Linux. > in that case, does not load the pd6729 driver. > > > Signed-off-by: Komuro Applied, and (almost) on its way to Linus. Thanks! Best, Dominik ___ Linux PCMCIA reimplementation list http://lists.infradead.org/mailman/listinfo/linux-pcmcia