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 <isdn@linux-pingi.de>
Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
Dominik Brodowski
2009-10-24 15:50:13 +02:00
parent cbf624f0e1
commit e773cfe167
5 changed files with 43 additions and 126 deletions

View File

@@ -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 -- 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 =
"elsa_cs.c $Revision: 1.2.2.4 $ $Date: 2004/01/25 15:07:06 $ (K.Lichtenwalder)";
#else
#define DEBUG(n, args...)
#endif
/*====================================================================*/
@@ -142,7 +125,7 @@ static int elsa_cs_probe(struct pcmcia_device *link)
{
local_info_t *local;
DEBUG(0, "elsa_cs_attach()\n");
dev_dbg(&link->dev, "elsa_cs_attach()\n");
/* Allocate space for private device-specific data */
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
@@ -188,7 +171,7 @@ static void elsa_cs_detach(struct pcmcia_device *link)
{
local_info_t *info = link->priv;
DEBUG(0, "elsa_cs_detach(0x%p)\n", link);
dev_dbg(&link->dev, "elsa_cs_detach(0x%p)\n", link);
info->busy = 1;
elsa_cs_release(link);
@@ -231,30 +214,25 @@ static int elsa_cs_configcheck(struct pcmcia_device *p_dev,
static int elsa_cs_config(struct pcmcia_device *link)
{
local_info_t *dev;
int i, last_fn;
int i;
IsdnCard_t icard;
DEBUG(0, "elsa_config(0x%p)\n", link);
dev_dbg(&link->dev, "elsa_config(0x%p)\n", link);
dev = link->priv;
i = pcmcia_loop_config(link, elsa_cs_configcheck, NULL);
if (i != 0) {
last_fn = RequestIO;
goto cs_failed;
}
if (i != 0)
goto failed;
i = pcmcia_request_irq(link, &link->irq);
if (i != 0) {
link->irq.AssignedIRQ = 0;
last_fn = RequestIRQ;
goto cs_failed;
goto failed;
}
i = pcmcia_request_configuration(link, &link->conf);
if (i != 0) {
last_fn = RequestConfiguration;
goto cs_failed;
}
if (i != 0)
goto failed;
/* At this point, the dev_node_t structure(s) should be
initialized and arranged in a linked list at link->dev. *//* */
@@ -290,8 +268,7 @@ static int elsa_cs_config(struct pcmcia_device *link)
((local_info_t*)link->priv)->cardnr = i;
return 0;
cs_failed:
cs_error(link, last_fn, i);
failed:
elsa_cs_release(link);
return -ENODEV;
} /* elsa_cs_config */
@@ -308,7 +285,7 @@ static void elsa_cs_release(struct pcmcia_device *link)
{
local_info_t *local = link->priv;
DEBUG(0, "elsa_cs_release(0x%p)\n", link);
dev_dbg(&link->dev, "elsa_cs_release(0x%p)\n", link);
if (local) {
if (local->cardnr >= 0) {