Skip to content

Commit

Permalink
cyclom: Update to current logging forms
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Joe Perches authored and David S. Miller committed Jun 27, 2011
1 parent 9cbe50d commit d6810e1
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 156 deletions.
81 changes: 37 additions & 44 deletions drivers/net/wan/cycx_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
* Aug 8, 1998 acme Initial version.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/init.h> /* __init */
#include <linux/module.h>
#include <linux/kernel.h> /* printk(), and other useful stuff */
Expand Down Expand Up @@ -81,10 +83,9 @@ static u16 checksum(u8 *buf, u32 len);
/* Global Data */

/* private data */
static const char modname[] = "cycx_drv";
static const char fullname[] = "Cyclom 2X Support Module";
static const char copyright[] = "(c) 1998-2003 Arnaldo Carvalho de Melo "
"<acme@conectiva.com.br>";
static const char copyright[] =
"(c) 1998-2003 Arnaldo Carvalho de Melo <acme@conectiva.com.br>";

/* Hardware configuration options.
* These are arrays of configuration options used by verification routines.
Expand All @@ -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)
{
printk(KERN_INFO "%s v%u.%u %s\n", fullname, MOD_VERSION, MOD_RELEASE,
copyright);
pr_info("%s v%u.%u %s\n",
fullname, MOD_VERSION, MOD_RELEASE, copyright);

return 0;
}
Expand Down Expand Up @@ -139,32 +140,29 @@ int cycx_setup(struct cycx_hw *hw, void *cfm, u32 len, unsigned long dpmbase)

/* Verify IRQ configuration options */
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;
}

/* Setup adapter dual-port memory window and test memory */
if (!dpmbase) {
printk(KERN_ERR "%s: you must specify the dpm address!\n",
modname);
pr_err("you must specify the dpm address!\n");
return -EINVAL;
} else if (!get_option_index(cyc2x_dpmbase_options, dpmbase)) {
printk(KERN_ERR "%s: memory address 0x%lX is invalid!\n",
modname, dpmbase);
pr_err("memory address 0x%lX is invalid!\n", dpmbase);
return -EINVAL;
}

hw->dpmbase = ioremap(dpmbase, CYCX_WINDOWSIZE);
hw->dpmsize = CYCX_WINDOWSIZE;

if (!detect_cyc2x(hw->dpmbase)) {
printk(KERN_ERR "%s: adapter Cyclom 2X not found at "
"address 0x%lX!\n", modname, dpmbase);
pr_err("adapter Cyclom 2X not found at address 0x%lX!\n",
dpmbase);
return -EINVAL;
}

printk(KERN_INFO "%s: found Cyclom 2X card at address 0x%lX.\n",
modname, dpmbase);
pr_info("found Cyclom 2X card at address 0x%lX\n", dpmbase);

/* Load firmware. If loader fails then shut down adapter */
err = load_cyc2x(hw, cfm, len);
Expand Down Expand Up @@ -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)
if (buffer_load(addr, code + i,
min_t(u32, CFM_LOAD_BUFSZ, (len - i))) < 0) {
printk(KERN_ERR "%s: Error !!\n", modname);
pr_err("Error !!\n");
return -1;
}

Expand Down Expand Up @@ -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)
if (buffer_load(addr, code + i,
min_t(u32, CFM_LOAD_BUFSZ, (len - i)))) {
printk(KERN_ERR "%s: Error !!\n", modname);
pr_err("Error !!\n");
return -1;
}

Expand All @@ -391,23 +389,20 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
u16 cksum;

/* Announce */
printk(KERN_INFO "%s: firmware signature=\"%s\"\n", modname,
cfm->signature);
pr_info("firmware signature=\"%s\"\n", cfm->signature);

