aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/isdn/hardware/avm
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2010-03-20 14:35:12 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2010-05-10 04:23:15 -0400
commitded6a1a341cb38c4cfeb09d3d01ffe16b5c804b3 (patch)
treec430b9dc1ee04ecbe39da798524684b2db779b0f /drivers/isdn/hardware/avm
parent317b6d63000b3cc48c43d582d76063500e531a6c (diff)
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>
Diffstat (limited to 'drivers/isdn/hardware/avm')
-rw-r--r--drivers/isdn/hardware/avm/avm_cs.c60
1 files changed, 5 insertions, 55 deletions
diff --git a/drivers/isdn/hardware/avm/avm_cs.c b/drivers/isdn/hardware/avm/avm_cs.c
index 0d485f6c2194..8bbc452ff598 100644
--- a/drivers/isdn/hardware/avm/avm_cs.c
+++ b/drivers/isdn/hardware/avm/avm_cs.c
@@ -61,31 +61,6 @@ static void avmcs_release(struct pcmcia_device *link);
61 61
62static void avmcs_detach(struct pcmcia_device *p_dev); 62static void avmcs_detach(struct pcmcia_device *p_dev);
63 63
64/*
65 A linked list of "instances" of the skeleton device. Each actual
66 PCMCIA card corresponds to one device instance, and is described
67 by one struct pcmcia_device structure (defined in ds.h).
68
69 You may not want to use a linked list for this -- for example, the
70 memory card driver uses an array of struct pcmcia_device pointers, where minor
71 device numbers are used to derive the corresponding array index.
72*/
73
74/*
75 A driver needs to provide a dev_node_t structure for each device
76 on a card. In some cases, there is only one device per card (for
77 example, ethernet cards, modems). In other cases, there may be
78 many actual or logical devices (SCSI adapters, memory cards with
79 multiple partitions). The dev_node_t structures need to be kept
80 in a linked list starting at the 'dev' field of a struct pcmcia_device
81 structure. We allocate them in the card's private data structure,
82 because they generally can't be allocated dynamically.
83*/
84
85typedef struct local_info_t {
86 dev_node_t node;
87} local_info_t;
88
89/*====================================================================== 64/*======================================================================
90 65
91 avmcs_attach() creates an "instance" of the driver, allocating 66 avmcs_attach() creates an "instance" of the driver, allocating
@@ -100,7 +75,6 @@ typedef struct local_info_t {
100 75
101static int avmcs_probe(struct pcmcia_device *p_dev) 76static int avmcs_probe(struct pcmcia_device *p_dev)
102{ 77{
103 local_info_t *local;
104 78
105 /* The io structure describes IO port mapping */ 79 /* The io structure describes IO port mapping */
106 p_dev->io.NumPorts1 = 16; 80 p_dev->io.NumPorts1 = 16;
@@ -113,16 +87,7 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
113 p_dev->conf.ConfigIndex = 1; 87 p_dev->conf.ConfigIndex = 1;
114 p_dev->conf.Present = PRESENT_OPTION; 88 p_dev->conf.Present = PRESENT_OPTION;
115 89
116 /* Allocate space for private device-specific data */
117 local = kzalloc(sizeof(local_info_t), GFP_KERNEL);
118 if (!local)
119 goto err;
120 p_dev->priv = local;
121
122 return avmcs_config(p_dev); 90 return avmcs_config(p_dev);
123
124 err:
125 return -ENOMEM;
126} /* avmcs_attach */ 91} /* avmcs_attach */
127 92
128/*====================================================================== 93/*======================================================================
@@ -137,7 +102,6 @@ static int avmcs_probe(struct pcmcia_device *p_dev)
137static void avmcs_detach(struct pcmcia_device *link) 102static void avmcs_detach(struct pcmcia_device *link)
138{ 103{
139 avmcs_release(link); 104 avmcs_release(link);
140 kfree(link->priv);
141} /* avmcs_detach */ 105} /* avmcs_detach */
142 106
143/*====================================================================== 107/*======================================================================
@@ -168,14 +132,11 @@ static int avmcs_configcheck(struct pcmcia_device *p_dev,
168 132
169static int avmcs_config(struct pcmcia_device *link) 133static int avmcs_config(struct pcmcia_device *link)
170{ 134{
171 local_info_t *dev;
172 int i = -1; 135 int i = -1;
173 char devname[128]; 136 char devname[128];
174 int cardtype; 137 int cardtype;
175 int (*addcard)(unsigned int port, unsigned irq); 138 int (*addcard)(unsigned int port, unsigned irq);
176 139
177 dev = link->priv;
178
179 devname[0] = 0; 140 devname[0] = 0;
180 if (link->prod_id[1]) 141 if (link->prod_id[1])
181 strlcpy(devname, link->prod_id[1], sizeof(devname)); 142 strlcpy(devname, link->prod_id[1], sizeof(devname));
@@ -204,15 +165,11 @@ static int avmcs_config(struct pcmcia_device *link)
204 165
205 } while (0); 166 } while (0);
206 167
207 /* At this point, the dev_node_t structure(s) should be
208 initialized and arranged in a linked list at link->dev. */
209
210 if (devname[0]) { 168 if (devname[0]) {
211 char *s = strrchr(devname, ' '); 169 char *s = strrchr(devname, ' ');
212 if (!s) 170 if (!s)
213 s = devname; 171 s = devname;
214 else s++; 172 else s++;
215 strcpy(dev->node.dev_name, s);
216 if (strcmp("M1", s) == 0) { 173 if (strcmp("M1", s) == 0) {
217 cardtype = AVM_CARDTYPE_M1; 174 cardtype = AVM_CARDTYPE_M1;
218 } else if (strcmp("M2", s) == 0) { 175 } else if (strcmp("M2", s) == 0) {
@@ -220,14 +177,8 @@ static int avmcs_config(struct pcmcia_device *link)
220 } else { 177 } else {
221 cardtype = AVM_CARDTYPE_B1; 178 cardtype = AVM_CARDTYPE_B1;
222 } 179 }
223 } else { 180 } else
224 strcpy(dev->node.dev_name, "b1");
225 cardtype = AVM_CARDTYPE_B1; 181 cardtype = AVM_CARDTYPE_B1;
226 }
227
228 dev->node.major = 64;
229 dev->node.minor = 0;
230 link->dev_node = &dev->node;
231 182
232 /* If any step failed, release any partially configured state */ 183 /* If any step failed, release any partially configured state */
233 if (i != 0) { 184 if (i != 0) {
@@ -243,12 +194,11 @@ static int avmcs_config(struct pcmcia_device *link)
243 case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break; 194 case AVM_CARDTYPE_B1: addcard = b1pcmcia_addcard_b1; break;
244 } 195 }
245 if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) { 196 if ((i = (*addcard)(link->io.BasePort1, link->irq)) < 0) {
246 printk(KERN_ERR "avm_cs: failed to add AVM-%s-Controller at i/o %#x, irq %d\n", 197 dev_err(&link->dev, "avm_cs: failed to add AVM-Controller at i/o %#x, irq %d\n",
247 dev->node.dev_name, link->io.BasePort1, link->irq); 198 link->io.BasePort1, link->irq);
248 avmcs_release(link); 199 avmcs_release(link);
249 return -ENODEV; 200 return -ENODEV;
250 } 201 }
251 dev->node.minor = i;
252 return 0; 202 return 0;
253 203
254} /* avmcs_config */ 204} /* avmcs_config */