diff options
author | David S. Miller <davem@davemloft.net> | 2009-12-05 18:22:26 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-12-05 18:22:26 -0500 |
commit | 28b4d5cc17c20786848cdc07b7ea237a309776bb (patch) | |
tree | bae406a4b17229dcce7c11be5073f7a67665e477 /drivers/net/pcmcia/com20020_cs.c | |
parent | d29cecda036f251aee4947f47eea0fe9ed8cc931 (diff) | |
parent | 96fa2b508d2d3fe040cf4ef2fffb955f0a537ea1 (diff) |
Merge branch 'master' of /home/davem/src/GIT/linux-2.6/
Conflicts:
drivers/net/pcmcia/fmvj18x_cs.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcmcia/xirc2ps_cs.c
drivers/net/wireless/ray_cs.c
Diffstat (limited to 'drivers/net/pcmcia/com20020_cs.c')
-rw-r--r-- | drivers/net/pcmcia/com20020_cs.c | 63 |
1 files changed, 27 insertions, 36 deletions
diff --git a/drivers/net/pcmcia/com20020_cs.c b/drivers/net/pcmcia/com20020_cs.c index 7b5c77b7bd27..21d9c9d815d1 100644 --- a/drivers/net/pcmcia/com20020_cs.c +++ b/drivers/net/pcmcia/com20020_cs.c | |||
@@ -53,11 +53,7 @@ | |||
53 | 53 | ||
54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" | 54 | #define VERSION "arcnet: COM20020 PCMCIA support loaded.\n" |
55 | 55 | ||
56 | #ifdef PCMCIA_DEBUG | 56 | #ifdef DEBUG |
57 | |||
58 | static int pc_debug = PCMCIA_DEBUG; | ||
59 | module_param(pc_debug, int, 0); | ||
60 | #define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args) | ||
61 | 57 | ||
62 | static void regdump(struct net_device *dev) | 58 | static void regdump(struct net_device *dev) |
63 | { | 59 | { |
@@ -92,7 +88,6 @@ static void regdump(struct net_device *dev) | |||
92 | 88 | ||
93 | #else | 89 | #else |
94 | 90 | ||
95 | #define DEBUG(n, args...) do { } while (0) | ||
96 | static inline void regdump(struct net_device *dev) { } | 91 | static inline void regdump(struct net_device *dev) { } |
97 | 92 | ||
98 | #endif | 93 | #endif |
@@ -144,7 +139,7 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
144 | struct net_device *dev; | 139 | struct net_device *dev; |
145 | struct arcnet_local *lp; | 140 | struct arcnet_local *lp; |
146 | 141 | ||
147 | DEBUG(0, "com20020_attach()\n"); | 142 | dev_dbg(&p_dev->dev, "com20020_attach()\n"); |
148 | 143 | ||
149 | /* Create new network device */ | 144 | /* Create new network device */ |
150 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); | 145 | info = kzalloc(sizeof(struct com20020_dev_t), GFP_KERNEL); |
@@ -169,11 +164,10 @@ static int com20020_probe(struct pcmcia_device *p_dev) | |||
169 | p_dev->io.NumPorts1 = 16; | 164 | p_dev->io.NumPorts1 = 16; |
170 | p_dev->io.IOAddrLines = 16; | 165 | p_dev->io.IOAddrLines = 16; |
171 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; | 166 | p_dev->irq.Attributes = IRQ_TYPE_EXCLUSIVE; |
172 | p_dev->irq.IRQInfo1 = IRQ_LEVEL_ID; | ||
173 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; | 167 | p_dev->conf.Attributes = CONF_ENABLE_IRQ; |
174 | p_dev->conf.IntType = INT_MEMORY_AND_IO; | 168 | p_dev->conf.IntType = INT_MEMORY_AND_IO; |
175 | 169 | ||
176 | p_dev->irq.Instance = info->dev = dev; | 170 | info->dev = dev; |
177 | p_dev->priv = info; | 171 | p_dev->priv = info; |
178 | 172 | ||
179 | return com20020_config(p_dev); | 173 | return com20020_config(p_dev); |
@@ -198,12 +192,12 @@ static void com20020_detach(struct pcmcia_device *link) | |||
198 | struct com20020_dev_t *info = link->priv; | 192 | struct com20020_dev_t *info = link->priv; |
199 | struct net_device *dev = info->dev; | 193 | struct net_device *dev = info->dev; |
200 | 194 | ||
201 | DEBUG(1,"detach...\n"); | 195 | dev_dbg(&link->dev, "detach...\n"); |
202 | 196 | ||
203 | DEBUG(0, "com20020_detach(0x%p)\n", link); | 197 | dev_dbg(&link->dev, "com20020_detach\n"); |
204 | 198 | ||
205 | if (link->dev_node) { | 199 | if (link->dev_node) { |
206 | DEBUG(1,"unregister...\n"); | 200 | dev_dbg(&link->dev, "unregister...\n"); |
207 | 201 | ||
208 | unregister_netdev(dev); | 202 | unregister_netdev(dev); |
209 | 203 | ||
@@ -218,16 +212,16 @@ static void com20020_detach(struct pcmcia_device *link) | |||
218 | com20020_release(link); | 212 | com20020_release(link); |
219 | 213 | ||
220 | /* Unlink device structure, free bits */ | 214 | /* Unlink device structure, free bits */ |
221 | DEBUG(1,"unlinking...\n"); | 215 | dev_dbg(&link->dev, "unlinking...\n"); |
222 | if (link->priv) | 216 | if (link->priv) |
223 | { | 217 | { |
224 | dev = info->dev; | 218 | dev = info->dev; |
225 | if (dev) | 219 | if (dev) |
226 | { | 220 | { |
227 | DEBUG(1,"kfree...\n"); | 221 | dev_dbg(&link->dev, "kfree...\n"); |
228 | free_netdev(dev); | 222 | free_netdev(dev); |
229 | } | 223 | } |
230 | DEBUG(1,"kfree2...\n"); | 224 | dev_dbg(&link->dev, "kfree2...\n"); |
231 | kfree(info); | 225 | kfree(info); |
232 | } | 226 | } |
233 | 227 | ||
@@ -241,25 +235,22 @@ static void com20020_detach(struct pcmcia_device *link) | |||
241 | 235 | ||
242 | ======================================================================*/ | 236 | ======================================================================*/ |
243 | 237 | ||
244 | #define CS_CHECK(fn, ret) \ | ||
245 | do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) | ||
246 | |||
247 | static int com20020_config(struct pcmcia_device *link) | 238 | static int com20020_config(struct pcmcia_device *link) |
248 | { | 239 | { |
249 | struct arcnet_local *lp; | 240 | struct arcnet_local *lp; |
250 | com20020_dev_t *info; | 241 | com20020_dev_t *info; |
251 | struct net_device *dev; | 242 | struct net_device *dev; |
252 | int i, last_ret, last_fn; | 243 | int i, ret; |
253 | int ioaddr; | 244 | int ioaddr; |
254 | 245 | ||
255 | info = link->priv; | 246 | info = link->priv; |
256 | dev = info->dev; | 247 | dev = info->dev; |
257 | 248 | ||
258 | DEBUG(1,"config...\n"); | 249 | dev_dbg(&link->dev, "config...\n"); |
259 | 250 | ||
260 | DEBUG(0, "com20020_config(0x%p)\n", link); | 251 | dev_dbg(&link->dev, "com20020_config\n"); |
261 | 252 | ||
262 | DEBUG(1,"arcnet: baseport1 is %Xh\n", link->io.BasePort1); | 253 | dev_dbg(&link->dev, "baseport1 is %Xh\n", link->io.BasePort1); |
263 | i = -ENODEV; | 254 | i = -ENODEV; |
264 | if (!link->io.BasePort1) | 255 | if (!link->io.BasePort1) |
265 | { | 256 | { |
@@ -276,26 +267,27 @@ static int com20020_config(struct pcmcia_device *link) | |||
276 | 267 | ||
277 | if (i != 0) | 268 | if (i != 0) |
278 | { | 269 | { |
279 | DEBUG(1,"arcnet: requestIO failed totally!\n"); | 270 | dev_dbg(&link->dev, "requestIO failed totally!\n"); |
280 | goto failed; | 271 | goto failed; |
281 | } | 272 | } |
282 | 273 | ||
283 | ioaddr = dev->base_addr = link->io.BasePort1; | 274 | ioaddr = dev->base_addr = link->io.BasePort1; |
284 | DEBUG(1,"arcnet: got ioaddr %Xh\n", ioaddr); | 275 | dev_dbg(&link->dev, "got ioaddr %Xh\n", ioaddr); |
285 | 276 | ||
286 | DEBUG(1,"arcnet: request IRQ %d (%Xh/%Xh)\n", | 277 | dev_dbg(&link->dev, "request IRQ %d\n", |
287 | link->irq.AssignedIRQ, | 278 | link->irq.AssignedIRQ); |
288 | link->irq.IRQInfo1, link->irq.IRQInfo2); | ||
289 | i = pcmcia_request_irq(link, &link->irq); | 279 | i = pcmcia_request_irq(link, &link->irq); |
290 | if (i != 0) | 280 | if (i != 0) |
291 | { | 281 | { |
292 | DEBUG(1,"arcnet: requestIRQ failed totally!\n"); | 282 | dev_dbg(&link->dev, "requestIRQ failed totally!\n"); |
293 | goto failed; | 283 | goto failed; |
294 | } | 284 | } |
295 | 285 | ||
296 | dev->irq = link->irq.AssignedIRQ; | 286 | dev->irq = link->irq.AssignedIRQ; |
297 | 287 | ||
298 | CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); | 288 | ret = pcmcia_request_configuration(link, &link->conf); |
289 | if (ret) | ||
290 | goto failed; | ||
299 | 291 | ||
300 | if (com20020_check(dev)) | 292 | if (com20020_check(dev)) |
301 | { | 293 | { |
@@ -308,26 +300,25 @@ static int com20020_config(struct pcmcia_device *link) | |||
308 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ | 300 | lp->card_flags = ARC_CAN_10MBIT; /* pretend all of them can 10Mbit */ |
309 | 301 | ||
310 | link->dev_node = &info->node; | 302 | link->dev_node = &info->node; |
311 | SET_NETDEV_DEV(dev, &handle_to_dev(link)); | 303 | SET_NETDEV_DEV(dev, &link->dev); |
312 | 304 | ||
313 | i = com20020_found(dev, 0); /* calls register_netdev */ | 305 | i = com20020_found(dev, 0); /* calls register_netdev */ |
314 | 306 | ||
315 | if (i != 0) { | 307 | if (i != 0) { |
316 | DEBUG(1,KERN_NOTICE "com20020_cs: com20020_found() failed\n"); | 308 | dev_printk(KERN_NOTICE, &link->dev, |
309 | "com20020_cs: com20020_found() failed\n"); | ||
317 | link->dev_node = NULL; | 310 | link->dev_node = NULL; |
318 | goto failed; | 311 | goto failed; |
319 | } | 312 | } |
320 | 313 | ||
321 | strcpy(info->node.dev_name, dev->name); | 314 | strcpy(info->node.dev_name, dev->name); |
322 | 315 | ||
323 | DEBUG(1,KERN_INFO "%s: port %#3lx, irq %d\n", | 316 | dev_dbg(&link->dev,KERN_INFO "%s: port %#3lx, irq %d\n", |
324 | dev->name, dev->base_addr, dev->irq); | 317 | dev->name, dev->base_addr, dev->irq); |
325 | return 0; | 318 | return 0; |
326 | 319 | ||
327 | cs_failed: | ||
328 | cs_error(link, last_fn, last_ret); | ||
329 | failed: | 320 | failed: |
330 | DEBUG(1,"com20020_config failed...\n"); | 321 | dev_dbg(&link->dev, "com20020_config failed...\n"); |
331 | com20020_release(link); | 322 | com20020_release(link); |
332 | return -ENODEV; | 323 | return -ENODEV; |
333 | } /* com20020_config */ | 324 | } /* com20020_config */ |
@@ -342,7 +333,7 @@ failed: | |||
342 | 333 | ||
343 | static void com20020_release(struct pcmcia_device *link) | 334 | static void com20020_release(struct pcmcia_device *link) |
344 | { | 335 | { |
345 | DEBUG(0, "com20020_release(0x%p)\n", link); | 336 | dev_dbg(&link->dev, "com20020_release\n"); |
346 | pcmcia_disable_device(link); | 337 | pcmcia_disable_device(link); |
347 | } | 338 | } |
348 | 339 | ||