/* Verify firmware signature */
if (strcmp(cfm->signature, CFM_SIGNATURE)) {
printk(KERN_ERR "%s:load_cyc2x: not Cyclom-2X firmware!\n",
modname);
pr_err("load_cyc2x: not Cyclom-2X firmware!\n");
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 */
if (cfm->version != CFM_VERSION) {
printk(KERN_ERR "%s:%s: firmware format %u rejected! "
"Expecting %u.\n",
modname, __func__, cfm->version, CFM_VERSION);
pr_err("%s: firmware format %u rejected! Expecting %u.\n",
__func__, cfm->version, CFM_VERSION);
return -EINVAL;
}

Expand All @@ -419,39 +414,37 @@ 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 (cksum != cfm->checksum) {
printk(KERN_ERR "%s:%s: firmware corrupted!\n",
modname, __func__);
printk(KERN_ERR " cdsize = 0x%x (expected 0x%lx)\n",
len - (int)sizeof(struct cycx_firmware) - 1,
cfm->info.codesize);
printk(KERN_ERR " chksum = 0x%x (expected 0x%x)\n",
cksum, cfm->checksum);
pr_err("%s: firmware corrupted!\n", __func__);
pr_err(" cdsize = 0x%x (expected 0x%lx)\n",
len - (int)sizeof(struct cycx_firmware) - 1,
cfm->info.codesize);
pr_err(" chksum = 0x%x (expected 0x%x)\n",
cksum, cfm->checksum);
return -EINVAL;
}

/* If everything is ok, set reset, data and code pointers */
img_hdr = (struct cycx_fw_header *)&cfm->image;
#ifdef FIRMWARE_DEBUG
printk(KERN_INFO "%s:%s: image sizes\n", __func__, modname);
printk(KERN_INFO " reset=%lu\n", img_hdr->reset_size);
printk(KERN_INFO " data=%lu\n", img_hdr->data_size);
printk(KERN_INFO " code=%lu\n", img_hdr->code_size);
pr_info("%s: image sizes\n", __func__);
pr_info(" reset=%lu\n", img_hdr->reset_size);
pr_info(" data=%lu\n", img_hdr->data_size);
pr_info(" code=%lu\n", img_hdr->code_size);
#endif
reset_image = ((u8 *)img_hdr) + sizeof(struct cycx_fw_header);
data_image = reset_image + img_hdr->reset_size;
code_image = data_image + img_hdr->data_size;

/*---- Start load ----*/
/* Announce */
printk(KERN_INFO "%s: loading firmware %s (ID=%u)...\n", modname,
cfm->descr[0] ? cfm->descr : "unknown firmware",
cfm->info.codeid);
pr_info("loading firmware %s (ID=%u)...\n",
cfm->descr[0] ? cfm->descr : "unknown firmware",
cfm->info.codeid);

for (i = 0 ; i < 5 ; i++) {
/* Reset Cyclom hardware */
if (!reset_cyc2x(hw->dpmbase)) {
printk(KERN_ERR "%s: dpm problem or board not found\n",
modname);
pr_err("dpm problem or board not found\n");
return -EINVAL;
}

Expand All @@ -468,19 +461,19 @@ static int load_cyc2x(struct cycx_hw *hw, struct cycx_firmware *cfm, u32 len)
msleep_interruptible(1 * 1000);
}

printk(KERN_ERR "%s: reset not started.\n", modname);
pr_err("reset not started\n");
return -EINVAL;

reset_loaded:
/* Load data.bin */
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;
}

/* Load code.bin */
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;
}

Expand All @@ -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...
seg abr 26 17:17:12 EST 1999 - acme */
msleep_interruptible(7 * 1000);
printk(KERN_INFO "%s: firmware loaded!\n", modname);
pr_info("firmware loaded!\n");

/* enable interrupts */
cycx_inten(hw);
Expand Down
31 changes: 14 additions & 17 deletions drivers/net/wan/cycx_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
* 1998/08/08 acme Initial version.
*/

#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt

#include <linux/stddef.h> /* offsetof(), etc. */
#include <linux/errno.h> /* return codes */
#include <linux/string.h> /* inline memset(), etc. */
Expand Down Expand Up @@ -107,7 +109,7 @@ static int __init cycx_init(void)
{
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_copyright);

Expand All @@ -133,9 +135,8 @@ static int __init cycx_init(void)
err = register_wan_device(wandev);

if (err) {
printk(KERN_ERR "%s: %s registration failed with "
"error %d!\n",
cycx_drvname, card->devname, err);
pr_err("%s registration failed with error %d!\n",
card->devname, err);
break;
}
}
Expand Down Expand Up @@ -198,23 +199,21 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)

rc = -EINVAL;
if (!conf->data_size || !conf->data) {
printk(KERN_ERR "%s: firmware not found in configuration "
"data!\n", wandev->name);
pr_err("%s: firmware not found in configuration data!\n",
wandev->name);
goto out;
}

if (conf->irq <= 0) {
printk(KERN_ERR "%s: can't configure without IRQ!\n",
wandev->name);
pr_err("%s: can't configure without IRQ!\n", wandev->name);
goto out;
}

/* Allocate IRQ */
irq = conf->irq == 2 ? 9 : conf->irq; /* IRQ2 -> IRQ9 */

if (request_irq(irq, cycx_isr, 0, wandev->name, card)) {
printk(KERN_ERR "%s: can't reserve IRQ %d!\n",
wandev->name, irq);
pr_err("%s: can't reserve IRQ %d!\n", wandev->name, irq);
goto out;
}

Expand Down Expand Up @@ -246,8 +245,7 @@ static int cycx_wan_setup(struct wan_device *wandev, wandev_conf_t *conf)
break;
#endif
default:
printk(KERN_ERR "%s: this firmware is not supported!\n",
wandev->name);
pr_err("%s: this firmware is not supported!\n", wandev->name);
rc = -EINVAL;
}

Expand Down Expand Up @@ -288,8 +286,7 @@ static int cycx_wan_shutdown(struct wan_device *wandev)
card = wandev->private;
wandev->state = WAN_UNCONFIGURED;
cycx_down(&card->hw);
printk(KERN_INFO "%s: irq %d being freed!\n", wandev->name,
wandev->irq);
pr_info("%s: irq %d being freed!\n", wandev->name, wandev->irq);
free_irq(wandev->irq, card);
out: return ret;
}
Expand All @@ -308,8 +305,8 @@ static irqreturn_t cycx_isr(int irq, void *dev_id)
goto out;

if (card->in_isr) {
printk(KERN_WARNING "%s: interrupt re-entrancy on IRQ %d!\n",
card->devname, card->wandev.irq);
pr_warn("%s: interrupt re-entrancy on IRQ %d!\n",
card->devname, card->wandev.irq);
goto out;
}

Expand Down Expand Up @@ -337,7 +334,7 @@ void cycx_set_state(struct cycx_device *card, int state)
string_state = "disconnected!";
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;
}

Expand Down
Loading

0 comments on commit d6810e1

Please sign in to comment.