pcmcia: dev_node removal (drivers with updated printk call)
As a second step, remove any usage of dev_node_t from drivers which only wrote to this typedef/struct, except one printk() which can easily be replaced by a dev_info()/dev_warn() call. CC: Harald Welte <laforge@gnumonks.org> CC: linux-ide@vger.kernel.org CC: linux-wireless@vger.kernel.org CC: netdev@vger.kernel.org CC: linux-usb@vger.kernel.org Acked-by: Karsten Keil <isdn@linux-pingi.de> Signed-off-by: Dominik Brodowski <linux@dominikbrodowski.net>
This commit is contained in:
@@ -61,31 +61,6 @@ static void avmcs_release(struct pcmcia_device *link);
|
||||
|
||||
static void avmcs_detach(struct pcmcia_device *p_dev);
|
||||
|
||||
/*
|
||||
A linked list of "instances" of the skeleton device. Each actual
|
||||
PCMCIA card corresponds to one device instance, and is described
|
||||
by one struct pcmcia_device structure (defined in ds.h).
|
||||
|
||||
You may not want to use a linked list for this -- for example, the
|
||||
memory card driver uses an array of struct pcmcia_device pointers, where minor
|
||||
device numbers are used to derive the corresponding array index.
|
||||
*/
|
||||
|
||||
/*
|
||||
A driver needs to provide a dev_node_t structure for each device
|
||||
on a card. In some cases, there is only one device per card (for
|
||||
example, ethernet cards, modems). In other cases, there may be
|
||||
many actual or logical devices (SCSI adapters, memory cards with
|
||||
multiple partitions). The dev_node_t structures need to be kept
|
||||
in a linked list starting at the 'dev' field of a struct pcmcia_device
|
||||
structure. We allocate them in the card's private data structure,
|
||||
because they generally can't be allocated dynamically.
|
||||
*/
|
||||
|
||||
typedef struct local_info_t {
|
||||
dev_node_t node;
|
||||
} local_info_t;
|
||||
|
||||
/*======================================================================
|
||||
|
||||
avmcs_attach() creates an "instance" of the driver, allocating
|
||||
@@ -100,7 +75,6 @@ typedef struct local_info_t {
|
||||
|
||||
static int avmcs_probe(struct pcmcia_device *p_dev)
|
||||
{
|
||||
local_info_t *local;
|
||||
|
||||
/* The io structure describes IO port mapping */
|
||||
p_dev->io.NumPorts1 = 16;
|
||||
@@ -113,16 +87,7 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
|
||||
p_dev->conf.ConfigIndex = 1;
|
||||
p_dev->conf.Present = PRESENT_OPTION;
|
||||
|
||||
/* Allocate space for private device-specific data */
|
||||
local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
|
||||
if (!local)
|
||||
goto err;
|
||||
p_dev->priv = local;
|
||||
|
||||
return avmcs_config(p_dev);
|
||||
|
||||
err:
|
||||
return -ENOMEM;
|
||||
} /* avmcs_attach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -137,7 +102,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
|
||||
static void avmcs_detach(struct pcmcia_device *link)
|
||||
{
|
||||
avmcs_release(link);
|
||||
kfree(link->priv);
|
||||
} /* avmcs_detach */
|
||||
|
||||
/*======================================================================
|
||||
@@ -168,14 +132,11 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
|
||||
|
||||
static int avmcs_config(struct pcmcia_device *link)
|
||||
{
|
||||
local_info_t *dev;
|
||||
int i = -1;
|
||||
char devname[128];
|
||||
int cardtype;
|
||||
int (*addcard)(unsigned int port, unsigned irq);
|
||||
|
||||
dev = link->priv;
|
||||
|
||||
devname[0] = 0;
|
||||
if (link->prod_id[1])
|
||||
strlcpy(devname, link->prod_id[1], sizeof(devname));
|
||||
@@ -204,15 +165,11 @@ static int avmcs_config(struct pcmcia_device *link)
|
||||
|
||||
} while (0);
|
||||
|
||||
/* At this point, the dev_node_t structure(s) should be
|
||||
initialized and arranged in a linked list at link->dev. */
|
||||
|
||||
if (devname[0]) {
|
||||
char *s = strrchr(devname, ' ');
|
||||
if (!s)
|
||||
s = devname;
|
||||
else s++;
|
||||
strcpy(dev->node.dev_name, s);
|
||||
if (strcmp("M1", s) == 0) {
|
||||
cardtype = AVM_CARDTYPE_M1;
|
||||
} else if (strcmp("M2", s) == 0) {
|
||||
@@ -220,14 +177,8 @@ static int avmcs_config(struct pcmcia_device *link)
|
||||
} else {
|
||||
cardtype = AVM_CARDTYPE_B1;
|
||||
}
|
||||
} else {
|
||||
strcpy(dev->node.dev_name, "b1");
|
||||
} else
|
||||
cardtype = AVM_CARDTYPE_B1;
|
||||
}
|
||||
|
||||
dev->node.major = 64;
|
||||
dev->node.minor = 0;
|
||||
link->dev_node = &dev->node;
|
||||
|
||||
/* If any step failed, release any partially configured state */
|
||||
if (i != 0) {
|
||||
@@ -243,12 +194,11 @@ static int avmcs_config(struct pcmcia_device *link)
|
||||
case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
|
||||
}
|
||||
if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) {
|
||||
printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n",
|
||||
dev->node.dev_name, link->io.BasePort1, link->irq);
|
||||
avmcs_release(link);
|
||||
return -ENODEV;
|
||||
dev_err(&link->dev, "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n",
|
||||
link->io.BasePort1, link->irq);
|
||||
avmcs_release(link);
|
||||
return -ENODEV;
|
||||
}
|
||||
dev->node.minor = i;
|
||||
return 0;
|
||||
|
||||
} /* avmcs_config */
|
||||
|
Reference in New Issue
Block a user