aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/can/Kconfig6
-rw-r--r--drivers/net/can/bfin_can.c36
-rw-r--r--drivers/net/can/dev.c33
-rw-r--r--drivers/net/can/flexcan.c61
-rw-r--r--drivers/net/can/mcp251x.c3
-rw-r--r--drivers/net/can/mscan/mscan.c33
-rw-r--r--drivers/net/can/pch_can.c2
-rw-r--r--drivers/net/can/sja1000/Kconfig1
-rw-r--r--drivers/net/can/sja1000/plx_pci.c22
-rw-r--r--drivers/net/can/sja1000/sja1000.c19
-rw-r--r--drivers/net/can/ti_hecc.c32
-rw-r--r--drivers/net/can/usb/ems_usb.c63
-rw-r--r--drivers/net/can/usb/esd_usb2.c27
-rw-r--r--include/linux/can/dev.h2
14 files changed, 192 insertions, 148 deletions
diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig
index ab45758c49a4..bb709fd66993 100644
--- a/drivers/net/can/Kconfig
+++ b/drivers/net/can/Kconfig
@@ -103,11 +103,11 @@ config CAN_FLEXCAN
103 Say Y here if you want to support for Freescale FlexCAN. 103 Say Y here if you want to support for Freescale FlexCAN.
104 104
105config PCH_CAN 105config PCH_CAN
106 tristate "PCH CAN" 106 tristate "Intel EG20T PCH CAN controller"
107 depends on CAN_DEV && PCI 107 depends on CAN_DEV && PCI
108 ---help--- 108 ---help---
109 This driver is for PCH CAN of Topcliff which is an IOH for x86 109 This driver is for PCH CAN of Topcliff (Intel EG20T PCH) which
110 embedded processor. 110 is an IOH for x86 embedded processor (Intel Atom E6xx series).
111 This driver can access CAN bus. 111 This driver can access CAN bus.
112 112
113source "drivers/net/can/mscan/Kconfig" 113source "drivers/net/can/mscan/Kconfig"
diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index 349e0fabb63a..3f88473423e9 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -82,8 +82,7 @@ static int bfin_can_set_bittiming(struct net_device *dev)
82 bfin_write(&reg->clock, clk); 82 bfin_write(&reg->clock, clk);
83 bfin_write(&reg->timing, timing); 83 bfin_write(&reg->timing, timing);
84 84
85 dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n", 85 netdev_info(dev, "setting CLOCK=0x%04x TIMING=0x%04x\n", clk, timing);
86 clk, timing);
87 86
88 return 0; 87 return 0;
89} 88}
@@ -108,8 +107,7 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
108 while (!(bfin_read(&reg->control) & CCA)) { 107 while (!(bfin_read(&reg->control) & CCA)) {
109 udelay(10); 108 udelay(10);
110 if (--timeout == 0) { 109 if (--timeout == 0) {
111 dev_err(dev->dev.parent, 110 netdev_err(dev, "fail to enter configuration mode\n");
112 "fail to enter configuration mode\n");
113 BUG(); 111 BUG();
114 } 112 }
115 } 113 }
@@ -165,8 +163,7 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
165 while (bfin_read(&reg->status) & CCA) { 163 while (bfin_read(&reg->status) & CCA) {
166 udelay(10); 164 udelay(10);
167 if (--timeout == 0) { 165 if (--timeout == 0) {
168 dev_err(dev->dev.parent, 166 netdev_err(dev, "fail to leave configuration mode\n");
169 "fail to leave configuration mode\n");
170 BUG(); 167 BUG();
171 } 168 }
172 } 169 }
@@ -224,6 +221,20 @@ static int bfin_can_set_mode(struct net_device *dev, enum can_mode mode)
224 return 0; 221 return 0;
225} 222}
226 223
224static int bfin_can_get_berr_counter(const struct net_device *dev,
225 struct can_berr_counter *bec)
226{
227 struct bfin_can_priv *priv = netdev_priv(dev);
228 struct bfin_can_regs __iomem *reg = priv->membase;
229
230 u16 cec = bfin_read(&reg->cec);
231
232 bec->txerr = cec >> 8;
233 bec->rxerr = cec;
234
235 return 0;
236}
237
227static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev) 238static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
228{ 239{
229 struct bfin_can_priv *priv = netdev_priv(dev); 240 struct bfin_can_priv *priv = netdev_priv(dev);
@@ -331,7 +342,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
331 342
332 if (isrc & RMLIS) { 343 if (isrc & RMLIS) {
333 /* data overrun interrupt */ 344 /* data overrun interrupt */
334 dev_dbg(dev->dev.parent, "data overrun interrupt\n"); 345 netdev_dbg(dev, "data overrun interrupt\n");
335 cf->can_id |= CAN_ERR_CRTL; 346 cf->can_id |= CAN_ERR_CRTL;
336 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 347 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
337 stats->rx_over_errors++; 348 stats->rx_over_errors++;
@@ -339,7 +350,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
339 } 350 }
340 351
341 if (isrc & BOIS) { 352 if (isrc & BOIS) {
342 dev_dbg(dev->dev.parent, "bus-off mode interrupt\n"); 353 netdev_dbg(dev, "bus-off mode interrupt\n");
343 state = CAN_STATE_BUS_OFF; 354 state = CAN_STATE_BUS_OFF;
344 cf->can_id |= CAN_ERR_BUSOFF; 355 cf->can_id |= CAN_ERR_BUSOFF;
345 can_bus_off(dev); 356 can_bus_off(dev);
@@ -347,13 +358,12 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
347 358
348 if (isrc & EPIS) { 359 if (isrc & EPIS) {
349 /* error passive interrupt */ 360 /* error passive interrupt */
350 dev_dbg(dev->dev.parent, "error passive interrupt\n"); 361 netdev_dbg(dev, "error passive interrupt\n");
351 state = CAN_STATE_ERROR_PASSIVE; 362 state = CAN_STATE_ERROR_PASSIVE;
352 } 363 }
353 364
354 if ((isrc & EWTIS) || (isrc & EWRIS)) { 365 if ((isrc & EWTIS) || (isrc & EWRIS)) {
355 dev_dbg(dev->dev.parent, 366 netdev_dbg(dev, "Error Warning Transmit/Receive Interrupt\n");
356 "Error Warning Transmit/Receive Interrupt\n");
357 state = CAN_STATE_ERROR_WARNING; 367 state = CAN_STATE_ERROR_WARNING;
358 } 368 }
359 369
@@ -509,6 +519,7 @@ struct net_device *alloc_bfin_candev(void)
509 priv->can.bittiming_const = &bfin_can_bittiming_const; 519 priv->can.bittiming_const = &bfin_can_bittiming_const;
510 priv->can.do_set_bittiming = bfin_can_set_bittiming; 520 priv->can.do_set_bittiming = bfin_can_set_bittiming;
511 priv->can.do_set_mode = bfin_can_set_mode; 521 priv->can.do_set_mode = bfin_can_set_mode;
522 priv->can.do_get_berr_counter = bfin_can_get_berr_counter;
512 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; 523 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
513 524
514 return dev; 525 return dev;
@@ -636,8 +647,7 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
636 while (!(bfin_read(&reg->intr) & SMACK)) { 647 while (!(bfin_read(&reg->intr) & SMACK)) {
637 udelay(10); 648 udelay(10);
638 if (--timeout == 0) { 649 if (--timeout == 0) {
639 dev_err(dev->dev.parent, 650 netdev_err(dev, "fail to enter sleep mode\n");
640 "fail to enter sleep mode\n");
641 BUG(); 651 BUG();
642 } 652 }
643 } 653 }
diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c
index 120f1ab5a2ce..c5fe3a3db8c9 100644
--- a/drivers/net/can/dev.c
+++ b/drivers/net/can/dev.c
@@ -130,13 +130,13 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
130 /* Error in one-tenth of a percent */ 130 /* Error in one-tenth of a percent */
131 error = (best_error * 1000) / bt->bitrate; 131 error = (best_error * 1000) / bt->bitrate;
132 if (error > CAN_CALC_MAX_ERROR) { 132 if (error > CAN_CALC_MAX_ERROR) {
133 dev_err(dev->dev.parent, 133 netdev_err(dev,
134 "bitrate error %ld.%ld%% too high\n", 134 "bitrate error %ld.%ld%% too high\n",
135 error / 10, error % 10); 135 error / 10, error % 10);
136 return -EDOM; 136 return -EDOM;
137 } else { 137 } else {
138 dev_warn(dev->dev.parent, "bitrate error %ld.%ld%%\n", 138 netdev_warn(dev, "bitrate error %ld.%ld%%\n",
139 error / 10, error % 10); 139 error / 10, error % 10);
140 } 140 }
141 } 141 }
142 142
@@ -172,7 +172,7 @@ static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
172#else /* !CONFIG_CAN_CALC_BITTIMING */ 172#else /* !CONFIG_CAN_CALC_BITTIMING */
173static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt) 173static int can_calc_bittiming(struct net_device *dev, struct can_bittiming *bt)
174{ 174{
175 dev_err(dev->dev.parent, "bit-timing calculation not available\n"); 175 netdev_err(dev, "bit-timing calculation not available\n");
176 return -EINVAL; 176 return -EINVAL;
177} 177}
178#endif /* CONFIG_CAN_CALC_BITTIMING */ 178#endif /* CONFIG_CAN_CALC_BITTIMING */
@@ -313,8 +313,7 @@ void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
313 priv->echo_skb[idx] = skb; 313 priv->echo_skb[idx] = skb;
314 } else { 314 } else {
315 /* locking problem with netif_stop_queue() ?? */ 315 /* locking problem with netif_stop_queue() ?? */
316 dev_err(dev->dev.parent, "%s: BUG! echo_skb is occupied!\n", 316 netdev_err(dev, "%s: BUG! echo_skb is occupied!\n", __func__);
317 __func__);
318 kfree_skb(skb); 317 kfree_skb(skb);
319 } 318 }
320} 319}
@@ -327,16 +326,24 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
327 * is handled in the device driver. The driver must protect 326 * is handled in the device driver. The driver must protect
328 * access to priv->echo_skb, if necessary. 327 * access to priv->echo_skb, if necessary.
329 */ 328 */
330void can_get_echo_skb(struct net_device *dev, unsigned int idx) 329unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
331{ 330{
332 struct can_priv *priv = netdev_priv(dev); 331 struct can_priv *priv = netdev_priv(dev);
333 332
334 BUG_ON(idx >= priv->echo_skb_max); 333 BUG_ON(idx >= priv->echo_skb_max);
335 334
336 if (priv->echo_skb[idx]) { 335 if (priv->echo_skb[idx]) {
336 struct sk_buff *skb = priv->echo_skb[idx];
337 struct can_frame *cf = (struct can_frame *)skb->data;
338 u8 dlc = cf->can_dlc;
339
337 netif_rx(priv->echo_skb[idx]); 340 netif_rx(priv->echo_skb[idx]);
338 priv->echo_skb[idx] = NULL; 341 priv->echo_skb[idx] = NULL;
342
343 return dlc;
339 } 344 }
345
346 return 0;
340} 347}
341EXPORT_SYMBOL_GPL(can_get_echo_skb); 348EXPORT_SYMBOL_GPL(can_get_echo_skb);
342 349
@@ -392,7 +399,7 @@ void can_restart(unsigned long data)
392 stats->rx_bytes += cf->can_dlc; 399 stats->rx_bytes += cf->can_dlc;
393 400
394restart: 401restart:
395 dev_dbg(dev->dev.parent, "restarted\n"); 402 netdev_dbg(dev, "restarted\n");
396 priv->can_stats.restarts++; 403 priv->can_stats.restarts++;
397 404
398 /* Now restart the device */ 405 /* Now restart the device */
@@ -400,7 +407,7 @@ restart:
400 407
401 netif_carrier_on(dev); 408 netif_carrier_on(dev);
402 if (err) 409 if (err)
403 dev_err(dev->dev.parent, "Error %d during restart", err); 410 netdev_err(dev, "Error %d during restart", err);
404} 411}
405 412
406int can_restart_now(struct net_device *dev) 413int can_restart_now(struct net_device *dev)
@@ -433,7 +440,7 @@ void can_bus_off(struct net_device *dev)
433{ 440{
434 struct can_priv *priv = netdev_priv(dev); 441 struct can_priv *priv = netdev_priv(dev);
435 442
436 dev_dbg(dev->dev.parent, "bus-off\n"); 443 netdev_dbg(dev, "bus-off\n");
437 444
438 netif_carrier_off(dev); 445 netif_carrier_off(dev);
439 priv->can_stats.bus_off++; 446 priv->can_stats.bus_off++;
@@ -545,7 +552,7 @@ int open_candev(struct net_device *dev)
545 struct can_priv *priv = netdev_priv(dev); 552 struct can_priv *priv = netdev_priv(dev);
546 553
547 if (!priv->bittiming.tq && !priv->bittiming.bitrate) { 554 if (!priv->bittiming.tq && !priv->bittiming.bitrate) {
548 dev_err(dev->dev.parent, "bit-timing not yet defined\n"); 555 netdev_err(dev, "bit-timing not yet defined\n");
549 return -EINVAL; 556 return -EINVAL;
550 } 557 }
551 558
diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 96d235799ec1..1efb08386c61 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -272,7 +272,6 @@ static int flexcan_get_berr_counter(const struct net_device *dev,
272static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev) 272static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
273{ 273{
274 const struct flexcan_priv *priv = netdev_priv(dev); 274 const struct flexcan_priv *priv = netdev_priv(dev);
275 struct net_device_stats *stats = &dev->stats;
276 struct flexcan_regs __iomem *regs = priv->base; 275 struct flexcan_regs __iomem *regs = priv->base;
277 struct can_frame *cf = (struct can_frame *)skb->data; 276 struct can_frame *cf = (struct can_frame *)skb->data;
278 u32 can_id; 277 u32 can_id;
@@ -302,14 +301,11 @@ static int flexcan_start_xmit(struct sk_buff *skb, struct net_device *dev)
302 flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]); 301 flexcan_write(data, &regs->cantxfg[FLEXCAN_TX_BUF_ID].data[1]);
303 } 302 }
304 303
304 can_put_echo_skb(skb, dev, 0);
305
305 flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id); 306 flexcan_write(can_id, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_id);
306 flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl); 307 flexcan_write(ctrl, &regs->cantxfg[FLEXCAN_TX_BUF_ID].can_ctrl);
307 308
308 kfree_skb(skb);
309
310 /* tx_packets is incremented in flexcan_irq */
311 stats->tx_bytes += cf->can_dlc;
312
313 return NETDEV_TX_OK; 309 return NETDEV_TX_OK;
314} 310}
315 311
@@ -322,34 +318,34 @@ static void do_bus_err(struct net_device *dev,
322 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR; 318 cf->can_id |= CAN_ERR_PROT | CAN_ERR_BUSERROR;
323 319
324 if (reg_esr & FLEXCAN_ESR_BIT1_ERR) { 320 if (reg_esr & FLEXCAN_ESR_BIT1_ERR) {
325 dev_dbg(dev->dev.parent, "BIT1_ERR irq\n"); 321 netdev_dbg(dev, "BIT1_ERR irq\n");
326 cf->data[2] |= CAN_ERR_PROT_BIT1; 322 cf->data[2] |= CAN_ERR_PROT_BIT1;
327 tx_errors = 1; 323 tx_errors = 1;
328 } 324 }
329 if (reg_esr & FLEXCAN_ESR_BIT0_ERR) { 325 if (reg_esr & FLEXCAN_ESR_BIT0_ERR) {
330 dev_dbg(dev->dev.parent, "BIT0_ERR irq\n"); 326 netdev_dbg(dev, "BIT0_ERR irq\n");
331 cf->data[2] |= CAN_ERR_PROT_BIT0; 327 cf->data[2] |= CAN_ERR_PROT_BIT0;
332 tx_errors = 1; 328 tx_errors = 1;
333 } 329 }
334 if (reg_esr & FLEXCAN_ESR_ACK_ERR) { 330 if (reg_esr & FLEXCAN_ESR_ACK_ERR) {
335 dev_dbg(dev->dev.parent, "ACK_ERR irq\n"); 331 netdev_dbg(dev, "ACK_ERR irq\n");
336 cf->can_id |= CAN_ERR_ACK; 332 cf->can_id |= CAN_ERR_ACK;
337 cf->data[3] |= CAN_ERR_PROT_LOC_ACK; 333 cf->data[3] |= CAN_ERR_PROT_LOC_ACK;
338 tx_errors = 1; 334 tx_errors = 1;
339 } 335 }
340 if (reg_esr & FLEXCAN_ESR_CRC_ERR) { 336 if (reg_esr & FLEXCAN_ESR_CRC_ERR) {
341 dev_dbg(dev->dev.parent, "CRC_ERR irq\n"); 337 netdev_dbg(dev, "CRC_ERR irq\n");
342 cf->data[2] |= CAN_ERR_PROT_BIT; 338 cf->data[2] |= CAN_ERR_PROT_BIT;
343 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ; 339 cf->data[3] |= CAN_ERR_PROT_LOC_CRC_SEQ;
344 rx_errors = 1; 340 rx_errors = 1;
345 } 341 }
346 if (reg_esr & FLEXCAN_ESR_FRM_ERR) { 342 if (reg_esr & FLEXCAN_ESR_FRM_ERR) {
347 dev_dbg(dev->dev.parent, "FRM_ERR irq\n"); 343 netdev_dbg(dev, "FRM_ERR irq\n");
348 cf->data[2] |= CAN_ERR_PROT_FORM; 344 cf->data[2] |= CAN_ERR_PROT_FORM;
349 rx_errors = 1; 345 rx_errors = 1;
350 } 346 }
351 if (reg_esr & FLEXCAN_ESR_STF_ERR) { 347 if (reg_esr & FLEXCAN_ESR_STF_ERR) {
352 dev_dbg(dev->dev.parent, "STF_ERR irq\n"); 348 netdev_dbg(dev, "STF_ERR irq\n");
353 cf->data[2] |= CAN_ERR_PROT_STUFF; 349 cf->data[2] |= CAN_ERR_PROT_STUFF;
354 rx_errors = 1; 350 rx_errors = 1;
355 } 351 }
@@ -396,7 +392,7 @@ static void do_state(struct net_device *dev,
396 */ 392 */
397 if (new_state >= CAN_STATE_ERROR_WARNING && 393 if (new_state >= CAN_STATE_ERROR_WARNING &&
398 new_state <= CAN_STATE_BUS_OFF) { 394 new_state <= CAN_STATE_BUS_OFF) {
399 dev_dbg(dev->dev.parent, "Error Warning IRQ\n"); 395 netdev_dbg(dev, "Error Warning IRQ\n");
400 priv->can.can_stats.error_warning++; 396 priv->can.can_stats.error_warning++;
401 397
402 cf->can_id |= CAN_ERR_CRTL; 398 cf->can_id |= CAN_ERR_CRTL;
@@ -412,7 +408,7 @@ static void do_state(struct net_device *dev,
412 */ 408 */
413 if (new_state >= CAN_STATE_ERROR_PASSIVE && 409 if (new_state >= CAN_STATE_ERROR_PASSIVE &&
414 new_state <= CAN_STATE_BUS_OFF) { 410 new_state <= CAN_STATE_BUS_OFF) {
415 dev_dbg(dev->dev.parent, "Error Passive IRQ\n"); 411 netdev_dbg(dev, "Error Passive IRQ\n");
416 priv->can.can_stats.error_passive++; 412 priv->can.can_stats.error_passive++;
417 413
418 cf->can_id |= CAN_ERR_CRTL; 414 cf->can_id |= CAN_ERR_CRTL;
@@ -422,8 +418,8 @@ static void do_state(struct net_device *dev,
422 } 418 }
423 break; 419 break;
424 case CAN_STATE_BUS_OFF: 420 case CAN_STATE_BUS_OFF:
425 dev_err(dev->dev.parent, 421 netdev_err(dev, "BUG! "
426 "BUG! hardware recovered automatically from BUS_OFF\n"); 422 "hardware recovered automatically from BUS_OFF\n");
427 break; 423 break;
428 default: 424 default:
429 break; 425 break;
@@ -432,7 +428,7 @@ static void do_state(struct net_device *dev,
432 /* process state changes depending on the new state */ 428 /* process state changes depending on the new state */
433 switch (new_state) { 429 switch (new_state) {
434 case CAN_STATE_ERROR_ACTIVE: 430 case CAN_STATE_ERROR_ACTIVE:
435 dev_dbg(dev->dev.parent, "Error Active\n"); 431 netdev_dbg(dev, "Error Active\n");
436 cf->can_id |= CAN_ERR_PROT; 432 cf->can_id |= CAN_ERR_PROT;
437 cf->data[2] = CAN_ERR_PROT_ACTIVE; 433 cf->data[2] = CAN_ERR_PROT_ACTIVE;
438 break; 434 break;
@@ -614,7 +610,7 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
614 610
615 /* transmission complete interrupt */ 611 /* transmission complete interrupt */
616 if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) { 612 if (reg_iflag1 & (1 << FLEXCAN_TX_BUF_ID)) {
617 /* tx_bytes is incremented in flexcan_start_xmit */ 613 stats->tx_bytes += can_get_echo_skb(dev, 0);
618 stats->tx_packets++; 614 stats->tx_packets++;
619 flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1); 615 flexcan_write((1 << FLEXCAN_TX_BUF_ID), &regs->iflag1);
620 netif_wake_queue(dev); 616 netif_wake_queue(dev);
@@ -653,12 +649,12 @@ static void flexcan_set_bittiming(struct net_device *dev)
653 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) 649 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
654 reg |= FLEXCAN_CTRL_SMP; 650 reg |= FLEXCAN_CTRL_SMP;
655 651
656 dev_info(dev->dev.parent, "writing ctrl=0x%08x\n", reg); 652 netdev_info(dev, "writing ctrl=0x%08x\n", reg);
657 flexcan_write(reg, &regs->ctrl); 653 flexcan_write(reg, &regs->ctrl);
658 654
659 /* print chip status */ 655 /* print chip status */
660 dev_dbg(dev->dev.parent, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__, 656 netdev_dbg(dev, "%s: mcr=0x%08x ctrl=0x%08x\n", __func__,
661 flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl)); 657 flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
662} 658}
663 659
664/* 660/*
@@ -684,9 +680,8 @@ static int flexcan_chip_start(struct net_device *dev)
684 680
685 reg_mcr = flexcan_read(&regs->mcr); 681 reg_mcr = flexcan_read(&regs->mcr);
686 if (reg_mcr & FLEXCAN_MCR_SOFTRST) { 682 if (reg_mcr & FLEXCAN_MCR_SOFTRST) {
687 dev_err(dev->dev.parent, 683 netdev_err(dev, "Failed to softreset can module (mcr=0x%08x)\n",
688 "Failed to softreset can module (mcr=0x%08x)\n", 684 reg_mcr);
689 reg_mcr);
690 err = -ENODEV; 685 err = -ENODEV;
691 goto out; 686 goto out;
692 } 687 }
@@ -702,13 +697,14 @@ static int flexcan_chip_start(struct net_device *dev)
702 * only supervisor access 697 * only supervisor access
703 * enable warning int 698 * enable warning int
704 * choose format C 699 * choose format C
700 * disable local echo
705 * 701 *
706 */ 702 */
707 reg_mcr = flexcan_read(&regs->mcr); 703 reg_mcr = flexcan_read(&regs->mcr);
708 reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT | 704 reg_mcr |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_FEN | FLEXCAN_MCR_HALT |
709 FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN | 705 FLEXCAN_MCR_SUPV | FLEXCAN_MCR_WRN_EN |
710 FLEXCAN_MCR_IDAM_C; 706 FLEXCAN_MCR_IDAM_C | FLEXCAN_MCR_SRX_DIS;
711 dev_dbg(dev->dev.parent, "%s: writing mcr=0x%08x", __func__, reg_mcr); 707 netdev_dbg(dev, "%s: writing mcr=0x%08x", __func__, reg_mcr);
712 flexcan_write(reg_mcr, &regs->mcr); 708 flexcan_write(reg_mcr, &regs->mcr);
713 709
714 /* 710 /*
@@ -734,7 +730,7 @@ static int flexcan_chip_start(struct net_device *dev)
734 730
735 /* save for later use */ 731 /* save for later use */
736 priv->reg_ctrl_default = reg_ctrl; 732 priv->reg_ctrl_default = reg_ctrl;
737 dev_dbg(dev->dev.parent, "%s: writing ctrl=0x%08x", __func__, reg_ctrl); 733 netdev_dbg(dev, "%s: writing ctrl=0x%08x", __func__, reg_ctrl);
738 flexcan_write(reg_ctrl, &regs->ctrl); 734 flexcan_write(reg_ctrl, &regs->ctrl);
739 735
740 for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) { 736 for (i = 0; i < ARRAY_SIZE(regs->cantxfg); i++) {
@@ -766,8 +762,8 @@ static int flexcan_chip_start(struct net_device *dev)
766 flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1); 762 flexcan_write(FLEXCAN_IFLAG_DEFAULT, &regs->imask1);
767 763
768 /* print chip status */ 764 /* print chip status */
769 dev_dbg(dev->dev.parent, "%s: reading mcr=0x%08x ctrl=0x%08x\n", 765 netdev_dbg(dev, "%s: reading mcr=0x%08x ctrl=0x%08x\n", __func__,
770 __func__, flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl)); 766 flexcan_read(&regs->mcr), flexcan_read(&regs->ctrl));
771 767
772 return 0; 768 return 0;
773 769
@@ -905,8 +901,7 @@ static int __devinit register_flexcandev(struct net_device *dev)
905 */ 901 */
906 reg = flexcan_read(&regs->mcr); 902 reg = flexcan_read(&regs->mcr);
907 if (!(reg & FLEXCAN_MCR_FEN)) { 903 if (!(reg & FLEXCAN_MCR_FEN)) {
908 dev_err(dev->dev.parent, 904 netdev_err(dev, "Could not enable RX FIFO, unsupported core\n");
909 "Could not enable RX FIFO, unsupported core\n");
910 err = -ENODEV; 905 err = -ENODEV;
911 goto out; 906 goto out;
912 } 907 }
@@ -975,7 +970,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
975 goto failed_map; 970 goto failed_map;
976 } 971 }
977 972
978 dev = alloc_candev(sizeof(struct flexcan_priv), 0); 973 dev = alloc_candev(sizeof(struct flexcan_priv), 1);
979 if (!dev) { 974 if (!dev) {
980 err = -ENOMEM; 975 err = -ENOMEM;
981 goto failed_alloc; 976 goto failed_alloc;
@@ -983,7 +978,7 @@ static int __devinit flexcan_probe(struct platform_device *pdev)
983 978
984 dev->netdev_ops = &flexcan_netdev_ops; 979 dev->netdev_ops = &flexcan_netdev_ops;
985 dev->irq = irq; 980 dev->irq = irq;
986 dev->flags |= IFF_ECHO; /* we support local echo in hardware */ 981 dev->flags |= IFF_ECHO;
987 982
988 priv = netdev_priv(dev); 983 priv = netdev_priv(dev);
989 priv->can.clock.freq = clock_freq; 984 priv->can.clock.freq = clock_freq;
diff --git a/drivers/net/can/mcp251x.c b/drivers/net/can/mcp251x.c
index 330140ee266d..346785c56a25 100644
--- a/drivers/net/can/mcp251x.c
+++ b/drivers/net/can/mcp251x.c
@@ -712,8 +712,7 @@ static void mcp251x_error_skb(struct net_device *net, int can_id, int data1)
712 frame->data[1] = data1; 712 frame->data[1] = data1;
713 netif_rx_ni(skb); 713 netif_rx_ni(skb);
714 } else { 714 } else {
715 dev_err(&net->dev, 715 netdev_err(net, "cannot allocate error skb\n");
716 "cannot allocate error skb\n");
717 } 716 }
718} 717}
719 718
diff --git a/drivers/net/can/mscan/mscan.c b/drivers/net/can/mscan/mscan.c
index 1c82dd8b896e..41a2a2dda7ea 100644
--- a/drivers/net/can/mscan/mscan.c
+++ b/drivers/net/can/mscan/mscan.c
@@ -95,9 +95,9 @@ static int mscan_set_mode(struct net_device *dev, u8 mode)
95 * any, at once. 95 * any, at once.
96 */ 96 */
97 if (i >= MSCAN_SET_MODE_RETRIES) 97 if (i >= MSCAN_SET_MODE_RETRIES)
98 dev_dbg(dev->dev.parent, 98 netdev_dbg(dev,
99 "device failed to enter sleep mode. " 99 "device failed to enter sleep mode. "
100 "We proceed anyhow.\n"); 100 "We proceed anyhow.\n");
101 else 101 else
102 priv->can.state = CAN_STATE_SLEEPING; 102 priv->can.state = CAN_STATE_SLEEPING;
103 } 103 }
@@ -213,7 +213,7 @@ static netdev_tx_t mscan_start_xmit(struct sk_buff *skb, struct net_device *dev)
213 switch (hweight8(i)) { 213 switch (hweight8(i)) {
214 case 0: 214 case 0:
215 netif_stop_queue(dev); 215 netif_stop_queue(dev);
216 dev_err(dev->dev.parent, "Tx Ring full when queue awake!\n"); 216 netdev_err(dev, "Tx Ring full when queue awake!\n");
217 return NETDEV_TX_BUSY; 217 return NETDEV_TX_BUSY;
218 case 1: 218 case 1:
219 /* 219 /*
@@ -352,7 +352,7 @@ static void mscan_get_err_frame(struct net_device *dev, struct can_frame *frame,
352 struct net_device_stats *stats = &dev->stats; 352 struct net_device_stats *stats = &dev->stats;
353 enum can_state old_state; 353 enum can_state old_state;
354 354
355 dev_dbg(dev->dev.parent, "error interrupt (canrflg=%#x)\n", canrflg); 355 netdev_dbg(dev, "error interrupt (canrflg=%#x)\n", canrflg);
356 frame->can_id = CAN_ERR_FLAG; 356 frame->can_id = CAN_ERR_FLAG;
357 357
358 if (canrflg & MSCAN_OVRIF) { 358 if (canrflg & MSCAN_OVRIF) {
@@ -427,7 +427,7 @@ static int mscan_rx_poll(struct napi_struct *napi, int quota)
427 skb = alloc_can_skb(dev, &frame); 427 skb = alloc_can_skb(dev, &frame);
428 if (!skb) { 428 if (!skb) {
429 if (printk_ratelimit()) 429 if (printk_ratelimit())
430 dev_notice(dev->dev.parent, "packet dropped\n"); 430 netdev_notice(dev, "packet dropped\n");
431 stats->rx_dropped++; 431 stats->rx_dropped++;
432 out_8(&regs->canrflg, canrflg); 432 out_8(&regs->canrflg, canrflg);
433 continue; 433 continue;
@@ -551,8 +551,7 @@ static int mscan_do_set_bittiming(struct net_device *dev)
551 BTR1_SET_TSEG2(bt->phase_seg2) | 551 BTR1_SET_TSEG2(bt->phase_seg2) |
552 BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)); 552 BTR1_SET_SAM(priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES));
553 553
554 dev_info(dev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n", 554 netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
555 btr0, btr1);
556 555
557 out_8(&regs->canbtr0, btr0); 556 out_8(&regs->canbtr0, btr0);
558 out_8(&regs->canbtr1, btr1); 557 out_8(&regs->canbtr1, btr1);
@@ -560,6 +559,18 @@ static int mscan_do_set_bittiming(struct net_device *dev)
560 return 0; 559 return 0;
561} 560}
562 561
562static int mscan_get_berr_counter(const struct net_device *dev,
563 struct can_berr_counter *bec)
564{
565 struct mscan_priv *priv = netdev_priv(dev);
566 struct mscan_regs __iomem *regs = priv->reg_base;
567
568 bec->txerr = in_8(&regs->cantxerr);
569 bec->rxerr = in_8(&regs->canrxerr);
570
571 return 0;
572}
573
563static int mscan_open(struct net_device *dev) 574static int mscan_open(struct net_device *dev)
564{ 575{
565 int ret; 576 int ret;
@@ -575,7 +586,7 @@ static int mscan_open(struct net_device *dev)
575 586
576 ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev); 587 ret = request_irq(dev->irq, mscan_isr, 0, dev->name, dev);
577 if (ret < 0) { 588 if (ret < 0) {
578 dev_err(dev->dev.parent, "failed to attach interrupt\n"); 589 netdev_err(dev, "failed to attach interrupt\n");
579 goto exit_napi_disable; 590 goto exit_napi_disable;
580 } 591 }
581 592
@@ -639,8 +650,10 @@ int register_mscandev(struct net_device *dev, int mscan_clksrc)
639 else 650 else
640 ctl1 &= ~MSCAN_CLKSRC; 651 ctl1 &= ~MSCAN_CLKSRC;
641 652
642 if (priv->type == MSCAN_TYPE_MPC5121) 653 if (priv->type == MSCAN_TYPE_MPC5121) {
654 priv->can.do_get_berr_counter = mscan_get_berr_counter;
643 ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */ 655 ctl1 |= MSCAN_BORM; /* bus-off recovery upon request */
656 }
644 657
645 ctl1 |= MSCAN_CANE; 658 ctl1 |= MSCAN_CANE;
646 out_8(&regs->canctl1, ctl1); 659 out_8(&regs->canctl1, ctl1);
diff --git a/drivers/net/can/pch_can.c b/drivers/net/can/pch_can.c
index 6edc25e0dd15..2bb215e00eb1 100644
--- a/drivers/net/can/pch_can.c
+++ b/drivers/net/can/pch_can.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Copyright (C) 1999 - 2010 Intel Corporation. 2 * Copyright (C) 1999 - 2010 Intel Corporation.
3 * Copyright (C) 2010 OKI SEMICONDUCTOR CO., LTD. 3 * Copyright (C) 2010 LAPIS SEMICONDUCTOR CO., LTD.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify 5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by 6 * it under the terms of the GNU General Public License as published by
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index 36e9d594069d..b21523ddff3c 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -71,6 +71,7 @@ config CAN_PLX_PCI
71 - esd CAN-PCIe/2000 71 - esd CAN-PCIe/2000
72 - Marathon CAN-bus-PCI card (http://www.marathon.ru/) 72 - Marathon CAN-bus-PCI card (http://www.marathon.ru/)
73 - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/) 73 - TEWS TECHNOLOGIES TPMC810 card (http://www.tews.com/)
74 - IXXAT Automation PC-I 04/PCI card (http://www.ixxat.com/)
74 75
75config CAN_TSCAN1 76config CAN_TSCAN1
76 tristate "TS-CAN1 PC104 boards" 77 tristate "TS-CAN1 PC104 boards"
diff --git a/drivers/net/can/sja1000/plx_pci.c b/drivers/net/can/sja1000/plx_pci.c
index c7f3d4ea1167..a227586ddd52 100644
--- a/drivers/net/can/sja1000/plx_pci.c
+++ b/drivers/net/can/sja1000/plx_pci.c
@@ -43,7 +43,8 @@ MODULE_SUPPORTED_DEVICE("Adlink PCI-7841/cPCI-7841, "
43 "TEWS TECHNOLOGIES TPMC810, " 43 "TEWS TECHNOLOGIES TPMC810, "
44 "esd CAN-PCI/CPCI/PCI104/200, " 44 "esd CAN-PCI/CPCI/PCI104/200, "
45 "esd CAN-PCI/PMC/266, " 45 "esd CAN-PCI/PMC/266, "
46 "esd CAN-PCIe/2000") 46 "esd CAN-PCIe/2000, "
47 "IXXAT PC-I 04/PCI")
47MODULE_LICENSE("GPL v2"); 48MODULE_LICENSE("GPL v2");
48 49
49#define PLX_PCI_MAX_CHAN 2 50#define PLX_PCI_MAX_CHAN 2
@@ -121,6 +122,10 @@ struct plx_pci_card {
121#define ESD_PCI_SUB_SYS_ID_PCIE2000 0x0200 122#define ESD_PCI_SUB_SYS_ID_PCIE2000 0x0200
122#define ESD_PCI_SUB_SYS_ID_PCI104200 0x0501 123#define ESD_PCI_SUB_SYS_ID_PCI104200 0x0501
123 124
125#define IXXAT_PCI_VENDOR_ID 0x10b5
126#define IXXAT_PCI_DEVICE_ID 0x9050
127#define IXXAT_PCI_SUB_SYS_ID 0x2540
128
124#define MARATHON_PCI_DEVICE_ID 0x2715 129#define MARATHON_PCI_DEVICE_ID 0x2715
125 130
126#define TEWS_PCI_VENDOR_ID 0x1498 131#define TEWS_PCI_VENDOR_ID 0x1498
@@ -193,6 +198,14 @@ static struct plx_pci_card_info plx_pci_card_info_esd2000 __devinitdata = {
193 /* based on PEX8311 */ 198 /* based on PEX8311 */
194}; 199};
195 200
201static struct plx_pci_card_info plx_pci_card_info_ixxat __devinitdata = {
202 "IXXAT PC-I 04/PCI", 2,
203 PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR,
204 {0, 0x00, 0x00}, { {2, 0x00, 0x80}, {2, 0x200, 0x80} },
205 &plx_pci_reset_common
206 /* based on PLX9050 */
207};
208
196static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = { 209static struct plx_pci_card_info plx_pci_card_info_marathon __devinitdata = {
197 "Marathon CAN-bus-PCI", 2, 210 "Marathon CAN-bus-PCI", 2,
198 PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR, 211 PLX_PCI_CAN_CLOCK, PLX_PCI_OCR, PLX_PCI_CDR,
@@ -267,6 +280,13 @@ static DEFINE_PCI_DEVICE_TABLE(plx_pci_tbl) = {
267 (kernel_ulong_t)&plx_pci_card_info_esd2000 280 (kernel_ulong_t)&plx_pci_card_info_esd2000
268 }, 281 },
269 { 282 {
283 /* IXXAT PC-I 04/PCI card */
284 IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
285 PCI_ANY_ID, IXXAT_PCI_SUB_SYS_ID,
286 0, 0,
287 (kernel_ulong_t)&plx_pci_card_info_ixxat
288 },
289 {
270 /* Marathon CAN-bus-PCI card */ 290 /* Marathon CAN-bus-PCI card */
271 PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID, 291 PCI_VENDOR_ID_PLX, MARATHON_PCI_DEVICE_ID,
272 PCI_ANY_ID, PCI_ANY_ID, 292 PCI_ANY_ID, PCI_ANY_ID,
diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c
index 04a3f1b756a8..ebbcfcafe29b 100644
--- a/drivers/net/can/sja1000/sja1000.c
+++ b/drivers/net/can/sja1000/sja1000.c
@@ -128,7 +128,7 @@ static void set_reset_mode(struct net_device *dev)
128 status = priv->read_reg(priv, REG_MOD); 128 status = priv->read_reg(priv, REG_MOD);
129 } 129 }
130 130
131 dev_err(dev->dev.parent, "setting SJA1000 into reset mode failed!\n"); 131 netdev_err(dev, "setting SJA1000 into reset mode failed!\n");
132} 132}
133 133
134static void set_normal_mode(struct net_device *dev) 134static void set_normal_mode(struct net_device *dev)
@@ -156,7 +156,7 @@ static void set_normal_mode(struct net_device *dev)
156 status = priv->read_reg(priv, REG_MOD); 156 status = priv->read_reg(priv, REG_MOD);
157 } 157 }
158 158
159 dev_err(dev->dev.parent, "setting SJA1000 into normal mode failed!\n"); 159 netdev_err(dev, "setting SJA1000 into normal mode failed!\n");
160} 160}
161 161
162static void sja1000_start(struct net_device *dev) 162static void sja1000_start(struct net_device *dev)
@@ -209,8 +209,7 @@ static int sja1000_set_bittiming(struct net_device *dev)
209 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) 209 if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
210 btr1 |= 0x80; 210 btr1 |= 0x80;
211 211
212 dev_info(dev->dev.parent, 212 netdev_info(dev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
213 "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
214 213
215 priv->write_reg(priv, REG_BTR0, btr0); 214 priv->write_reg(priv, REG_BTR0, btr0);
216 priv->write_reg(priv, REG_BTR1, btr1); 215 priv->write_reg(priv, REG_BTR1, btr1);
@@ -378,7 +377,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
378 377
379 if (isrc & IRQ_DOI) { 378 if (isrc & IRQ_DOI) {
380 /* data overrun interrupt */ 379 /* data overrun interrupt */
381 dev_dbg(dev->dev.parent, "data overrun interrupt\n"); 380 netdev_dbg(dev, "data overrun interrupt\n");
382 cf->can_id |= CAN_ERR_CRTL; 381 cf->can_id |= CAN_ERR_CRTL;
383 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW; 382 cf->data[1] = CAN_ERR_CRTL_RX_OVERFLOW;
384 stats->rx_over_errors++; 383 stats->rx_over_errors++;
@@ -388,7 +387,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
388 387
389 if (isrc & IRQ_EI) { 388 if (isrc & IRQ_EI) {
390 /* error warning interrupt */ 389 /* error warning interrupt */
391 dev_dbg(dev->dev.parent, "error warning interrupt\n"); 390 netdev_dbg(dev, "error warning interrupt\n");
392 391
393 if (status & SR_BS) { 392 if (status & SR_BS) {
394 state = CAN_STATE_BUS_OFF; 393 state = CAN_STATE_BUS_OFF;
@@ -429,7 +428,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
429 } 428 }
430 if (isrc & IRQ_EPI) { 429 if (isrc & IRQ_EPI) {
431 /* error passive interrupt */ 430 /* error passive interrupt */
432 dev_dbg(dev->dev.parent, "error passive interrupt\n"); 431 netdev_dbg(dev, "error passive interrupt\n");
433 if (status & SR_ES) 432 if (status & SR_ES)
434 state = CAN_STATE_ERROR_PASSIVE; 433 state = CAN_STATE_ERROR_PASSIVE;
435 else 434 else
@@ -437,7 +436,7 @@ static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status)
437 } 436 }
438 if (isrc & IRQ_ALI) { 437 if (isrc & IRQ_ALI) {
439 /* arbitration lost interrupt */ 438 /* arbitration lost interrupt */
440 dev_dbg(dev->dev.parent, "arbitration lost interrupt\n"); 439 netdev_dbg(dev, "arbitration lost interrupt\n");
441 alc = priv->read_reg(priv, REG_ALC); 440 alc = priv->read_reg(priv, REG_ALC);
442 priv->can.can_stats.arbitration_lost++; 441 priv->can.can_stats.arbitration_lost++;
443 stats->tx_errors++; 442 stats->tx_errors++;
@@ -495,7 +494,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
495 status = priv->read_reg(priv, REG_SR); 494 status = priv->read_reg(priv, REG_SR);
496 495
497 if (isrc & IRQ_WUI) 496 if (isrc & IRQ_WUI)
498 dev_warn(dev->dev.parent, "wakeup interrupt\n"); 497 netdev_warn(dev, "wakeup interrupt\n");
499 498
500 if (isrc & IRQ_TI) { 499 if (isrc & IRQ_TI) {
501 /* transmission complete interrupt */ 500 /* transmission complete interrupt */
@@ -522,7 +521,7 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id)
522 priv->post_irq(priv); 521 priv->post_irq(priv);
523 522
524 if (n >= SJA1000_MAX_IRQ) 523 if (n >= SJA1000_MAX_IRQ)
525 dev_dbg(dev->dev.parent, "%d messages handled in ISR", n); 524 netdev_dbg(dev, "%d messages handled in ISR", n);
526 525
527 return (n) ? IRQ_HANDLED : IRQ_NONE; 526 return (n) ? IRQ_HANDLED : IRQ_NONE;
528} 527}
diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c
index 5a2e1e3588a1..4accd7ec6954 100644
--- a/drivers/net/can/ti_hecc.c
+++ b/drivers/net/can/ti_hecc.c
@@ -306,7 +306,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
306 if (bit_timing->brp > 4) 306 if (bit_timing->brp > 4)
307 can_btc |= HECC_CANBTC_SAM; 307 can_btc |= HECC_CANBTC_SAM;
308 else 308 else
309 dev_warn(priv->ndev->dev.parent, "WARN: Triple" \ 309 netdev_warn(priv->ndev, "WARN: Triple"
310 "sampling not set due to h/w limitations"); 310 "sampling not set due to h/w limitations");
311 } 311 }
312 can_btc |= ((bit_timing->sjw - 1) & 0x3) << 8; 312 can_btc |= ((bit_timing->sjw - 1) & 0x3) << 8;
@@ -315,7 +315,7 @@ static int ti_hecc_set_btc(struct ti_hecc_priv *priv)
315 /* ERM being set to 0 by default meaning resync at falling edge */ 315 /* ERM being set to 0 by default meaning resync at falling edge */
316 316
317 hecc_write(priv, HECC_CANBTC, can_btc); 317 hecc_write(priv, HECC_CANBTC, can_btc);
318 dev_info(priv->ndev->dev.parent, "setting CANBTC=%#x\n", can_btc); 318 netdev_info(priv->ndev, "setting CANBTC=%#x\n", can_btc);
319 319
320 return 0; 320 return 0;
321} 321}
@@ -332,7 +332,7 @@ static void ti_hecc_reset(struct net_device *ndev)
332 u32 cnt; 332 u32 cnt;
333 struct ti_hecc_priv *priv = netdev_priv(ndev); 333 struct ti_hecc_priv *priv = netdev_priv(ndev);
334 334
335 dev_dbg(ndev->dev.parent, "resetting hecc ...\n"); 335 netdev_dbg(ndev, "resetting hecc ...\n");
336 hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_SRES); 336 hecc_set_bit(priv, HECC_CANMC, HECC_CANMC_SRES);
337 337
338 /* Set change control request and wait till enabled */ 338 /* Set change control request and wait till enabled */
@@ -458,6 +458,17 @@ static int ti_hecc_do_set_mode(struct net_device *ndev, enum can_mode mode)
458 return ret; 458 return ret;
459} 459}
460 460
461static int ti_hecc_get_berr_counter(const struct net_device *ndev,
462 struct can_berr_counter *bec)
463{
464 struct ti_hecc_priv *priv = netdev_priv(ndev);
465
466 bec->txerr = hecc_read(priv, HECC_CANTEC);
467 bec->rxerr = hecc_read(priv, HECC_CANREC);
468
469 return 0;
470}
471
461/* 472/*
462 * ti_hecc_xmit: HECC Transmit 473 * ti_hecc_xmit: HECC Transmit
463 * 474 *
@@ -496,7 +507,7 @@ static netdev_tx_t ti_hecc_xmit(struct sk_buff *skb, struct net_device *ndev)
496 if (unlikely(hecc_read(priv, HECC_CANME) & mbx_mask)) { 507 if (unlikely(hecc_read(priv, HECC_CANME) & mbx_mask)) {
497 spin_unlock_irqrestore(&priv->mbx_lock, flags); 508 spin_unlock_irqrestore(&priv->mbx_lock, flags);
498 netif_stop_queue(ndev); 509 netif_stop_queue(ndev);
499 dev_err(priv->ndev->dev.parent, 510 netdev_err(priv->ndev,
500 "BUG: TX mbx not ready tx_head=%08X, tx_tail=%08X\n", 511 "BUG: TX mbx not ready tx_head=%08X, tx_tail=%08X\n",
501 priv->tx_head, priv->tx_tail); 512 priv->tx_head, priv->tx_tail);
502 return NETDEV_TX_BUSY; 513 return NETDEV_TX_BUSY;
@@ -550,7 +561,7 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno)
550 skb = alloc_can_skb(priv->ndev, &cf); 561 skb = alloc_can_skb(priv->ndev, &cf);
551 if (!skb) { 562 if (!skb) {
552 if (printk_ratelimit()) 563 if (printk_ratelimit())
553 dev_err(priv->ndev->dev.parent, 564 netdev_err(priv->ndev,
554 "ti_hecc_rx_pkt: alloc_can_skb() failed\n"); 565 "ti_hecc_rx_pkt: alloc_can_skb() failed\n");
555 return -ENOMEM; 566 return -ENOMEM;
556 } 567 }
@@ -668,7 +679,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
668 skb = alloc_can_err_skb(ndev, &cf); 679 skb = alloc_can_err_skb(ndev, &cf);
669 if (!skb) { 680 if (!skb) {
670 if (printk_ratelimit()) 681 if (printk_ratelimit())
671 dev_err(priv->ndev->dev.parent, 682 netdev_err(priv->ndev,
672 "ti_hecc_error: alloc_can_err_skb() failed\n"); 683 "ti_hecc_error: alloc_can_err_skb() failed\n");
673 return -ENOMEM; 684 return -ENOMEM;
674 } 685 }
@@ -684,7 +695,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
684 cf->data[1] |= CAN_ERR_CRTL_RX_WARNING; 695 cf->data[1] |= CAN_ERR_CRTL_RX_WARNING;
685 } 696 }
686 hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW); 697 hecc_set_bit(priv, HECC_CANES, HECC_CANES_EW);
687 dev_dbg(priv->ndev->dev.parent, "Error Warning interrupt\n"); 698 netdev_dbg(priv->ndev, "Error Warning interrupt\n");
688 hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); 699 hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
689 } 700 }
690 701
@@ -699,7 +710,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
699 cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE; 710 cf->data[1] |= CAN_ERR_CRTL_RX_PASSIVE;
700 } 711 }
701 hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP); 712 hecc_set_bit(priv, HECC_CANES, HECC_CANES_EP);
702 dev_dbg(priv->ndev->dev.parent, "Error passive interrupt\n"); 713 netdev_dbg(priv->ndev, "Error passive interrupt\n");
703 hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); 714 hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
704 } 715 }
705 716
@@ -825,7 +836,7 @@ static int ti_hecc_open(struct net_device *ndev)
825 err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED, 836 err = request_irq(ndev->irq, ti_hecc_interrupt, IRQF_SHARED,
826 ndev->name, ndev); 837 ndev->name, ndev);
827 if (err) { 838 if (err) {
828 dev_err(ndev->dev.parent, "error requesting interrupt\n"); 839 netdev_err(ndev, "error requesting interrupt\n");
829 return err; 840 return err;
830 } 841 }
831 842
@@ -834,7 +845,7 @@ static int ti_hecc_open(struct net_device *ndev)
834 /* Open common can device */ 845 /* Open common can device */
835 err = open_candev(ndev); 846 err = open_candev(ndev);
836 if (err) { 847 if (err) {
837 dev_err(ndev->dev.parent, "open_candev() failed %d\n", err); 848 netdev_err(ndev, "open_candev() failed %d\n", err);
838 ti_hecc_transceiver_switch(priv, 0); 849 ti_hecc_transceiver_switch(priv, 0);
839 free_irq(ndev->irq, ndev); 850 free_irq(ndev->irq, ndev);
840 return err; 851 return err;
@@ -923,6 +934,7 @@ static int ti_hecc_probe(struct platform_device *pdev)
923 priv->can.bittiming_const = &ti_hecc_bittiming_const; 934 priv->can.bittiming_const = &ti_hecc_bittiming_const;
924 priv->can.do_set_mode = ti_hecc_do_set_mode; 935 priv->can.do_set_mode = ti_hecc_do_set_mode;
925 priv->can.do_get_state = ti_hecc_get_state; 936 priv->can.do_get_state = ti_hecc_get_state;
937 priv->can.do_get_berr_counter = ti_hecc_get_berr_counter;
926 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES; 938 priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;
927 939
928 spin_lock_init(&priv->mbx_lock); 940 spin_lock_init(&priv->mbx_lock);
diff --git a/drivers/net/can/usb/ems_usb.c b/drivers/net/can/usb/ems_usb.c
index 7dae64d44e83..7ae65fc80032 100644
--- a/drivers/net/can/usb/ems_usb.c
+++ b/drivers/net/can/usb/ems_usb.c
@@ -288,8 +288,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
288 return; 288 return;
289 289
290 default: 290 default:
291 dev_info(netdev->dev.parent, "Rx interrupt aborted %d\n", 291 netdev_info(netdev, "Rx interrupt aborted %d\n", urb->status);
292 urb->status);
293 break; 292 break;
294 } 293 }
295 294
@@ -298,8 +297,7 @@ static void ems_usb_read_interrupt_callback(struct urb *urb)
298 if (err == -ENODEV) 297 if (err == -ENODEV)
299 netif_device_detach(netdev); 298 netif_device_detach(netdev);
300 else if (err) 299 else if (err)
301 dev_err(netdev->dev.parent, 300 netdev_err(netdev, "failed resubmitting intr urb: %d\n", err);
302 "failed resubmitting intr urb: %d\n", err);
303} 301}
304 302
305static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg) 303static void ems_usb_rx_can_msg(struct ems_usb *dev, struct ems_cpc_msg *msg)
@@ -431,8 +429,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
431 return; 429 return;
432 430
433 default: 431 default:
434 dev_info(netdev->dev.parent, "Rx URB aborted (%d)\n", 432 netdev_info(netdev, "Rx URB aborted (%d)\n", urb->status);
435 urb->status);
436 goto resubmit_urb; 433 goto resubmit_urb;
437 } 434 }
438 435
@@ -477,7 +474,7 @@ static void ems_usb_read_bulk_callback(struct urb *urb)
477 msg_count--; 474 msg_count--;
478 475
479 if (start > urb->transfer_buffer_length) { 476 if (start > urb->transfer_buffer_length) {
480 dev_err(netdev->dev.parent, "format error\n"); 477 netdev_err(netdev, "format error\n");
481 break; 478 break;
482 } 479 }
483 } 480 }
@@ -493,8 +490,8 @@ resubmit_urb:
493 if (retval == -ENODEV) 490 if (retval == -ENODEV)
494 netif_device_detach(netdev); 491 netif_device_detach(netdev);
495 else if (retval) 492 else if (retval)
496 dev_err(netdev->dev.parent, 493 netdev_err(netdev,
497 "failed resubmitting read bulk urb: %d\n", retval); 494 "failed resubmitting read bulk urb: %d\n", retval);
498} 495}
499 496
500/* 497/*
@@ -521,8 +518,7 @@ static void ems_usb_write_bulk_callback(struct urb *urb)
521 return; 518 return;
522 519
523 if (urb->status) 520 if (urb->status)
524 dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n", 521 netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
525 urb->status);
526 522
527 netdev->trans_start = jiffies; 523 netdev->trans_start = jiffies;
528 524
@@ -605,18 +601,18 @@ static int ems_usb_start(struct ems_usb *dev)
605 /* create a URB, and a buffer for it */ 601 /* create a URB, and a buffer for it */
606 urb = usb_alloc_urb(0, GFP_KERNEL); 602 urb = usb_alloc_urb(0, GFP_KERNEL);
607 if (!urb) { 603 if (!urb) {
608 dev_err(netdev->dev.parent, 604 netdev_err(netdev, "No memory left for URBs\n");
609 "No memory left for URBs\n"); 605 err = -ENOMEM;
610 return -ENOMEM; 606 break;
611 } 607 }
612 608
613 buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL, 609 buf = usb_alloc_coherent(dev->udev, RX_BUFFER_SIZE, GFP_KERNEL,
614 &urb->transfer_dma); 610 &urb->transfer_dma);
615 if (!buf) { 611 if (!buf) {
616 dev_err(netdev->dev.parent, 612 netdev_err(netdev, "No memory left for USB buffer\n");
617 "No memory left for USB buffer\n");
618 usb_free_urb(urb); 613 usb_free_urb(urb);
619 return -ENOMEM; 614 err = -ENOMEM;
615 break;
620 } 616 }
621 617
622 usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2), 618 usb_fill_bulk_urb(urb, dev->udev, usb_rcvbulkpipe(dev->udev, 2),
@@ -639,13 +635,13 @@ static int ems_usb_start(struct ems_usb *dev)
639 635
640 /* Did we submit any URBs */ 636 /* Did we submit any URBs */
641 if (i == 0) { 637 if (i == 0) {
642 dev_warn(netdev->dev.parent, "couldn't setup read URBs\n"); 638 netdev_warn(netdev, "couldn't setup read URBs\n");
643 return err; 639 return err;
644 } 640 }
645 641
646 /* Warn if we've couldn't transmit all the URBs */ 642 /* Warn if we've couldn't transmit all the URBs */
647 if (i < MAX_RX_URBS) 643 if (i < MAX_RX_URBS)
648 dev_warn(netdev->dev.parent, "rx performance may be slow\n"); 644 netdev_warn(netdev, "rx performance may be slow\n");
649 645
650 /* Setup and start interrupt URB */ 646 /* Setup and start interrupt URB */
651 usb_fill_int_urb(dev->intr_urb, dev->udev, 647 usb_fill_int_urb(dev->intr_urb, dev->udev,
@@ -656,8 +652,7 @@ static int ems_usb_start(struct ems_usb *dev)
656 652
657 err = usb_submit_urb(dev->intr_urb, GFP_KERNEL); 653 err = usb_submit_urb(dev->intr_urb, GFP_KERNEL);
658 if (err) { 654 if (err) {
659 dev_warn(netdev->dev.parent, "intr URB submit failed: %d\n", 655 netdev_warn(netdev, "intr URB submit failed: %d\n", err);
660 err);
661 656
662 return err; 657 return err;
663 } 658 }
@@ -686,7 +681,7 @@ static int ems_usb_start(struct ems_usb *dev)
686 return 0; 681 return 0;
687 682
688failed: 683failed:
689 dev_warn(netdev->dev.parent, "couldn't submit control: %d\n", err); 684 netdev_warn(netdev, "couldn't submit control: %d\n", err);
690 685
691 return err; 686 return err;
692} 687}
@@ -726,8 +721,7 @@ static int ems_usb_open(struct net_device *netdev)
726 if (err == -ENODEV) 721 if (err == -ENODEV)
727 netif_device_detach(dev->netdev); 722 netif_device_detach(dev->netdev);
728 723
729 dev_warn(netdev->dev.parent, "couldn't start device: %d\n", 724 netdev_warn(netdev, "couldn't start device: %d\n", err);
730 err);
731 725
732 close_candev(netdev); 726 close_candev(netdev);
733 727
@@ -760,13 +754,13 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
760 /* create a URB, and a buffer for it, and copy the data to the URB */ 754 /* create a URB, and a buffer for it, and copy the data to the URB */
761 urb = usb_alloc_urb(0, GFP_ATOMIC); 755 urb = usb_alloc_urb(0, GFP_ATOMIC);
762 if (!urb) { 756 if (!urb) {
763 dev_err(netdev->dev.parent, "No memory left for URBs\n"); 757 netdev_err(netdev, "No memory left for URBs\n");
764 goto nomem; 758 goto nomem;
765 } 759 }
766 760
767 buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma); 761 buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, &urb->transfer_dma);
768 if (!buf) { 762 if (!buf) {
769 dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); 763 netdev_err(netdev, "No memory left for USB buffer\n");
770 usb_free_urb(urb); 764 usb_free_urb(urb);
771 goto nomem; 765 goto nomem;
772 } 766 }
@@ -809,7 +803,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
809 usb_unanchor_urb(urb); 803 usb_unanchor_urb(urb);
810 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma); 804 usb_free_coherent(dev->udev, size, buf, urb->transfer_dma);
811 805
812 dev_warn(netdev->dev.parent, "couldn't find free context\n"); 806 netdev_warn(netdev, "couldn't find free context\n");
813 807
814 return NETDEV_TX_BUSY; 808 return NETDEV_TX_BUSY;
815 } 809 }
@@ -840,7 +834,7 @@ static netdev_tx_t ems_usb_start_xmit(struct sk_buff *skb, struct net_device *ne
840 if (err == -ENODEV) { 834 if (err == -ENODEV) {
841 netif_device_detach(netdev); 835 netif_device_detach(netdev);
842 } else { 836 } else {
843 dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err); 837 netdev_warn(netdev, "failed tx_urb %d\n", err);
844 838
845 stats->tx_dropped++; 839 stats->tx_dropped++;
846 } 840 }
@@ -880,7 +874,7 @@ static int ems_usb_close(struct net_device *netdev)
880 874
881 /* Set CAN controller to reset mode */ 875 /* Set CAN controller to reset mode */
882 if (ems_usb_write_mode(dev, SJA1000_MOD_RM)) 876 if (ems_usb_write_mode(dev, SJA1000_MOD_RM))
883 dev_warn(netdev->dev.parent, "couldn't stop device"); 877 netdev_warn(netdev, "couldn't stop device");
884 878
885 close_candev(netdev); 879 close_candev(netdev);
886 880
@@ -917,7 +911,7 @@ static int ems_usb_set_mode(struct net_device *netdev, enum can_mode mode)
917 switch (mode) { 911 switch (mode) {
918 case CAN_MODE_START: 912 case CAN_MODE_START:
919 if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL)) 913 if (ems_usb_write_mode(dev, SJA1000_MOD_NORMAL))
920 dev_warn(netdev->dev.parent, "couldn't start device"); 914 netdev_warn(netdev, "couldn't start device");
921 915
922 if (netif_queue_stopped(netdev)) 916 if (netif_queue_stopped(netdev))
923 netif_wake_queue(netdev); 917 netif_wake_queue(netdev);
@@ -942,8 +936,7 @@ static int ems_usb_set_bittiming(struct net_device *netdev)
942 if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES) 936 if (dev->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
943 btr1 |= 0x80; 937 btr1 |= 0x80;
944 938
945 dev_info(netdev->dev.parent, "setting BTR0=0x%02x BTR1=0x%02x\n", 939 netdev_info(netdev, "setting BTR0=0x%02x BTR1=0x%02x\n", btr0, btr1);
946 btr0, btr1);
947 940
948 dev->active_params.msg.can_params.cc_params.sja1000.btr0 = btr0; 941 dev->active_params.msg.can_params.cc_params.sja1000.btr0 = btr0;
949 dev->active_params.msg.can_params.cc_params.sja1000.btr1 = btr1; 942 dev->active_params.msg.can_params.cc_params.sja1000.btr1 = btr1;
@@ -1048,15 +1041,13 @@ static int ems_usb_probe(struct usb_interface *intf,
1048 1041
1049 err = ems_usb_command_msg(dev, &dev->active_params); 1042 err = ems_usb_command_msg(dev, &dev->active_params);
1050 if (err) { 1043 if (err) {
1051 dev_err(netdev->dev.parent, 1044 netdev_err(netdev, "couldn't initialize controller: %d\n", err);
1052 "couldn't initialize controller: %d\n", err);
1053 goto cleanup_tx_msg_buffer; 1045 goto cleanup_tx_msg_buffer;
1054 } 1046 }
1055 1047
1056 err = register_candev(netdev); 1048 err = register_candev(netdev);
1057 if (err) { 1049 if (err) {
1058 dev_err(netdev->dev.parent, 1050 netdev_err(netdev, "couldn't register CAN device: %d\n", err);
1059 "couldn't register CAN device: %d\n", err);
1060 goto cleanup_tx_msg_buffer; 1051 goto cleanup_tx_msg_buffer;
1061 } 1052 }
1062 1053
diff --git a/drivers/net/can/usb/esd_usb2.c b/drivers/net/can/usb/esd_usb2.c
index 92774637aad8..09b1da5bc512 100644
--- a/drivers/net/can/usb/esd_usb2.c
+++ b/drivers/net/can/usb/esd_usb2.c
@@ -470,8 +470,7 @@ static void esd_usb2_write_bulk_callback(struct urb *urb)
470 return; 470 return;
471 471
472 if (urb->status) 472 if (urb->status)
473 dev_info(netdev->dev.parent, "Tx URB aborted (%d)\n", 473 netdev_info(netdev, "Tx URB aborted (%d)\n", urb->status);
474 urb->status);
475 474
476 netdev->trans_start = jiffies; 475 netdev->trans_start = jiffies;
477} 476}
@@ -651,7 +650,7 @@ failed:
651 if (err == -ENODEV) 650 if (err == -ENODEV)
652 netif_device_detach(netdev); 651 netif_device_detach(netdev);
653 652
654 dev_err(netdev->dev.parent, "couldn't start device: %d\n", err); 653 netdev_err(netdev, "couldn't start device: %d\n", err);
655 654
656 return err; 655 return err;
657} 656}
@@ -687,8 +686,7 @@ static int esd_usb2_open(struct net_device *netdev)
687 /* finally start device */ 686 /* finally start device */
688 err = esd_usb2_start(priv); 687 err = esd_usb2_start(priv);
689 if (err) { 688 if (err) {
690 dev_warn(netdev->dev.parent, 689 netdev_warn(netdev, "couldn't start device: %d\n", err);
691 "couldn't start device: %d\n", err);
692 close_candev(netdev); 690 close_candev(netdev);
693 return err; 691 return err;
694 } 692 }
@@ -721,7 +719,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
721 /* create a URB, and a buffer for it, and copy the data to the URB */ 719 /* create a URB, and a buffer for it, and copy the data to the URB */
722 urb = usb_alloc_urb(0, GFP_ATOMIC); 720 urb = usb_alloc_urb(0, GFP_ATOMIC);
723 if (!urb) { 721 if (!urb) {
724 dev_err(netdev->dev.parent, "No memory left for URBs\n"); 722 netdev_err(netdev, "No memory left for URBs\n");
725 stats->tx_dropped++; 723 stats->tx_dropped++;
726 dev_kfree_skb(skb); 724 dev_kfree_skb(skb);
727 goto nourbmem; 725 goto nourbmem;
@@ -730,7 +728,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
730 buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC, 728 buf = usb_alloc_coherent(dev->udev, size, GFP_ATOMIC,
731 &urb->transfer_dma); 729 &urb->transfer_dma);
732 if (!buf) { 730 if (!buf) {
733 dev_err(netdev->dev.parent, "No memory left for USB buffer\n"); 731 netdev_err(netdev, "No memory left for USB buffer\n");
734 stats->tx_dropped++; 732 stats->tx_dropped++;
735 dev_kfree_skb(skb); 733 dev_kfree_skb(skb);
736 goto nobufmem; 734 goto nobufmem;
@@ -766,7 +764,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
766 * This may never happen. 764 * This may never happen.
767 */ 765 */
768 if (!context) { 766 if (!context) {
769 dev_warn(netdev->dev.parent, "couldn't find free context\n"); 767 netdev_warn(netdev, "couldn't find free context\n");
770 ret = NETDEV_TX_BUSY; 768 ret = NETDEV_TX_BUSY;
771 goto releasebuf; 769 goto releasebuf;
772 } 770 }
@@ -806,7 +804,7 @@ static netdev_tx_t esd_usb2_start_xmit(struct sk_buff *skb,
806 if (err == -ENODEV) 804 if (err == -ENODEV)
807 netif_device_detach(netdev); 805 netif_device_detach(netdev);
808 else 806 else
809 dev_warn(netdev->dev.parent, "failed tx_urb %d\n", err); 807 netdev_warn(netdev, "failed tx_urb %d\n", err);
810 808
811 goto releasebuf; 809 goto releasebuf;
812 } 810 }
@@ -845,7 +843,7 @@ static int esd_usb2_close(struct net_device *netdev)
845 for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++) 843 for (i = 0; i <= ESD_MAX_ID_SEGMENT; i++)
846 msg.msg.filter.mask[i] = 0; 844 msg.msg.filter.mask[i] = 0;
847 if (esd_usb2_send_msg(priv->usb2, &msg) < 0) 845 if (esd_usb2_send_msg(priv->usb2, &msg) < 0)
848 dev_err(netdev->dev.parent, "sending idadd message failed\n"); 846 netdev_err(netdev, "sending idadd message failed\n");
849 847
850 /* set CAN controller to reset mode */ 848 /* set CAN controller to reset mode */
851 msg.msg.hdr.len = 2; 849 msg.msg.hdr.len = 2;
@@ -854,7 +852,7 @@ static int esd_usb2_close(struct net_device *netdev)
854 msg.msg.setbaud.rsvd = 0; 852 msg.msg.setbaud.rsvd = 0;
855 msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE); 853 msg.msg.setbaud.baud = cpu_to_le32(ESD_USB2_NO_BAUDRATE);
856 if (esd_usb2_send_msg(priv->usb2, &msg) < 0) 854 if (esd_usb2_send_msg(priv->usb2, &msg) < 0)
857 dev_err(netdev->dev.parent, "sending setbaud message failed\n"); 855 netdev_err(netdev, "sending setbaud message failed\n");
858 856
859 priv->can.state = CAN_STATE_STOPPED; 857 priv->can.state = CAN_STATE_STOPPED;
860 858
@@ -910,7 +908,7 @@ static int esd_usb2_set_bittiming(struct net_device *netdev)
910 msg.msg.setbaud.rsvd = 0; 908 msg.msg.setbaud.rsvd = 0;
911 msg.msg.setbaud.baud = cpu_to_le32(canbtr); 909 msg.msg.setbaud.baud = cpu_to_le32(canbtr);
912 910
913 dev_info(netdev->dev.parent, "setting BTR=%#x\n", canbtr); 911 netdev_info(netdev, "setting BTR=%#x\n", canbtr);
914 912
915 return esd_usb2_send_msg(priv->usb2, &msg); 913 return esd_usb2_send_msg(priv->usb2, &msg);
916} 914}
@@ -988,15 +986,14 @@ static int esd_usb2_probe_one_net(struct usb_interface *intf, int index)
988 986
989 err = register_candev(netdev); 987 err = register_candev(netdev);
990 if (err) { 988 if (err) {
991 dev_err(&intf->dev, 989 dev_err(&intf->dev, "couldn't register CAN device: %d\n", err);
992 "couldn't register CAN device: %d\n", err);
993 free_candev(netdev); 990 free_candev(netdev);
994 err = -ENOMEM; 991 err = -ENOMEM;
995 goto done; 992 goto done;
996 } 993 }
997 994
998 dev->nets[index] = priv; 995 dev->nets[index] = priv;
999 dev_info(netdev->dev.parent, "device %s registered\n", netdev->name); 996 netdev_info(netdev, "device %s registered\n", netdev->name);
1000 997
1001done: 998done:
1002 return err; 999 return err;
diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h
index a0969fcb72b9..5d2efe7e3f1b 100644
--- a/include/linux/can/dev.h
+++ b/include/linux/can/dev.h
@@ -92,7 +92,7 @@ void can_bus_off(struct net_device *dev);
92 92
93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, 93void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
94 unsigned int idx); 94 unsigned int idx);
95void can_get_echo_skb(struct net_device *dev, unsigned int idx); 95unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
96void can_free_echo_skb(struct net_device *dev, unsigned int idx); 96void can_free_echo_skb(struct net_device *dev, unsigned int idx);
97 97
98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf); 98struct sk_buff *alloc_can_skb(struct net_device *dev, struct can_frame **cf);