aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pcmcia/ibmtr_cs.c
diff options
context:
space:
mode:
authorDominik Brodowski <linux@dominikbrodowski.net>2009-10-24 09:51:05 -0400
committerDominik Brodowski <linux@dominikbrodowski.net>2009-11-09 02:30:00 -0500
commitdd0fab5b940c0b65f26ac5b01485bac1f690ace6 (patch)
tree5730c0c243949e935ea982efa79ed1cd06cc2297 /drivers/net/pcmcia/ibmtr_cs.c
parente773cfe167c320d07b9423bc51fc4ab0221775a4 (diff)
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>
Diffstat (limited to 'drivers/net/pcmcia/ibmtr_cs.c')
-rw-r--r--drivers/net/pcmcia/ibmtr_cs.c54
1 files changed, 26 insertions, 28 deletions
diff --git a/drivers/net/pcmcia/ibmtr_cs.c b/drivers/net/pcmcia/ibmtr_cs.c
index 06618af1a468..0d914f3b2941 100644
--- a/drivers/net/pcmcia/ibmtr_cs.c
+++ b/drivers/net/pcmcia/ibmtr_cs.c
@@ -69,17 +69,6 @@
69#define PCMCIA 69#define PCMCIA
70#include "../tokenring/ibmtr.c" 70#include "../tokenring/ibmtr.c"
71 71
72#ifdef PCMCIA_DEBUG
73static int pc_debug = PCMCIA_DEBUG;
74module_param(pc_debug, int, 0);
75#define DEBUG(n, args...) if (pc_debug>(n)) printk(KERN_DEBUG args)
76static char *version =
77"ibmtr_cs.c 1.10 1996/01/06 05:19:00 (Steve Kipisz)\n"
78" 2.2.7 1999/05/03 12:00:00 (Mike Phillips)\n"
79" 2.4.2 2001/30/28 Midnight (Burt Silverman)\n";
80#else
81#define DEBUG(n, args...)
82#endif
83 72
84/*====================================================================*/ 73/*====================================================================*/
85 74
@@ -143,7 +132,7 @@ static int __devinit ibmtr_attach(struct pcmcia_device *link)
143 ibmtr_dev_t *info; 132 ibmtr_dev_t *info;
144 struct net_device *dev; 133 struct net_device *dev;
145 134
146 DEBUG(0, "ibmtr_attach()\n"); 135 dev_dbg(&link->dev, "ibmtr_attach()\n");
147 136
148 /* Create new token-ring device */ 137 /* Create new token-ring device */
149 info = kzalloc(sizeof(*info), GFP_KERNEL); 138 info = kzalloc(sizeof(*info), GFP_KERNEL);
@@ -190,7 +179,7 @@ static void ibmtr_detach(struct pcmcia_device *link)
190 struct net_device *dev = info->dev; 179 struct net_device *dev = info->dev;
191 struct tok_info *ti = netdev_priv(dev); 180 struct tok_info *ti = netdev_priv(dev);
192 181
193 DEBUG(0, "ibmtr_detach(0x%p)\n", link); 182 dev_dbg(&link->dev, "ibmtr_detach\n");
194 183
195 /* 184 /*
196 * When the card removal interrupt hits tok_interrupt(), 185 * When the card removal interrupt hits tok_interrupt(),
@@ -217,9 +206,6 @@ static void ibmtr_detach(struct pcmcia_device *link)
217 206
218======================================================================*/ 207======================================================================*/
219 208
220#define CS_CHECK(fn, ret) \
221do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
222
223static int __devinit ibmtr_config(struct pcmcia_device *link) 209static int __devinit ibmtr_config(struct pcmcia_device *link)
224{ 210{
225 ibmtr_dev_t *info = link->priv; 211 ibmtr_dev_t *info = link->priv;
@@ -227,9 +213,9 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
227 struct tok_info *ti = netdev_priv(dev); 213 struct tok_info *ti = netdev_priv(dev);
228 win_req_t req; 214 win_req_t req;
229 memreq_t mem; 215 memreq_t mem;
230 int i, last_ret, last_fn; 216 int i, ret;
231 217
232 DEBUG(0, "ibmtr_config(0x%p)\n", link); 218 dev_dbg(&link->dev, "ibmtr_config\n");
233 219
234 link->conf.ConfigIndex = 0x61; 220 link->conf.ConfigIndex = 0x61;
235 221
@@ -241,11 +227,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
241 if (i != 0) { 227 if (i != 0) {
242 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */ 228 /* Couldn't get 0xA20-0xA23. Try ALTERNATE at 0xA24-0xA27. */
243 link->io.BasePort1 = 0xA24; 229 link->io.BasePort1 = 0xA24;
244 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 230 ret = pcmcia_request_io(link, &link->io);
231 if (ret)
232 goto failed;
245 } 233 }
246 dev->base_addr = link->io.BasePort1; 234 dev->base_addr = link->io.BasePort1;
247 235
248 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 236 ret = pcmcia_request_irq(link, &link->irq);
237 if (ret)
238 goto failed;
249 dev->irq = link->irq.AssignedIRQ; 239 dev->irq = link->irq.AssignedIRQ;
250 ti->irq = link->irq.AssignedIRQ; 240 ti->irq = link->irq.AssignedIRQ;
251 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq); 241 ti->global_int_enable=GLOBAL_INT_ENABLE+((dev->irq==9) ? 2 : dev->irq);
@@ -256,11 +246,15 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
256 req.Base = 0; 246 req.Base = 0;
257 req.Size = 0x2000; 247 req.Size = 0x2000;
258 req.AccessSpeed = 250; 248 req.AccessSpeed = 250;
259 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &link->win)); 249 ret = pcmcia_request_window(&link, &req, &link->win);
250 if (ret)
251 goto failed;
260 252
261 mem.CardOffset = mmiobase; 253 mem.CardOffset = mmiobase;
262 mem.Page = 0; 254 mem.Page = 0;
263 CS_CHECK(MapMemPage, pcmcia_map_mem_page(link->win, &mem)); 255 ret = pcmcia_map_mem_page(link->win, &mem);
256 if (ret)
257 goto failed;
264 ti->mmio = ioremap(req.Base, req.Size); 258 ti->mmio = ioremap(req.Base, req.Size);
265 259
266 /* Allocate the SRAM memory window */ 260 /* Allocate the SRAM memory window */
@@ -269,17 +263,23 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
269 req.Base = 0; 263 req.Base = 0;
270 req.Size = sramsize * 1024; 264 req.Size = sramsize * 1024;
271 req.AccessSpeed = 250; 265 req.AccessSpeed = 250;
272 CS_CHECK(RequestWindow, pcmcia_request_window(&link, &req, &info->sram_win_handle)); 266 ret = pcmcia_request_window(&link, &req, &info->sram_win_handle);
267 if (ret)
268 goto failed;
273 269
274 mem.CardOffset = srambase; 270 mem.CardOffset = srambase;
275 mem.Page = 0; 271 mem.Page = 0;
276 CS_CHECK(MapMemPage, pcmcia_map_mem_page(info->sram_win_handle, &mem)); 272 ret = pcmcia_map_mem_page(info->sram_win_handle, &mem);
273 if (ret)
274 goto failed;
277 275
278 ti->sram_base = mem.CardOffset >> 12; 276 ti->sram_base = mem.CardOffset >> 12;
279 ti->sram_virt = ioremap(req.Base, req.Size); 277 ti->sram_virt = ioremap(req.Base, req.Size);
280 ti->sram_phys = req.Base; 278 ti->sram_phys = req.Base;
281 279
282 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 280 ret = pcmcia_request_configuration(link, &link->conf);
281 if (ret)
282 goto failed;
283 283
284 /* Set up the Token-Ring Controller Configuration Register and 284 /* Set up the Token-Ring Controller Configuration Register and
285 turn on the card. Check the "Local Area Network Credit Card 285 turn on the card. Check the "Local Area Network Credit Card
@@ -305,8 +305,6 @@ static int __devinit ibmtr_config(struct pcmcia_device *link)
305 dev->dev_addr); 305 dev->dev_addr);
306 return 0; 306 return 0;
307 307
308cs_failed:
309 cs_error(link, last_fn, last_ret);
310failed: 308failed:
311 ibmtr_release(link); 309 ibmtr_release(link);
312 return -ENODEV; 310 return -ENODEV;
@@ -325,7 +323,7 @@ static void ibmtr_release(struct pcmcia_device *link)
325 ibmtr_dev_t *info = link->priv; 323 ibmtr_dev_t *info = link->priv;
326 struct net_device *dev = info->dev; 324 struct net_device *dev = info->dev;
327 325
328 DEBUG(0, "ibmtr_release(0x%p)\n", link); 326 dev_dbg(&link->dev, "ibmtr_release\n");
329 327
330 if (link->win) { 328 if (link->win) {
331 struct tok_info *ti = netdev_priv(dev); 329 struct tok_info *ti = netdev_priv(dev);