diff options
author | Joe Perches <joe@perches.com> | 2011-06-26 15:01:30 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-27 03:09:46 -0400 |
commit | d6810e1375c9b3b28ed1caccb6fb706945903f49 (patch) | |
tree | 81222a208cb5f9e1191b37d857b6e8970be49be5 | |
parent | 9cbe50d4231773396f529f51a048770d0ee54ac1 (diff) |
cyclom: Update to current logging forms
Use pr_fmt, pr_<level> and netdev_<level> as appropriate.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/wan/cycx_drv.c | 81 | ||||
-rw-r--r-- | drivers/net/wan/cycx_main.c | 31 | ||||
-rw-r--r-- | drivers/net/wan/cycx_x25.c | 177 |
3 files changed, 133 insertions, 156 deletions
diff --git a/drivers/net/wan/cycx_drv.c b/drivers/net/wan/cycx_drv.c index 164c3624ba89..2a3ecae67a90 100644 --- a/drivers/net/wan/cycx_drv.c +++ b/drivers/net/wan/cycx_drv.c | |||
@@ -48,6 +48,8 @@ | |||
48 | * Aug 8, 1998 acme Initial version. | 48 | * Aug 8, 1998 acme Initial version. |
49 | */ | 49 | */ |
50 | 50 | ||
51 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
52 | |||
51 | #include <linux/init.h> /* __init */ | 53 | #include <linux/init.h> /* __init */ |
52 | #include <linux/module.h> | 54 | #include <linux/module.h> |
53 | #include <linux/kernel.h> /* printk(), and other useful stuff */ | 55 | #include <linux/kernel.h> /* printk(), and other useful stuff */ |
@@ -81,10 +83,9 @@ static u16 checksum(u8 *buf, u32 len); | |||
81 | /* Global Data */ | 83 | /* Global Data */ |
82 | 84 | ||
83 | /* private data */ | 85 | /* private data */ |
84 | static const char modname[] = "cycx_drv"; | ||
85 | static const char fullname[] = "Cyclom 2X Support Module"; | 86 | static const char fullname[] = "Cyclom 2X Support Module"; |
86 | static const char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo " | 87 | static const char copyright[] = |
87 | "<acme@conectiva.com.br>"; | 88 | "(c) 1998-2003 Arnaldo Carvalho de Melo <acme@conectiva.com.br>"; |
88 | 89 | ||
89 | /* Hardware configuration options. | 90 | /* Hardware configuration options. |
90 | * These are arrays of configuration options used by verification routines. | 91 | * These are arrays of configuration options used by verification routines. |
@@ -110,8 +111,8 @@ static const long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 }; | |||
110 | 111 | ||
111 | static int __init cycx_drv_init(void) | 112 | static int __init cycx_drv_init(void) |
112 | { | 113 | { |
113 | printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, | 114 | pr_info("%s v%u.%u %s\n", |
114 | copyright); | 115 | fullname, MOD_VERSION, MOD_RELEASE, copyright); |
115 | 116 | ||
116 | return 0; | 117 | return 0; |
117 | } | 118 | } |
@@ -139,18 +140,16 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) | |||
139 | 140 | ||
140 | /* Verify IRQ configuration options */ | 141 | /* Verify IRQ configuration options */ |
141 | if (!get_option_index(cycx_2x_irq_options, hw->irq)) { | 142 | if (!get_option_index(cycx_2x_irq_options, hw->irq)) { |
142 | printk(KERN_ERR "%s: IRQ %d is invalid!\n", modname, hw->irq); | 143 | pr_err("IRQ %d is invalid!\n", hw->irq); |
143 | return -EINVAL; | 144 | return -EINVAL; |
144 | } | 145 | } |
145 | 146 | ||
146 | /* Setup adapter dual-port memory window and test memory */ | 147 | /* Setup adapter dual-port memory window and test memory */ |
147 | if (!dpmbase) { | 148 | if (!dpmbase) { |
148 | printk(KERN_ERR "%s: you must specify the dpm address!\n", | 149 | pr_err("you must specify the dpm address!\n"); |
149 | modname); | ||
150 | return -EINVAL; | 150 | return -EINVAL; |
151 | } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) { | 151 | } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) { |
152 | printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n", | 152 | pr_err("memory address 0x%lX is invalid!\n", dpmbase); |
153 | modname, dpmbase); | ||
154 | return -EINVAL; | 153 | return -EINVAL; |
155 | } | 154 | } |
156 | 155 | ||
@@ -158,13 +157,12 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) | |||
158 | hw->dpmsize = CYCX_WINDOWSIZE; | 157 | hw->dpmsize = CYCX_WINDOWSIZE; |
159 | 158 | ||
160 | if (!detect_cyc2x(hw->dpmbase)) { | 159 | if (!detect_cyc2x(hw->dpmbase)) { |
161 | printk(KERN_ERR "%s: adapter Cyclom 2X not found at " | 160 | pr_err("adapter Cyclom 2X not found at address 0x%lX!\n", |
162 | "address 0x%lX!\n", modname, dpmbase); | 161 | dpmbase); |
163 | return -EINVAL; | 162 | return -EINVAL; |
164 | } | 163 | } |
165 | 164 | ||
166 | printk(KERN_INFO "%s: found Cyclom 2X card at address 0x%lX.\n", | 165 | pr_info("found Cyclom 2X card at address 0x%lX\n", dpmbase); |
167 | modname, dpmbase); | ||
168 | 166 | ||
169 | /* Load firmware. If loader fails then shut down adapter */ | 167 | /* Load firmware. If loader fails then shut down adapter */ |
170 | err = load_cyc2x(hw, cfm, len); | 168 | err = load_cyc2x(hw, cfm, len); |
@@ -339,7 +337,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len) | |||
339 | for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) | 337 | for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) |
340 | if (buffer_load(addr, code + i, | 338 | if (buffer_load(addr, code + i, |
341 | min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) { | 339 | min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) { |
342 | printk(KERN_ERR "%s: Error !!\n", modname); | 340 | pr_err("Error !!\n"); |
343 | return -1; | 341 | return -1; |
344 | } | 342 | } |
345 | 343 | ||
@@ -370,7 +368,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len) | |||
370 | for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) | 368 | for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) |
371 | if (buffer_load(addr, code + i, | 369 | if (buffer_load(addr, code + i, |
372 | min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) { | 370 | min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) { |
373 | printk(KERN_ERR "%s: Error !!\n", modname); | 371 | pr_err("Error !!\n"); |
374 | return -1; | 372 | return -1; |
375 | } | 373 | } |
376 | 374 | ||
@@ -391,23 +389,20 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) | |||
391 | u16 cksum; | 389 | u16 cksum; |
392 | 390 | ||
393 | /* Announce */ | 391 | /* Announce */ |
394 | printk(KERN_INFO "%s: firmware signature=\"%s\"\n", modname, | 392 | pr_info("firmware signature=\"%s\"\n", cfm->signature); |
395 | cfm->signature); | ||
396 | 393 | ||
397 | /* Verify firmware signature */ | 394 | /* Verify firmware signature */ |
398 | if (strcmp(cfm->signature, CFM_SIGNATURE)) { | 395 | if (strcmp(cfm->signature, CFM_SIGNATURE)) { |
399 | printk(KERN_ERR "%s:load_cyc2x: not Cyclom-2X firmware!\n", | 396 | pr_err("load_cyc2x: not Cyclom-2X firmware!\n"); |
400 | modname); | ||
401 | return -EINVAL; | 397 | return -EINVAL; |
402 | } | 398 | } |
403 | 399 | ||
404 | printk(KERN_INFO "%s: firmware version=%u\n", modname, cfm->version); | 400 | pr_info("firmware version=%u\n", cfm->version); |
405 | 401 | ||
406 | /* Verify firmware module format version */ | 402 | /* Verify firmware module format version */ |
407 | if (cfm->version != CFM_VERSION) { | 403 | if (cfm->version != CFM_VERSION) { |
408 | printk(KERN_ERR "%s:%s: firmware format %u rejected! " | 404 | pr_err("%s: firmware format %u rejected! Expecting %u.\n", |
409 | "Expecting %u.\n", | 405 | __func__, cfm->version, CFM_VERSION); |
410 | modname, __func__, cfm->version, CFM_VERSION); | ||
411 | return -EINVAL; | 406 | return -EINVAL; |
412 | } | 407 | } |
413 | 408 | ||
@@ -419,23 +414,22 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) | |||
419 | if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) || | 414 | if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) || |
420 | */ | 415 | */ |
421 | if (cksum != cfm->checksum) { | 416 | if (cksum != cfm->checksum) { |
422 | printk(KERN_ERR "%s:%s: firmware corrupted!\n", | 417 | pr_err("%s: firmware corrupted!\n", __func__); |
423 | modname, __func__); | 418 | pr_err(" cdsize = 0x%x (expected 0x%lx)\n", |
424 | printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n", | 419 | len - (int)sizeof(struct cycx_firmware) - 1, |
425 | len - (int)sizeof(struct cycx_firmware) - 1, | 420 | cfm->info.codesize); |
426 | cfm->info.codesize); | 421 | pr_err(" chksum = 0x%x (expected 0x%x)\n", |
427 | printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n", | 422 | cksum, cfm->checksum); |
428 | cksum, cfm->checksum); | ||
429 | return -EINVAL; | 423 | return -EINVAL; |
430 | } | 424 | } |
431 | 425 | ||
432 | /* If everything is ok, set reset, data and code pointers */ | 426 | /* If everything is ok, set reset, data and code pointers */ |
433 | img_hdr = (struct cycx_fw_header *)&cfm->image; | 427 | img_hdr = (struct cycx_fw_header *)&cfm->image; |
434 | #ifdef FIRMWARE_DEBUG | 428 | #ifdef FIRMWARE_DEBUG |
435 | printk(KERN_INFO "%s:%s: image sizes\n", __func__, modname); | 429 | pr_info("%s: image sizes\n", __func__); |
436 | printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size); | 430 | pr_info(" reset=%lu\n", img_hdr->reset_size); |
437 | printk(KERN_INFO " data=%lu\n", img_hdr->data_size); | 431 | pr_info(" data=%lu\n", img_hdr->data_size); |
438 | printk(KERN_INFO " code=%lu\n", img_hdr->code_size); | 432 | pr_info(" code=%lu\n", img_hdr->code_size); |
439 | #endif | 433 | #endif |
440 | reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header); | 434 | reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header); |
441 | data_image = reset_image + img_hdr->reset_size; | 435 | data_image = reset_image + img_hdr->reset_size; |
@@ -443,15 +437,14 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) | |||
443 | 437 | ||
444 | /*---- Start load ----*/ | 438 | /*---- Start load ----*/ |
445 | /* Announce */ | 439 | /* Announce */ |
446 | printk(KERN_INFO "%s: loading firmware %s (ID=%u)...\n", modname, | 440 | pr_info("loading firmware %s (ID=%u)...\n", |
447 | cfm->descr[0] ? cfm->descr : "unknown firmware", | 441 | cfm->descr[0] ? cfm->descr : "unknown firmware", |
448 | cfm->info.codeid); | 442 | cfm->info.codeid); |
449 | 443 | ||
450 | for (i = 0 ; i < 5 ; i++) { | 444 | for (i = 0 ; i < 5 ; i++) { |
451 | /* Reset Cyclom hardware */ | 445 | /* Reset Cyclom hardware */ |
452 | if (!reset_cyc2x(hw->dpmbase)) { | 446 | if (!reset_cyc2x(hw->dpmbase)) { |
453 | printk(KERN_ERR "%s: dpm problem or board not found\n", | 447 | pr_err("dpm problem or board not found\n"); |
454 | modname); | ||
455 | return -EINVAL; | 448 | return -EINVAL; |
456 | } | 449 | } |
457 | 450 | ||
@@ -468,19 +461,19 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) | |||
468 | msleep_interruptible(1 * 1000); | 461 | msleep_interruptible(1 * 1000); |
469 | } | 462 | } |
470 | 463 | ||
471 | printk(KERN_ERR "%s: reset not started.\n", modname); | 464 | pr_err("reset not started\n"); |
472 | return -EINVAL; | 465 | return -EINVAL; |
473 | 466 | ||
474 | reset_loaded: | 467 | reset_loaded: |
475 | /* Load data.bin */ | 468 | /* Load data.bin */ |
476 | if (cycx_data_boot(hw->dpmbase, data_image, img_hdr->data_size)) { | 469 | if (cycx_data_boot(hw->dpmbase, data_image, img_hdr->data_size)) { |
477 | printk(KERN_ERR "%s: cannot load data file.\n", modname); | 470 | pr_err("cannot load data file\n"); |
478 | return -EINVAL; | 471 | return -EINVAL; |
479 | } | 472 | } |
480 | 473 | ||
481 | /* Load code.bin */ | 474 | /* Load code.bin */ |
482 | if (cycx_code_boot(hw->dpmbase, code_image, img_hdr->code_size)) { | 475 | if (cycx_code_boot(hw->dpmbase, code_image, img_hdr->code_size)) { |
483 | printk(KERN_ERR "%s: cannot load code file.\n", modname); | 476 | pr_err("cannot load code file\n"); |
484 | return -EINVAL; | 477 | return -EINVAL; |
485 | } | 478 | } |
486 | 479 | ||
@@ -493,7 +486,7 @@ reset_loaded: | |||
493 | /* Arthur Ganzert's tip: wait a while after the firmware loading... | 486 | /* Arthur Ganzert's tip: wait a while after the firmware loading... |
494 | seg abr 26 17:17:12 EST 1999 - acme */ | 487 | seg abr 26 17:17:12 EST 1999 - acme */ |
495 | msleep_interruptible(7 * 1000); | 488 | msleep_interruptible(7 * 1000); |
496 | printk(KERN_INFO "%s: firmware loaded!\n", modname); | 489 | pr_info("firmware loaded!\n"); |
497 | 490 | ||
498 | /* enable interrupts */ | 491 | /* enable interrupts */ |
499 | cycx_inten(hw); | 492 | cycx_inten(hw); |
diff --git a/drivers/net/wan/cycx_main.c b/drivers/net/wan/cycx_main.c index a0976d1f97c6..81fbbad406be 100644 --- a/drivers/net/wan/cycx_main.c +++ b/drivers/net/wan/cycx_main.c | |||
@@ -40,6 +40,8 @@ | |||
40 | * 1998/08/08 acme Initial version. | 40 | * 1998/08/08 acme Initial version. |
41 | */ | 41 | */ |
42 | 42 | ||
43 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
44 | |||
43 | #include <linux/stddef.h> /* offsetof(), etc. */ | 45 | #include <linux/stddef.h> /* offsetof(), etc. */ |
44 | #include <linux/errno.h> /* return codes */ | 46 | #include <linux/errno.h> /* return codes */ |
45 | #include <linux/string.h> /* inline memset(), etc. */ | 47 | #include <linux/string.h> /* inline memset(), etc. */ |
@@ -107,7 +109,7 @@ static int __init cycx_init(void) | |||
107 | { | 109 | { |
108 | int cnt, err = -ENOMEM; | 110 | int cnt, err = -ENOMEM; |
109 | 111 | ||
110 | printk(KERN_INFO "%s v%u.%u %s\n", | 112 | pr_info("%s v%u.%u %s\n", |
111 | cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE, | 113 | cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE, |
112 | cycx_copyright); | 114 | cycx_copyright); |
113 | 115 | ||
@@ -133,9 +135,8 @@ static int __init cycx_init(void) | |||
133 | err = register_wan_device(wandev); | 135 | err = register_wan_device(wandev); |
134 | 136 | ||
135 | if (err) { | 137 | if (err) { |
136 | printk(KERN_ERR "%s: %s registration failed with " | 138 | pr_err("%s registration failed with error %d!\n", |
137 | "error %d!\n", | 139 | card->devname, err); |
138 | cycx_drvname, card->devname, err); | ||
139 | break; | 140 | break; |
140 | } | 141 | } |
141 | } | 142 | } |
@@ -198,14 +199,13 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) | |||
198 | 199 | ||
199 | rc = -EINVAL; | 200 | rc = -EINVAL; |
200 | if (!conf->data_size || !conf->data) { | 201 | if (!conf->data_size || !conf->data) { |
201 | printk(KERN_ERR "%s: firmware not found in configuration " | 202 | pr_err("%s: firmware not found in configuration data!\n", |
202 | "data!\n", wandev->name); | 203 | wandev->name); |
203 | goto out; | 204 | goto out; |
204 | } | 205 | } |
205 | 206 | ||
206 | if (conf->irq <= 0) { | 207 | if (conf->irq <= 0) { |
207 | printk(KERN_ERR "%s: can't configure without IRQ!\n", | 208 | pr_err("%s: can't configure without IRQ!\n", wandev->name); |
208 | wandev->name); | ||
209 | goto out; | 209 | goto out; |
210 | } | 210 | } |
211 | 211 | ||
@@ -213,8 +213,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) | |||
213 | irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */ | 213 | irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */ |
214 | 214 | ||
215 | if (request_irq(irq, cycx_isr, 0, wandev->name, card)) { | 215 | if (request_irq(irq, cycx_isr, 0, wandev->name, card)) { |
216 | printk(KERN_ERR "%s: can't reserve IRQ %d!\n", | 216 | pr_err("%s: can't reserve IRQ %d!\n", wandev->name, irq); |
217 | wandev->name, irq); | ||
218 | goto out; | 217 | goto out; |
219 | } | 218 | } |
220 | 219 | ||
@@ -246,8 +245,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) | |||
246 | break; | 245 | break; |
247 | #endif | 246 | #endif |
248 | default: | 247 | default: |
249 | printk(KERN_ERR "%s: this firmware is not supported!\n", | 248 | pr_err("%s: this firmware is not supported!\n", wandev->name); |
250 | wandev->name); | ||
251 | rc = -EINVAL; | 249 | rc = -EINVAL; |
252 | } | 250 | } |
253 | 251 | ||
@@ -288,8 +286,7 @@ static int cycx_wan_shutdown(struct wan_device *wandev) | |||
288 | card = wandev->private; | 286 | card = wandev->private; |
289 | wandev->state = WAN_UNCONFIGURED; | 287 | wandev->state = WAN_UNCONFIGURED; |
290 | cycx_down(&card->hw); | 288 | cycx_down(&card->hw); |
291 | printk(KERN_INFO "%s: irq %d being freed!\n", wandev->name, | 289 | pr_info("%s: irq %d being freed!\n", wandev->name, wandev->irq); |
292 | wandev->irq); | ||
293 | free_irq(wandev->irq, card); | 290 | free_irq(wandev->irq, card); |
294 | out: return ret; | 291 | out: return ret; |
295 | } | 292 | } |
@@ -308,8 +305,8 @@ static irqreturn_t cycx_isr(int irq, void *dev_id) | |||
308 | goto out; | 305 | goto out; |
309 | 306 | ||
310 | if (card->in_isr) { | 307 | if (card->in_isr) { |
311 | printk(KERN_WARNING "%s: interrupt re-entrancy on IRQ %d!\n", | 308 | pr_warn("%s: interrupt re-entrancy on IRQ %d!\n", |
312 | card->devname, card->wandev.irq); | 309 | card->devname, card->wandev.irq); |
313 | goto out; | 310 | goto out; |
314 | } | 311 | } |
315 | 312 | ||
@@ -337,7 +334,7 @@ void cycx_set_state(struct cycx_device *card, int state) | |||
337 | string_state = "disconnected!"; | 334 | string_state = "disconnected!"; |
338 | break; | 335 | break; |
339 | } | 336 | } |
340 | printk(KERN_INFO "%s: link %s\n", card->devname, string_state); | 337 | pr_info("%s: link %s\n", card->devname, string_state); |
341 | card->wandev.state = state; | 338 | card->wandev.state = state; |
342 | } | 339 | } |
343 | 340 | ||
diff --git a/drivers/net/wan/cycx_x25.c b/drivers/net/wan/cycx_x25.c index cf9e15fd8d91..06f3f6309e4b 100644 --- a/drivers/net/wan/cycx_x25.c +++ b/drivers/net/wan/cycx_x25.c | |||
@@ -76,6 +76,8 @@ | |||
76 | * 1998/08/08 acme Initial version. | 76 | * 1998/08/08 acme Initial version. |
77 | */ | 77 | */ |
78 | 78 | ||
79 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
80 | |||
79 | #define CYCLOMX_X25_DEBUG 1 | 81 | #define CYCLOMX_X25_DEBUG 1 |
80 | 82 | ||
81 | #include <linux/ctype.h> /* isdigit() */ | 83 | #include <linux/ctype.h> /* isdigit() */ |
@@ -230,8 +232,8 @@ int cycx_x25_wan_init(struct cycx_device *card, wandev_conf_t *conf) | |||
230 | 232 | ||
231 | /* Verify configuration ID */ | 233 | /* Verify configuration ID */ |
232 | if (conf->config_id != WANCONFIG_X25) { | 234 | if (conf->config_id != WANCONFIG_X25) { |
233 | printk(KERN_INFO "%s: invalid configuration ID %u!\n", | 235 | pr_info("%s: invalid configuration ID %u!\n", |
234 | card->devname, conf->config_id); | 236 | card->devname, conf->config_id); |
235 | return -EINVAL; | 237 | return -EINVAL; |
236 | } | 238 | } |
237 | 239 | ||
@@ -374,8 +376,7 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, | |||
374 | int err = 0; | 376 | int err = 0; |
375 | 377 | ||
376 | if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) { | 378 | if (!conf->name[0] || strlen(conf->name) > WAN_IFNAME_SZ) { |
377 | printk(KERN_INFO "%s: invalid interface name!\n", | 379 | pr_info("%s: invalid interface name!\n", card->devname); |
378 | card->devname); | ||
379 | return -EINVAL; | 380 | return -EINVAL; |
380 | } | 381 | } |
381 | 382 | ||
@@ -398,8 +399,8 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, | |||
398 | 399 | ||
399 | if (len) { | 400 | if (len) { |
400 | if (len > WAN_ADDRESS_SZ) { | 401 | if (len > WAN_ADDRESS_SZ) { |
401 | printk(KERN_ERR "%s: %s local addr too long!\n", | 402 | pr_err("%s: %s local addr too long!\n", |
402 | wandev->name, chan->name); | 403 | wandev->name, chan->name); |
403 | err = -EINVAL; | 404 | err = -EINVAL; |
404 | goto error; | 405 | goto error; |
405 | } else { | 406 | } else { |
@@ -429,15 +430,14 @@ static int cycx_wan_new_if(struct wan_device *wandev, struct net_device *dev, | |||
429 | if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) | 430 | if (lcn >= card->u.x.lo_pvc && lcn <= card->u.x.hi_pvc) |
430 | chan->lcn = lcn; | 431 | chan->lcn = lcn; |
431 | else { | 432 | else { |
432 | printk(KERN_ERR | 433 | pr_err("%s: PVC %u is out of range on interface %s!\n", |
433 | "%s: PVC %u is out of range on interface %s!\n", | 434 | wandev->name, lcn, chan->name); |
434 | wandev->name, lcn, chan->name); | ||
435 | err = -EINVAL; | 435 | err = -EINVAL; |
436 | goto error; | 436 | goto error; |
437 | } | 437 | } |
438 | } else { | 438 | } else { |
439 | printk(KERN_ERR "%s: invalid media address on interface %s!\n", | 439 | pr_err("%s: invalid media address on interface %s!\n", |
440 | wandev->name, chan->name); | 440 | wandev->name, chan->name); |
441 | err = -EINVAL; | 441 | err = -EINVAL; |
442 | goto error; | 442 | goto error; |
443 | } | 443 | } |
@@ -607,9 +607,8 @@ static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb, | |||
607 | ++chan->ifstats.tx_dropped; | 607 | ++chan->ifstats.tx_dropped; |
608 | else if (chan->svc && chan->protocol && | 608 | else if (chan->svc && chan->protocol && |
609 | chan->protocol != ntohs(skb->protocol)) { | 609 | chan->protocol != ntohs(skb->protocol)) { |
610 | printk(KERN_INFO | 610 | pr_info("%s: unsupported Ethertype 0x%04X on interface %s!\n", |
611 | "%s: unsupported Ethertype 0x%04X on interface %s!\n", | 611 | card->devname, ntohs(skb->protocol), dev->name); |
612 | card->devname, ntohs(skb->protocol), dev->name); | ||
613 | ++chan->ifstats.tx_errors; | 612 | ++chan->ifstats.tx_errors; |
614 | } else if (chan->protocol == ETH_P_IP) { | 613 | } else if (chan->protocol == ETH_P_IP) { |
615 | switch (chan->state) { | 614 | switch (chan->state) { |
@@ -643,9 +642,8 @@ static netdev_tx_t cycx_netdevice_hard_start_xmit(struct sk_buff *skb, | |||
643 | cycx_x25_chan_disconnect(dev); | 642 | cycx_x25_chan_disconnect(dev); |
644 | goto free_packet; | 643 | goto free_packet; |
645 | default: | 644 | default: |
646 | printk(KERN_INFO | 645 | pr_info("%s: unknown %d x25-iface request on %s!\n", |
647 | "%s: unknown %d x25-iface request on %s!\n", | 646 | card->devname, skb->data[0], dev->name); |
648 | card->devname, skb->data[0], dev->name); | ||
649 | ++chan->ifstats.tx_errors; | 647 | ++chan->ifstats.tx_errors; |
650 | goto free_packet; | 648 | goto free_packet; |
651 | } | 649 | } |
@@ -746,8 +744,7 @@ static void cycx_x25_irq_tx(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
746 | card->buff_int_mode_unbusy = 1; | 744 | card->buff_int_mode_unbusy = 1; |
747 | netif_wake_queue(dev); | 745 | netif_wake_queue(dev); |
748 | } else | 746 | } else |
749 | printk(KERN_ERR "%s:ackvc for inexistent lcn %d\n", | 747 | pr_err("%s:ackvc for inexistent lcn %d\n", card->devname, lcn); |
750 | card->devname, lcn); | ||
751 | } | 748 | } |
752 | 749 | ||
753 | /* Receive interrupt handler. | 750 | /* Receive interrupt handler. |
@@ -780,8 +777,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
780 | dev = cycx_x25_get_dev_by_lcn(wandev, lcn); | 777 | dev = cycx_x25_get_dev_by_lcn(wandev, lcn); |
781 | if (!dev) { | 778 | if (!dev) { |
782 | /* Invalid channel, discard packet */ | 779 | /* Invalid channel, discard packet */ |
783 | printk(KERN_INFO "%s: receiving on orphaned LCN %d!\n", | 780 | pr_info("%s: receiving on orphaned LCN %d!\n", |
784 | card->devname, lcn); | 781 | card->devname, lcn); |
785 | return; | 782 | return; |
786 | } | 783 | } |
787 | 784 | ||
@@ -802,8 +799,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
802 | if ((skb = dev_alloc_skb((chan->protocol == ETH_P_X25 ? 1 : 0) + | 799 | if ((skb = dev_alloc_skb((chan->protocol == ETH_P_X25 ? 1 : 0) + |
803 | bufsize + | 800 | bufsize + |
804 | dev->hard_header_len)) == NULL) { | 801 | dev->hard_header_len)) == NULL) { |
805 | printk(KERN_INFO "%s: no socket buffers available!\n", | 802 | pr_info("%s: no socket buffers available!\n", |
806 | card->devname); | 803 | card->devname); |
807 | chan->drop_sequence = 1; | 804 | chan->drop_sequence = 1; |
808 | ++chan->ifstats.rx_dropped; | 805 | ++chan->ifstats.rx_dropped; |
809 | return; | 806 | return; |
@@ -826,8 +823,8 @@ static void cycx_x25_irq_rx(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
826 | if (bitm) | 823 | if (bitm) |
827 | chan->drop_sequence = 1; | 824 | chan->drop_sequence = 1; |
828 | 825 | ||
829 | printk(KERN_INFO "%s: unexpectedly long packet sequence " | 826 | pr_info("%s: unexpectedly long packet sequence on interface %s!\n", |
830 | "on interface %s!\n", card->devname, dev->name); | 827 | card->devname, dev->name); |
831 | ++chan->ifstats.rx_length_errors; | 828 | ++chan->ifstats.rx_length_errors; |
832 | return; | 829 | return; |
833 | } | 830 | } |
@@ -880,8 +877,8 @@ static void cycx_x25_irq_connect(struct cycx_device *card, | |||
880 | dev = cycx_x25_get_dev_by_dte_addr(wandev, rem); | 877 | dev = cycx_x25_get_dev_by_dte_addr(wandev, rem); |
881 | if (!dev) { | 878 | if (!dev) { |
882 | /* Invalid channel, discard packet */ | 879 | /* Invalid channel, discard packet */ |
883 | printk(KERN_INFO "%s: connect not expected: remote %s!\n", | 880 | pr_info("%s: connect not expected: remote %s!\n", |
884 | card->devname, rem); | 881 | card->devname, rem); |
885 | return; | 882 | return; |
886 | } | 883 | } |
887 | 884 | ||
@@ -909,8 +906,8 @@ static void cycx_x25_irq_connect_confirm(struct cycx_device *card, | |||
909 | if (!dev) { | 906 | if (!dev) { |
910 | /* Invalid channel, discard packet */ | 907 | /* Invalid channel, discard packet */ |
911 | clear_bit(--key, (void*)&card->u.x.connection_keys); | 908 | clear_bit(--key, (void*)&card->u.x.connection_keys); |
912 | printk(KERN_INFO "%s: connect confirm not expected: lcn %d, " | 909 | pr_info("%s: connect confirm not expected: lcn %d, key=%d!\n", |
913 | "key=%d!\n", card->devname, lcn, key); | 910 | card->devname, lcn, key); |
914 | return; | 911 | return; |
915 | } | 912 | } |
916 | 913 | ||
@@ -934,8 +931,8 @@ static void cycx_x25_irq_disconnect_confirm(struct cycx_device *card, | |||
934 | dev = cycx_x25_get_dev_by_lcn(wandev, lcn); | 931 | dev = cycx_x25_get_dev_by_lcn(wandev, lcn); |
935 | if (!dev) { | 932 | if (!dev) { |
936 | /* Invalid channel, discard packet */ | 933 | /* Invalid channel, discard packet */ |
937 | printk(KERN_INFO "%s:disconnect confirm not expected!:lcn %d\n", | 934 | pr_info("%s:disconnect confirm not expected!:lcn %d\n", |
938 | card->devname, lcn); | 935 | card->devname, lcn); |
939 | return; | 936 | return; |
940 | } | 937 | } |
941 | 938 | ||
@@ -980,13 +977,13 @@ static void cycx_x25_irq_log(struct cycx_device *card, struct cycx_x25_cmd *cmd) | |||
980 | cycx_peek(&card->hw, cmd->buf + 10 + toread, &code, 1); | 977 | cycx_peek(&card->hw, cmd->buf + 10 + toread, &code, 1); |
981 | cycx_peek(&card->hw, cmd->buf + 10 + toread + 1, &routine, 1); | 978 | cycx_peek(&card->hw, cmd->buf + 10 + toread + 1, &routine, 1); |
982 | 979 | ||
983 | printk(KERN_INFO "cycx_x25_irq_handler: X25_LOG (0x4500) indic.:\n"); | 980 | pr_info("cycx_x25_irq_handler: X25_LOG (0x4500) indic.:\n"); |
984 | printk(KERN_INFO "cmd->buf=0x%X\n", cmd->buf); | 981 | pr_info("cmd->buf=0x%X\n", cmd->buf); |
985 | printk(KERN_INFO "Log message code=0x%X\n", msg_code); | 982 | pr_info("Log message code=0x%X\n", msg_code); |
986 | printk(KERN_INFO "Link=%d\n", link); | 983 | pr_info("Link=%d\n", link); |
987 | printk(KERN_INFO "log code=0x%X\n", code); | 984 | pr_info("log code=0x%X\n", code); |
988 | printk(KERN_INFO "log routine=0x%X\n", routine); | 985 | pr_info("log routine=0x%X\n", routine); |
989 | printk(KERN_INFO "Message size=%d\n", size); | 986 | pr_info("Message size=%d\n", size); |
990 | hex_dump("Message", bf, toread); | 987 | hex_dump("Message", bf, toread); |
991 | #endif | 988 | #endif |
992 | } | 989 | } |
@@ -1009,24 +1006,14 @@ static void cycx_x25_irq_stat(struct cycx_device *card, | |||
1009 | static void cycx_x25_irq_spurious(struct cycx_device *card, | 1006 | static void cycx_x25_irq_spurious(struct cycx_device *card, |
1010 | struct cycx_x25_cmd *cmd) | 1007 | struct cycx_x25_cmd *cmd) |
1011 | { | 1008 | { |
1012 | printk(KERN_INFO "%s: spurious interrupt (0x%X)!\n", | 1009 | pr_info("%s: spurious interrupt (0x%X)!\n", |
1013 | card->devname, cmd->command); | 1010 | card->devname, cmd->command); |
1014 | } | 1011 | } |
1015 | #ifdef CYCLOMX_X25_DEBUG | 1012 | #ifdef CYCLOMX_X25_DEBUG |
1016 | static void hex_dump(char *msg, unsigned char *p, int len) | 1013 | static void hex_dump(char *msg, unsigned char *p, int len) |
1017 | { | 1014 | { |
1018 | unsigned char hex[1024], | 1015 | print_hex_dump(KERN_INFO, msg, DUMP_PREFIX_OFFSET, 16, 1, |
1019 | * phex = hex; | 1016 | p, len, true); |
1020 | |||
1021 | if (len >= (sizeof(hex) / 2)) | ||
1022 | len = (sizeof(hex) / 2) - 1; | ||
1023 | |||
1024 | while (len--) { | ||
1025 | sprintf(phex, "%02x", *p++); | ||
1026 | phex += 2; | ||
1027 | } | ||
1028 | |||
1029 | printk(KERN_INFO "%s: %s\n", msg, hex); | ||
1030 | } | 1017 | } |
1031 | #endif | 1018 | #endif |
1032 | 1019 | ||
@@ -1203,8 +1190,8 @@ static int x25_place_call(struct cycx_device *card, | |||
1203 | u8 key; | 1190 | u8 key; |
1204 | 1191 | ||
1205 | if (card->u.x.connection_keys == ~0U) { | 1192 | if (card->u.x.connection_keys == ~0U) { |
1206 | printk(KERN_INFO "%s: too many simultaneous connection " | 1193 | pr_info("%s: too many simultaneous connection requests!\n", |
1207 | "requests!\n", card->devname); | 1194 | card->devname); |
1208 | return -EAGAIN; | 1195 | return -EAGAIN; |
1209 | } | 1196 | } |
1210 | 1197 | ||
@@ -1381,8 +1368,8 @@ static void cycx_x25_chan_timer(unsigned long d) | |||
1381 | if (chan->state == WAN_CONNECTED) | 1368 | if (chan->state == WAN_CONNECTED) |
1382 | cycx_x25_chan_disconnect(dev); | 1369 | cycx_x25_chan_disconnect(dev); |
1383 | else | 1370 | else |
1384 | printk(KERN_ERR "%s: %s for svc (%s) not connected!\n", | 1371 | pr_err("%s: %s for svc (%s) not connected!\n", |
1385 | chan->card->devname, __func__, dev->name); | 1372 | chan->card->devname, __func__, dev->name); |
1386 | } | 1373 | } |
1387 | 1374 | ||
1388 | /* Set logical channel state. */ | 1375 | /* Set logical channel state. */ |
@@ -1433,8 +1420,8 @@ static void cycx_x25_set_chan_state(struct net_device *dev, u8 state) | |||
1433 | break; | 1420 | break; |
1434 | } | 1421 | } |
1435 | 1422 | ||
1436 | printk(KERN_INFO "%s: interface %s %s\n", card->devname, | 1423 | pr_info("%s: interface %s %s\n", |
1437 | dev->name, string_state); | 1424 | card->devname, dev->name, string_state); |
1438 | chan->state = state; | 1425 | chan->state = state; |
1439 | } | 1426 | } |
1440 | 1427 | ||
@@ -1488,7 +1475,7 @@ static void cycx_x25_chan_send_event(struct net_device *dev, u8 event) | |||
1488 | unsigned char *ptr; | 1475 | unsigned char *ptr; |
1489 | 1476 | ||
1490 | if ((skb = dev_alloc_skb(1)) == NULL) { | 1477 | if ((skb = dev_alloc_skb(1)) == NULL) { |
1491 | printk(KERN_ERR "%s: out of memory\n", __func__); | 1478 | pr_err("%s: out of memory\n", __func__); |
1492 | return; | 1479 | return; |
1493 | } | 1480 | } |
1494 | 1481 | ||
@@ -1557,56 +1544,56 @@ static void reset_timer(struct net_device *dev) | |||
1557 | #ifdef CYCLOMX_X25_DEBUG | 1544 | #ifdef CYCLOMX_X25_DEBUG |
1558 | static void cycx_x25_dump_config(struct cycx_x25_config *conf) | 1545 | static void cycx_x25_dump_config(struct cycx_x25_config *conf) |
1559 | { | 1546 | { |
1560 | printk(KERN_INFO "X.25 configuration\n"); | 1547 | pr_info("X.25 configuration\n"); |
1561 | printk(KERN_INFO "-----------------\n"); | 1548 | pr_info("-----------------\n"); |
1562 | printk(KERN_INFO "link number=%d\n", conf->link); | 1549 | pr_info("link number=%d\n", conf->link); |
1563 | printk(KERN_INFO "line speed=%d\n", conf->speed); | 1550 | pr_info("line speed=%d\n", conf->speed); |
1564 | printk(KERN_INFO "clock=%sternal\n", conf->clock == 8 ? "Ex" : "In"); | 1551 | pr_info("clock=%sternal\n", conf->clock == 8 ? "Ex" : "In"); |
1565 | printk(KERN_INFO "# level 2 retransm.=%d\n", conf->n2); | 1552 | pr_info("# level 2 retransm.=%d\n", conf->n2); |
1566 | printk(KERN_INFO "level 2 window=%d\n", conf->n2win); | 1553 | pr_info("level 2 window=%d\n", conf->n2win); |
1567 | printk(KERN_INFO "level 3 window=%d\n", conf->n3win); | 1554 | pr_info("level 3 window=%d\n", conf->n3win); |
1568 | printk(KERN_INFO "# logical channels=%d\n", conf->nvc); | 1555 | pr_info("# logical channels=%d\n", conf->nvc); |
1569 | printk(KERN_INFO "level 3 pkt len=%d\n", conf->pktlen); | 1556 | pr_info("level 3 pkt len=%d\n", conf->pktlen); |
1570 | printk(KERN_INFO "my address=%d\n", conf->locaddr); | 1557 | pr_info("my address=%d\n", conf->locaddr); |
1571 | printk(KERN_INFO "remote address=%d\n", conf->remaddr); | 1558 | pr_info("remote address=%d\n", conf->remaddr); |
1572 | printk(KERN_INFO "t1=%d seconds\n", conf->t1); | 1559 | pr_info("t1=%d seconds\n", conf->t1); |
1573 | printk(KERN_INFO "t2=%d seconds\n", conf->t2); | 1560 | pr_info("t2=%d seconds\n", conf->t2); |
1574 | printk(KERN_INFO "t21=%d seconds\n", conf->t21); | 1561 | pr_info("t21=%d seconds\n", conf->t21); |
1575 | printk(KERN_INFO "# PVCs=%d\n", conf->npvc); | 1562 | pr_info("# PVCs=%d\n", conf->npvc); |
1576 | printk(KERN_INFO "t23=%d seconds\n", conf->t23); | 1563 | pr_info("t23=%d seconds\n", conf->t23); |
1577 | printk(KERN_INFO "flags=0x%x\n", conf->flags); | 1564 | pr_info("flags=0x%x\n", conf->flags); |
1578 | } | 1565 | } |
1579 | 1566 | ||
1580 | static void cycx_x25_dump_stats(struct cycx_x25_stats *stats) | 1567 | static void cycx_x25_dump_stats(struct cycx_x25_stats *stats) |
1581 | { | 1568 | { |
1582 | printk(KERN_INFO "X.25 statistics\n"); | 1569 | pr_info("X.25 statistics\n"); |
1583 | printk(KERN_INFO "--------------\n"); | 1570 | pr_info("--------------\n"); |
1584 | printk(KERN_INFO "rx_crc_errors=%d\n", stats->rx_crc_errors); | 1571 | pr_info("rx_crc_errors=%d\n", stats->rx_crc_errors); |
1585 | printk(KERN_INFO "rx_over_errors=%d\n", stats->rx_over_errors); | 1572 | pr_info("rx_over_errors=%d\n", stats->rx_over_errors); |
1586 | printk(KERN_INFO "n2_tx_frames=%d\n", stats->n2_tx_frames); | 1573 | pr_info("n2_tx_frames=%d\n", stats->n2_tx_frames); |
1587 | printk(KERN_INFO "n2_rx_frames=%d\n", stats->n2_rx_frames); | 1574 | pr_info("n2_rx_frames=%d\n", stats->n2_rx_frames); |
1588 | printk(KERN_INFO "tx_timeouts=%d\n", stats->tx_timeouts); | 1575 | pr_info("tx_timeouts=%d\n", stats->tx_timeouts); |
1589 | printk(KERN_INFO "rx_timeouts=%d\n", stats->rx_timeouts); | 1576 | pr_info("rx_timeouts=%d\n", stats->rx_timeouts); |
1590 | printk(KERN_INFO "n3_tx_packets=%d\n", stats->n3_tx_packets); | 1577 | pr_info("n3_tx_packets=%d\n", stats->n3_tx_packets); |
1591 | printk(KERN_INFO "n3_rx_packets=%d\n", stats->n3_rx_packets); | 1578 | pr_info("n3_rx_packets=%d\n", stats->n3_rx_packets); |
1592 | printk(KERN_INFO "tx_aborts=%d\n", stats->tx_aborts); | 1579 | pr_info("tx_aborts=%d\n", stats->tx_aborts); |
1593 | printk(KERN_INFO "rx_aborts=%d\n", stats->rx_aborts); | 1580 | pr_info("rx_aborts=%d\n", stats->rx_aborts); |
1594 | } | 1581 | } |
1595 | 1582 | ||
1596 | static void cycx_x25_dump_devs(struct wan_device *wandev) | 1583 | static void cycx_x25_dump_devs(struct wan_device *wandev) |
1597 | { | 1584 | { |
1598 | struct net_device *dev = wandev->dev; | 1585 | struct net_device *dev = wandev->dev; |
1599 | 1586 | ||
1600 | printk(KERN_INFO "X.25 dev states\n"); | 1587 | pr_info("X.25 dev states\n"); |
1601 | printk(KERN_INFO "name: addr: txoff: protocol:\n"); | 1588 | pr_info("name: addr: txoff: protocol:\n"); |
1602 | printk(KERN_INFO "---------------------------------------\n"); | 1589 | pr_info("---------------------------------------\n"); |
1603 | 1590 | ||
1604 | while(dev) { | 1591 | while(dev) { |
1605 | struct cycx_x25_channel *chan = netdev_priv(dev); | 1592 | struct cycx_x25_channel *chan = netdev_priv(dev); |
1606 | 1593 | ||
1607 | printk(KERN_INFO "%-5.5s %-15.15s %d ETH_P_%s\n", | 1594 | pr_info("%-5.5s %-15.15s %d ETH_P_%s\n", |
1608 | chan->name, chan->addr, netif_queue_stopped(dev), | 1595 | chan->name, chan->addr, netif_queue_stopped(dev), |
1609 | chan->protocol == ETH_P_IP ? "IP" : "X25"); | 1596 | chan->protocol == ETH_P_IP ? "IP" : "X25"); |
1610 | dev = chan->slave; | 1597 | dev = chan->slave; |
1611 | } | 1598 | } |
1612 | } | 1599 | } |