Skip to content

Commit

Permalink
can: replace the dev_dbg/info/err/... with the new netdev_xxx macros
Browse files Browse the repository at this point in the history
Cc: uclinux-dist-devel@blackfin.uclinux.org
Cc: Anant Gole <anantgole@ti.com>
Cc: Chris Elston <celston@katalix.com>
Cc: Sebastian Haas <haas@ems-wuensche.com>
Cc: Matthias Fuchs <matthias.fuchs@esd.eu>
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Sebastian Haas <dev@sebastianhaas.info>
Acked-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Wolfgang Grandegger authored and Marc Kleine-Budde committed Feb 3, 2012
1 parent 79d0d8a commit aabdfd6
Show file tree
Hide file tree
Showing 9 changed files with 103 additions and 128 deletions.
21 changes: 8 additions & 13 deletions drivers/net/can/bfin_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ static int bfin_can_set_bittiming(struct net_device *dev)
bfin_write(&reg->clock, clk);
bfin_write(&reg->timing, timing);

dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n",
clk, timing);
netdev_info(dev, "setting CLOCK=0x%04x TIMING=0x%04x\n", clk, timing);

return 0;
}
Expand All @@ -108,8 +107,7 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
while (!(bfin_read(&reg->control) & CCA)) {
udelay(10);
if (--timeout == 0) {
dev_err(dev->dev.parent,
"fail to enter configuration mode\n");
netdev_err(dev, "fail to enter configuration mode\n");
BUG();
}
}
Expand Down Expand Up @@ -165,8 +163,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
while (bfin_read(&reg->status) & CCA) {
udelay(10);
if (--timeout == 0) {
dev_err(dev->dev.parent,
"fail to leave configuration mode\n");
netdev_err(dev, "fail to leave configuration mode\n");
BUG();
}
}
Expand Down Expand Up @@ -345,29 +342,28 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)

if (isrc & RMLIS) {
/* data overrun interrupt */
dev_dbg(dev->dev.parent, "data overrun interrupt\n");
netdev_dbg(dev, "data overrun interrupt\n");
cf->can_id |= CAN_ERR_CRTL;
cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
stats->rx_over_errors++;
stats->rx_errors++;
}

if (isrc & BOIS) {
dev_dbg(dev->dev.parent, "bus-off mode interrupt\n");
netdev_dbg(dev, "bus-off mode interrupt\n");
state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF;
can_bus_off(dev);
}

if (isrc & EPIS) {
/* error passive interrupt */
dev_dbg(dev->dev.parent, "error passive interrupt\n");
netdev_dbg(dev, "error passive interrupt\n");
state = CAN_STATE_ERROR_PASSIVE;
}

if ((isrc & EWTIS) || (isrc & EWRIS)) {
dev_dbg(dev->dev.parent,
"Error Warning Transmit/Receive Interrupt\n");
netdev_dbg(dev, "Error Warning Transmit/Receive Interrupt\n");
state = CAN_STATE_ERROR_WARNING;
}

Expand Down Expand Up @@ -651,8 +647,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
while (!(bfin_read(&reg->intr) & SMACK)) {
udelay(10);
if (--timeout == 0) {
dev_err(dev->dev.parent,
"fail to enter sleep mode\n");
netdev_err(dev, "fail to enter sleep mode\n");
BUG();
}
}
Expand Down
23 changes: 11 additions & 12 deletions drivers/net/can/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
/* Error in one-tenth of a percent */
error = (best_error * 1000) / bt->bitrate;
if (error > CAN_CALC_MAX_ERROR) {
dev_err(dev->dev.parent,
"bitrate error %ld.%ld%% too high\n",
error / 10, error % 10);
netdev_err(dev,
"bitrate error %ld.%ld%% too high\n",
error / 10, error % 10);
return -EDOM;
} else {
dev_warn(dev->dev.parent, "bitrate error %ld.%ld%%\n",
error / 10, error % 10);
netdev_warn(dev, "bitrate error %ld.%ld%%\n",
error / 10, error % 10);
}
}

Expand Down Expand Up @@ -172,7 +172,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
#else /* !CONFIG_CAN_CALC_BITTIMING */
static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
{
dev_err(dev->dev.parent, "bit-timing calculation not available\n");
netdev_err(dev, "bit-timing calculation not available\n");
return -EINVAL;
}
#endif /* CONFIG_CAN_CALC_BITTIMING */
Expand Down Expand Up @@ -313,8 +313,7 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
priv->echo_skb[idx] = skb;
} else {
/* locking problem with netif_stop_queue() ?? */
dev_err(dev->dev.parent, "%s: BUG! echo_skb is occupied!\n",
__func__);
netdev_err(dev, "%s: BUG! echo_skb is occupied!\n", __func__);
kfree_skb(skb);
}
}
Expand Down Expand Up @@ -400,15 +399,15 @@ void can_restart(unsigned long data)
stats->rx_bytes += cf->can_dlc;

restart:
dev_dbg(dev->dev.parent, "restarted\n");
netdev_dbg(dev, "restarted\n");
priv->can_stats.restarts++;

/* Now restart the device */
err = priv->do_set_mode(dev, CAN_MODE_START);

netif_carrier_on(dev);
if (err)
dev_err(dev->dev.parent, "Error %d during restart", err);
netdev_err(dev, "Error %d during restart", err);
}

int can_restart_now(struct net_device *dev)
Expand Down Expand Up @@ -441,7 +440,7 @@ void can_bus_off(struct net_device *dev)
{
struct can_priv *priv = netdev_priv(dev);

dev_dbg(dev->dev.parent, "bus-off\n");
netdev_dbg(dev, "bus-off\n");

netif_carrier_off(dev);
priv->can_stats.bus_off++;
Expand Down Expand Up @@ -553,7 +552,7 @@ int open_candev(struct net_device *dev)
struct can_priv *priv = netdev_priv(dev);

if (!priv->bittiming.tq && !priv->bittiming.bitrate) {
dev_err(dev->dev.parent, "bit-timing not yet defined\n");
netdev_err(dev, "bit-timing not yet defined\n");
return -EINVAL;
}

Expand Down
44 changes: 21 additions & 23 deletions drivers/net/can/flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -315,34 +315,34 @@ static void do_bus_err(struct net_device *dev,
cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;

if (reg_esr & FLEXCAN_ESR_BIT1_ERR) {
dev_dbg(dev->dev.parent, "BIT1_ERR irq\n");
netdev_dbg(dev, "BIT1_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT1;
tx_errors = 1;
}
if (reg_esr & FLEXCAN_ESR_BIT0_ERR) {
dev_dbg(dev->dev.parent, "BIT0_ERR irq\n");
netdev_dbg(dev, "BIT0_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT0;
tx_errors = 1;
}
if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
dev_dbg(dev->dev.parent, "ACK_ERR irq\n");
netdev_dbg(dev, "ACK_ERR irq\n");
cf->can_id |= CAN_ERR_ACK;
cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
tx_errors = 1;
}
if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
dev_dbg(dev->dev.parent, "CRC_ERR irq\n");
netdev_dbg(dev, "CRC_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_BIT;
cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
rx_errors = 1;
}
if (reg_esr & FLEXCAN_ESR_FRM_ERR) {
dev_dbg(dev->dev.parent, "FRM_ERR irq\n");
netdev_dbg(dev, "FRM_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_FORM;
rx_errors = 1;
}
if (reg_esr & FLEXCAN_ESR_STF_ERR) {
dev_dbg(dev->dev.parent, "STF_ERR irq\n");
netdev_dbg(dev, "STF_ERR irq\n");
cf->data[2] |= CAN_ERR_PROT_STUFF;
rx_errors = 1;
}
Expand Down Expand Up @@ -389,7 +389,7 @@ static void do_state(struct net_device *dev,
*/
if (new_state >= CAN_STATE_ERROR_WARNING &&
new_state <= CAN_STATE_BUS_OFF) {
dev_dbg(dev->dev.parent, "Error Warning IRQ\n");
netdev_dbg(dev, "Error Warning IRQ\n");
priv->can.can_stats.error_warning++;

cf->can_id |= CAN_ERR_CRTL;
Expand All @@ -405,7 +405,7 @@ static void do_state(struct net_device *dev,
*/
if (new_state >= CAN_STATE_ERROR_PASSIVE &&
new_state <= CAN_STATE_BUS_OFF) {
dev_dbg(dev->dev.parent, "Error Passive IRQ\n");
netdev_dbg(dev, "Error Passive IRQ\n");
priv->can.can_stats.error_passive++;

cf->can_id |= CAN_ERR_CRTL;
Expand All @@ -415,8 +415,8 @@ static void do_state(struct net_device *dev,
}
break;
case CAN_STATE_BUS_OFF:
dev_err(dev->dev.parent,
"BUG! hardware recovered automatically from BUS_OFF\n");
netdev_err(dev, "BUG! "
"hardware recovered automatically from BUS_OFF\n");
break;
default:
break;
Expand All @@ -425,7 +425,7 @@ static void do_state(struct net_device *dev,
/* process state changes depending on the new state */
switch (new_state) {
case CAN_STATE_ERROR_ACTIVE:
dev_dbg(dev->dev.parent, "Error Active\n");
netdev_dbg(dev, "Error Active\n");
cf->can_id |= CAN_ERR_PROT;
cf->data[2] = CAN_ERR_PROT_ACTIVE;
break;
Expand Down Expand Up @@ -644,12 +644,12 @@ static void flexcan_set_bittiming(struct net_device *dev)
if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
reg |= FLEXCAN_CTRL_SMP;

dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg);
netdev_info(dev, "writing ctrl=0x%08x\n", reg);
flexcan_write(reg, &regs->ctrl);

/* print chip status */
dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
}

/*
Expand All @@ -675,9 +675,8 @@ static int flexcan_chip_start(struct net_device *dev)

reg_mcr = flexcan_read(&regs->mcr);
if (reg_mcr & FLEXCAN_MCR_SOFTRST) {
dev_err(dev->dev.parent,
"Failed to softreset can module (mcr=0x%08x)\n",
reg_mcr);
netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n",
reg_mcr);
err = -ENODEV;
goto out;
}
Expand All @@ -700,7 +699,7 @@ static int flexcan_chip_start(struct net_device *dev)
reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS;
dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr);
netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
flexcan_write(reg_mcr, &regs->mcr);

/*
Expand All @@ -726,7 +725,7 @@ static int flexcan_chip_start(struct net_device *dev)

/* save for later use */
priv->reg_ctrl_default = reg_ctrl;
dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
flexcan_write(reg_ctrl, &regs->ctrl);

for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
Expand Down Expand Up @@ -758,8 +757,8 @@ static int flexcan_chip_start(struct net_device *dev)
flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);

/* print chip status */
dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n",
__func__, flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__,
flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));

return 0;

Expand Down Expand Up @@ -897,8 +896,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
*/
reg = flexcan_read(&regs->mcr);
if (!(reg & FLEXCAN_MCR_FEN)) {
dev_err(dev->dev.parent,
"Could not enable RX FIFO, unsupported core\n");
netdev_err(dev, "Could not enable RX FIFO, unsupported core\n");
err = -ENODEV;
goto out;
}
Expand Down
3 changes: 1 addition & 2 deletions drivers/net/can/mcp251x.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
frame->data[1] = data1;
netif_rx_ni(skb);
} else {
dev_err(&net->dev,
"cannot allocate error skb\n");
netdev_err(net, "cannot allocate error skb\n");
}
}

Expand Down
17 changes: 8 additions & 9 deletions drivers/net/can/mscan/mscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
* any, at once.
*/
if (i >= MSCAN_SET_MODE_RETRIES)
dev_dbg(dev->dev.parent,
"device failed to enter sleep mode. "
"We proceed anyhow.\n");
netdev_dbg(dev,
"device failed to enter sleep mode. "
"We proceed anyhow.\n");
else
priv->can.state = CAN_STATE_SLEEPING;
}
Expand Down Expand Up @@ -213,7 +213,7 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
switch (hweight8(i)) {
case 0:
netif_stop_queue(dev);
dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n");
netdev_err(dev, "Tx Ring full when queue awake!\n");
return NETDEV_TX_BUSY;
case 1:
/*
Expand Down Expand Up @@ -352,7 +352,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
struct net_device_stats *stats = &dev->stats;
enum can_state old_state;

dev_dbg(dev->dev.parent, "error interrupt (canrflg=%#x)\n", canrflg);
netdev_dbg(dev, "error interrupt (canrflg=%#x)\n", canrflg);
frame->can_id = CAN_ERR_FLAG;

if (canrflg & MSCAN_OVRIF) {
Expand Down Expand Up @@ -427,7 +427,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)
skb = alloc_can_skb(dev, &frame);
if (!skb) {
if (printk_ratelimit())
dev_notice(dev->dev.parent, "packet dropped\n");
netdev_notice(dev, "packet dropped\n");
stats->rx_dropped++;
out_8(&regs->canrflg, canrflg);
continue;
Expand Down Expand Up @@ -551,8 +551,7 @@ static int mscan_do_set_bittiming(struct net_device *dev)
BTR1_SET_TSEG2(bt->phase_seg2) |
BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES));

dev_info(dev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n",
btr0, btr1);
netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);

out_8(&regs->canbtr0, btr0);
out_8(&regs->canbtr1, btr1);
Expand Down Expand Up @@ -587,7 +586,7 @@ static int mscan_open(struct net_device *dev)

ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
if (ret < 0) {
dev_err(dev->dev.parent, "failed to attach interrupt\n");
netdev_err(dev, "failed to attach interrupt\n");
goto exit_napi_disable;
}

Expand Down
Loading

0 comments on commit aabdfd6

Please sign in to comment.