Commit d6810e13 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

cyclom: Update to current logging forms

Use pr_fmt, pr_<level> and netdev_<level> as appropriate.
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9cbe50d4
...@@ -48,6 +48,8 @@ ...@@ -48,6 +48,8 @@
* Aug 8, 1998 acme Initial version. * Aug 8, 1998 acme Initial version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/init.h> /* __init */ #include <linux/init.h> /* __init */
#include <linux/module.h> #include <linux/module.h>
#include <linux/kernel.h> /* printk(), and other useful stuff */ #include <linux/kernel.h> /* printk(), and other useful stuff */
...@@ -81,10 +83,9 @@ static u16 checksum(u8 *buf, u32 len); ...@@ -81,10 +83,9 @@ static u16 checksum(u8 *buf, u32 len);
/* Global Data */ /* Global Data */
/* private data */ /* private data */
static const char modname[] = "cycx_drv";
static const char fullname[] = "Cyclom 2X Support Module"; static const char fullname[] = "Cyclom 2X Support Module";
static const char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo " static const char copyright[] =
"<acme@conectiva.com.br>"; "(c) 1998-2003 Arnaldo Carvalho de Melo <acme@conectiva.com.br>";
/* Hardware configuration options. /* Hardware configuration options.
* These are arrays of configuration options used by verification routines. * 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,8 +111,8 @@ static const long cycx_2x_irq_options[] = { 7, 3, 5, 9, 10, 11, 12, 15 };
static int __init cycx_drv_init(void) static int __init cycx_drv_init(void)
{ {
printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE, pr_info("%s v%u.%u %s\n",
copyright); fullname, MOD_VERSION, MOD_RELEASE, copyright);
return 0; return 0;
} }
...@@ -139,18 +140,16 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) ...@@ -139,18 +140,16 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase)
/* Verify IRQ configuration options */ /* Verify IRQ configuration options */
if (!get_option_index(cycx_2x_irq_options, hw->irq)) { if (!get_option_index(cycx_2x_irq_options, hw->irq)) {
printk(KERN_ERR "%s: IRQ %d is invalid!\n", modname, hw->irq); pr_err("IRQ %d is invalid!\n", hw->irq);
return -EINVAL; return -EINVAL;
} }
/* Setup adapter dual-port memory window and test memory */ /* Setup adapter dual-port memory window and test memory */
if (!dpmbase) { if (!dpmbase) {
printk(KERN_ERR "%s: you must specify the dpm address!\n", pr_err("you must specify the dpm address!\n");
modname);
return -EINVAL; return -EINVAL;
} else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) { } else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) {
printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n", pr_err("memory address 0x%lX is invalid!\n", dpmbase);
modname, dpmbase);
return -EINVAL; return -EINVAL;
} }
...@@ -158,13 +157,12 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase) ...@@ -158,13 +157,12 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase)
hw->dpmsize = CYCX_WINDOWSIZE; hw->dpmsize = CYCX_WINDOWSIZE;
if (!detect_cyc2x(hw->dpmbase)) { if (!detect_cyc2x(hw->dpmbase)) {
printk(KERN_ERR "%s: adapter Cyclom 2X not found at " pr_err("adapter Cyclom 2X not found at address 0x%lX!\n",
"address 0x%lX!\n", modname, dpmbase); dpmbase);
return -EINVAL; return -EINVAL;
} }
printk(KERN_INFO "%s: found Cyclom 2X card at address 0x%lX.\n", pr_info("found Cyclom 2X card at address 0x%lX\n", dpmbase);
modname, dpmbase);
/* Load firmware. If loader fails then shut down adapter */ /* Load firmware. If loader fails then shut down adapter */
err = load_cyc2x(hw, cfm, len); err = load_cyc2x(hw, cfm, len);
...@@ -339,7 +337,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len) ...@@ -339,7 +337,7 @@ static int cycx_data_boot(void __iomem *addr, u8 *code, u32 len)
for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ)
if (buffer_load(addr, code + i, if (buffer_load(addr, code + i,
min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) { min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) {
printk(KERN_ERR "%s: Error !!\n", modname); pr_err("Error !!\n");
return -1; return -1;
} }
...@@ -370,7 +368,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len) ...@@ -370,7 +368,7 @@ static int cycx_code_boot(void __iomem *addr, u8 *code, u32 len)
for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ) for (i = 0 ; i < len ; i += CFM_LOAD_BUFSZ)
if (buffer_load(addr, code + i, if (buffer_load(addr, code + i,
min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) { min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) {
printk(KERN_ERR "%s: Error !!\n", modname); pr_err("Error !!\n");
return -1; return -1;
} }
...@@ -391,23 +389,20 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) ...@@ -391,23 +389,20 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
u16 cksum; u16 cksum;
/* Announce */ /* Announce */
printk(KERN_INFO "%s: firmware signature=\"%s\"\n", modname, pr_info("firmware signature=\"%s\"\n", cfm->signature);
cfm->signature);
/* Verify firmware signature */ /* Verify firmware signature */
if (strcmp(cfm->signature, CFM_SIGNATURE)) { if (strcmp(cfm->signature, CFM_SIGNATURE)) {
printk(KERN_ERR "%s:load_cyc2x: not Cyclom-2X firmware!\n", pr_err("load_cyc2x: not Cyclom-2X firmware!\n");
modname);
return -EINVAL; return -EINVAL;
} }
printk(KERN_INFO "%s: firmware version=%u\n", modname, cfm->version); pr_info("firmware version=%u\n", cfm->version);
/* Verify firmware module format version */ /* Verify firmware module format version */
if (cfm->version != CFM_VERSION) { if (cfm->version != CFM_VERSION) {
printk(KERN_ERR "%s:%s: firmware format %u rejected! " pr_err("%s: firmware format %u rejected! Expecting %u.\n",
"Expecting %u.\n", __func__, cfm->version, CFM_VERSION);
modname, __func__, cfm->version, CFM_VERSION);
return -EINVAL; return -EINVAL;
} }
...@@ -419,23 +414,22 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) ...@@ -419,23 +414,22 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) || if (((len - sizeof(struct cycx_firmware) - 1) != cfm->info.codesize) ||
*/ */
if (cksum != cfm->checksum) { if (cksum != cfm->checksum) {
printk(KERN_ERR "%s:%s: firmware corrupted!\n", pr_err("%s: firmware corrupted!\n", __func__);
modname, __func__); pr_err(" cdsize = 0x%x (expected 0x%lx)\n",
printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n", len - (int)sizeof(struct cycx_firmware) - 1,
len - (int)sizeof(struct cycx_firmware) - 1, cfm->info.codesize);
cfm->info.codesize); pr_err(" chksum = 0x%x (expected 0x%x)\n",
printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n", cksum, cfm->checksum);
cksum, cfm->checksum);
return -EINVAL; return -EINVAL;
} }
/* If everything is ok, set reset, data and code pointers */ /* If everything is ok, set reset, data and code pointers */
img_hdr = (struct cycx_fw_header *)&cfm->image; img_hdr = (struct cycx_fw_header *)&cfm->image;
#ifdef FIRMWARE_DEBUG #ifdef FIRMWARE_DEBUG
printk(KERN_INFO "%s:%s: image sizes\n", __func__, modname); pr_info("%s: image sizes\n", __func__);
printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size); pr_info(" reset=%lu\n", img_hdr->reset_size);
printk(KERN_INFO " data=%lu\n", img_hdr->data_size); pr_info(" data=%lu\n", img_hdr->data_size);
printk(KERN_INFO " code=%lu\n", img_hdr->code_size); pr_info(" code=%lu\n", img_hdr->code_size);
#endif #endif
reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header); reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header);
data_image = reset_image + img_hdr->reset_size; 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,15 +437,14 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
/*---- Start load ----*/ /*---- Start load ----*/
/* Announce */ /* Announce */
printk(KERN_INFO "%s: loading firmware %s (ID=%u)...\n", modname, pr_info("loading firmware %s (ID=%u)...\n",
cfm->descr[0] ? cfm->descr : "unknown firmware", cfm->descr[0] ? cfm->descr : "unknown firmware",
cfm->info.codeid); cfm->info.codeid);
for (i = 0 ; i < 5 ; i++) { for (i = 0 ; i < 5 ; i++) {
/* Reset Cyclom hardware */ /* Reset Cyclom hardware */
if (!reset_cyc2x(hw->dpmbase)) { if (!reset_cyc2x(hw->dpmbase)) {
printk(KERN_ERR "%s: dpm problem or board not found\n", pr_err("dpm problem or board not found\n");
modname);
return -EINVAL; return -EINVAL;
} }
...@@ -468,19 +461,19 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) ...@@ -468,19 +461,19 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
msleep_interruptible(1 * 1000); msleep_interruptible(1 * 1000);
} }
printk(KERN_ERR "%s: reset not started.\n", modname); pr_err("reset not started\n");
return -EINVAL; return -EINVAL;
reset_loaded: reset_loaded:
/* Load data.bin */ /* Load data.bin */
if (cycx_data_boot(hw->dpmbase, data_image, img_hdr->data_size)) { if (cycx_data_boot(hw->dpmbase, data_image, img_hdr->data_size)) {
printk(KERN_ERR "%s: cannot load data file.\n", modname); pr_err("cannot load data file\n");
return -EINVAL; return -EINVAL;
} }
/* Load code.bin */ /* Load code.bin */
if (cycx_code_boot(hw->dpmbase, code_image, img_hdr->code_size)) { if (cycx_code_boot(hw->dpmbase, code_image, img_hdr->code_size)) {
printk(KERN_ERR "%s: cannot load code file.\n", modname); pr_err("cannot load code file\n");
return -EINVAL; return -EINVAL;
} }
...@@ -493,7 +486,7 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len) ...@@ -493,7 +486,7 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
/* Arthur Ganzert's tip: wait a while after the firmware loading... /* Arthur Ganzert's tip: wait a while after the firmware loading...
seg abr 26 17:17:12 EST 1999 - acme */ seg abr 26 17:17:12 EST 1999 - acme */
msleep_interruptible(7 * 1000); msleep_interruptible(7 * 1000);
printk(KERN_INFO "%s: firmware loaded!\n", modname); pr_info("firmware loaded!\n");
/* enable interrupts */ /* enable interrupts */
cycx_inten(hw); cycx_inten(hw);
......
...@@ -40,6 +40,8 @@ ...@@ -40,6 +40,8 @@
* 1998/08/08 acme Initial version. * 1998/08/08 acme Initial version.
*/ */
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/stddef.h> /* offsetof(), etc. */ #include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */ #include <linux/errno.h> /* return codes */
#include <linux/string.h> /* inline memset(), etc. */ #include <linux/string.h> /* inline memset(), etc. */
...@@ -107,7 +109,7 @@ static int __init cycx_init(void) ...@@ -107,7 +109,7 @@ static int __init cycx_init(void)
{ {
int cnt, err = -ENOMEM; int cnt, err = -ENOMEM;
printk(KERN_INFO "%s v%u.%u %s\n", pr_info("%s v%u.%u %s\n",
cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE, cycx_fullname, CYCX_DRV_VERSION, CYCX_DRV_RELEASE,
cycx_copyright); cycx_copyright);
...@@ -133,9 +135,8 @@ static int __init cycx_init(void) ...@@ -133,9 +135,8 @@ static int __init cycx_init(void)
err = register_wan_device(wandev); err = register_wan_device(wandev);
if (err) { if (err) {
printk(KERN_ERR "%s: %s registration failed with " pr_err("%s registration failed with error %d!\n",
"error %d!\n", card->devname, err);
cycx_drvname, card->devname, err);
break; break;
} }
} }
...@@ -198,14 +199,13 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) ...@@ -198,14 +199,13 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)
rc = -EINVAL; rc = -EINVAL;
if (!conf->data_size || !conf->data) { if (!conf->data_size || !conf->data) {
printk(KERN_ERR "%s: firmware not found in configuration " pr_err("%s: firmware not found in configuration data!\n",
"data!\n", wandev->name); wandev->name);
goto out; goto out;
} }
if (conf->irq <= 0) { if (conf->irq <= 0) {
printk(KERN_ERR "%s: can't configure without IRQ!\n", pr_err("%s: can't configure without IRQ!\n", wandev->name);
wandev->name);
goto out; goto out;
} }
...@@ -213,8 +213,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) ...@@ -213,8 +213,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)
irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */ irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */
if (request_irq(irq, cycx_isr, 0, wandev->name, card)) { if (request_irq(irq, cycx_isr, 0, wandev->name, card)) {
printk(KERN_ERR "%s: can't reserve IRQ %d!\n", pr_err("%s: can't reserve IRQ %d!\n", wandev->name, irq);
wandev->name, irq);
goto out; goto out;
} }
...@@ -246,8 +245,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf) ...@@ -246,8 +245,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)
break; break;
#endif #endif
default: default:
printk(KERN_ERR "%s: this firmware is not supported!\n", pr_err("%s: this firmware is not supported!\n", wandev->name);
wandev->name);
rc = -EINVAL; rc = -EINVAL;
} }
...@@ -288,8 +286,7 @@ static int cycx_wan_shutdown(struct wan_device *wandev) ...@@ -288,8 +286,7 @@ static int cycx_wan_shutdown(struct wan_device *wandev)
card = wandev->private; card = wandev->private;
wandev->state = WAN_UNCONFIGURED; wandev->state = WAN_UNCONFIGURED;
cycx_down(&card->hw); cycx_down(&card->hw);
printk(KERN_INFO "%s: irq %d being freed!\n", wandev->name, pr_info("%s: irq %d being freed!\n", wandev->name, wandev->irq);
wandev->irq);
free_irq(wandev->irq, card); free_irq(wandev->irq, card);
out: return ret; out: return ret;
} }
...@@ -308,8 +305,8 @@ static irqreturn_t cycx_isr(int irq, void *dev_id) ...@@ -308,8 +305,8 @@ static irqreturn_t cycx_isr(int irq, void *dev_id)
goto out; goto out;
if (card->in_isr) { if (card->in_isr) {
printk(KERN_WARNING "%s: interrupt re-entrancy on IRQ %d!\n", pr_warn("%s: interrupt re-entrancy on IRQ %d!\n",
card->devname, card->wandev.irq); card->devname, card->wandev.irq);
goto out; goto out;
} }
...@@ -337,7 +334,7 @@ void cycx_set_state(struct cycx_device *card, int state) ...@@ -337,7 +334,7 @@ void cycx_set_state(struct cycx_device *card, int state)
string_state = "disconnected!"; string_state = "disconnected!";
break; break;
} }
printk(KERN_INFO "%s: link %s\n", card->devname, string_state); pr_info("%s: link %s\n", card->devname, string_state);
card->wandev.state = state; card->wandev.state = state;
} }
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment