pcmcia: use dynamic debug infrastructure, deprecate CS_CHECK (net)
Convert PCMCIA drivers to use the dynamic debug infrastructure, instead of requiring manual settings of PCMCIA_DEBUG. Only some rare debug checks are now hidden behind "#ifdef DEBUG" or "#if 0". 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: netdev@vger.kernel.org Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
parent
e773cfe167
commit
dd0fab5b94
10 changed files with 315 additions and 506 deletions
|
@ -53,11 +53,7 @@
|
|||
|
||||
#define VERSION "arcnet: COM20020 PCMCIA support loaded.\n"
|
||||
|
||||
#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)
|
||||
#ifdef DEBUG
|
||||
|
||||
static void regdump(struct net_device *dev)
|
||||
{
|
||||
|
@ -92,7 +88,6 @@ static void regdump(struct net_device *dev)
|
|||
|
||||
#else
|
||||
|
||||
#define DEBUG(n, args...) do { } while (0)
|
||||
static inline void regdump(struct net_device *dev) { }
|
||||
|
||||
#endif
|
||||
|
@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev)
|
|||
struct net_device *dev;
|
||||
struct arcnet_local *lp;
|
||||
|
||||
DEBUG(0, "com20020_attach()\n");
|
||||
dev_dbg(&p_dev->dev, "com20020_attach()\n");
|
||||
|
||||
/* Create new network device */
|
||||
info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL);
|
||||
|
@ -198,12 +193,12 @@ static void com20020_detach(struct pcmcia_device *link)
|
|||
struct com20020_dev_t *info = link->priv;
|
||||
struct net_device *dev = info->dev;
|
||||
|
||||
DEBUG(1,"detach...\n");
|
||||
dev_dbg(&link->dev, "detach...\n");
|
||||
|
||||
DEBUG(0, "com20020_detach(0x%p)\n", link);
|
||||
dev_dbg(&link->dev, "com20020_detach\n");
|
||||
|
||||
if (link->dev_node) {
|
||||
DEBUG(1,"unregister...\n");
|
||||
dev_dbg(&link->dev, "unregister...\n");
|
||||
|
||||
unregister_netdev(dev);
|
||||
|
||||
|
@ -218,16 +213,16 @@ static void com20020_detach(struct pcmcia_device *link)
|
|||
com20020_release(link);
|
||||
|
||||
/* Unlink device structure, free bits */
|
||||
DEBUG(1,"unlinking...\n");
|
||||
dev_dbg(&link->dev, "unlinking...\n");
|
||||
if (link->priv)
|
||||
{
|
||||
dev = info->dev;
|
||||
if (dev)
|
||||
{
|
||||
DEBUG(1,"kfree...\n");
|
||||
dev_dbg(&link->dev, "kfree...\n");
|
||||
free_netdev(dev);
|
||||
}
|
||||
DEBUG(1,"kfree2...\n");
|
||||
dev_dbg(&link->dev, "kfree2...\n");
|
||||
kfree(info);
|
||||
}
|
||||
|
||||
|
@ -241,25 +236,22 @@ static void com20020_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 com20020_config(struct pcmcia_device *link)
|
||||
{
|
||||
struct arcnet_local *lp;
|
||||
com20020_dev_t *info;
|
||||
struct net_device *dev;
|
||||
int i, last_ret, last_fn;
|
||||
int i, ret;
|
||||
int ioaddr;
|
||||
|
||||
info = link->priv;
|
||||
dev = info->dev;
|
||||
|
||||
DEBUG(1,"config...\n");
|
||||
dev_dbg(&link->dev, "config...\n");
|
||||
|
||||
DEBUG(0, "com20020_config(0x%p)\n", link);
|
||||
dev_dbg(&link->dev, "com20020_config\n");
|
||||
|
||||
DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1);
|
||||
dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1);
|
||||
i = -ENODEV;
|
||||
if (!link->io.BasePort1)
|
||||
{
|
||||
|
@ -276,26 +268,28 @@ static int com20020_config(struct pcmcia_device *link)
|
|||
|
||||
if (i != 0)
|
||||
{
|
||||
DEBUG(1,"arcnet: requestIO failed totally!\n");
|
||||
dev_dbg(&link->dev, "requestIO failed totally!\n");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
ioaddr = dev->base_addr = link->io.BasePort1;
|
||||
DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr);
|
||||
dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr);
|
||||
|
||||
DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n",
|
||||
dev_dbg(&link->dev, "request IRQ %d (%Xh/%Xh)\n",
|
||||
link->irq.AssignedIRQ,
|
||||
link->irq.IRQInfo1, link->irq.IRQInfo2);
|
||||
i = pcmcia_request_irq(link, &link->irq);
|
||||
if (i != 0)
|
||||
{
|
||||
DEBUG(1,"arcnet: requestIRQ failed totally!\n");
|
||||
dev_dbg(&link->dev, "requestIRQ failed totally!\n");
|
||||
goto failed;
|
||||
}
|
||||
|
||||
dev->irq = link->irq.AssignedIRQ;
|
||||
|
||||
CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
|
||||
ret = pcmcia_request_configuration(link, &link->conf);
|
||||
if (ret)
|
||||
goto failed;
|
||||
|
||||
if (com20020_check(dev))
|
||||
{
|
||||
|
@ -313,21 +307,20 @@ static int com20020_config(struct pcmcia_device *link)
|
|||
i = com20020_found(dev, 0); /* calls register_netdev */
|
||||
|
||||
if (i != 0) {
|
||||
DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n");
|
||||
dev_printk(KERN_NOTICE, &link->dev,
|
||||
"com20020_cs: com20020_found() failed\n");
|
||||
link->dev_node = NULL;
|
||||
goto failed;
|
||||
}
|
||||
|
||||
strcpy(info->node.dev_name, dev->name);
|
||||
|
||||
DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n",
|
||||
dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n",
|
||||
dev->name, dev->base_addr, dev->irq);
|
||||
return 0;
|
||||
|
||||
cs_failed:
|
||||
cs_error(link, last_fn, last_ret);
|
||||
failed:
|
||||
DEBUG(1,"com20020_config failed...\n");
|
||||
dev_dbg(&link->dev, "com20020_config failed...\n");
|
||||
com20020_release(link);
|
||||
return -ENODEV;
|
||||
} /* com20020_config */
|
||||
|
@ -342,7 +335,7 @@ failed:
|
|||
|
||||
static void com20020_release(struct pcmcia_device *link)
|
||||
{
|
||||
DEBUG(0, "com20020_release(0x%p)\n", link);
|
||||
dev_dbg(&link->dev, "com20020_release\n");
|
||||
pcmcia_disable_device(link);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue