Skip to content

Commit

Permalink
Merge branch 'master' of git://gitorious.org/linux-can/linux-can-next
Browse files Browse the repository at this point in the history
Conflicts:
	drivers/net/can/usb/ems_usb.c

Minor dev_warn --> netdev_warn conversion conflicts.
  • Loading branch information
David S. Miller committed Feb 4, 2012
2 parents dd48dc3 + aabdfd6 commit d07d4c2
Show file tree
Hide file tree
Showing 14 changed files with 192 additions and 148 deletions.
6 changes: 3 additions & 3 deletions drivers/net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ config CAN_FLEXCAN
Say Y here if you want to support for Freescale FlexCAN.

config PCH_CAN
tristate "PCH CAN"
tristate "Intel EG20T PCH CAN controller"
depends on CAN_DEV && PCI
---help---
This driver is for PCH CAN of Topcliff which is an IOH for x86
embedded processor.
This driver is for PCH CAN of Topcliff (Intel EG20T PCH) which
is an IOH for x86 embedded processor (Intel Atom E6xx series).
This driver can access CAN bus.

source "drivers/net/can/mscan/Kconfig"
Expand Down
36 changes: 23 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 @@ -224,6 +221,20 @@ static int bfin_can_set_mode(struct net_device *dev, enum can_mode mode)
return 0;
}

static int bfin_can_get_berr_counter(const struct net_device *dev,
struct can_berr_counter *bec)
{
struct bfin_can_priv *priv = netdev_priv(dev);
struct bfin_can_regs __iomem *reg = priv->membase;

u16 cec = bfin_read(&reg->cec);

bec->txerr = cec >> 8;
bec->rxerr = cec;

return 0;
}

static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct bfin_can_priv *priv = netdev_priv(dev);
Expand Down Expand Up @@ -331,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 @@ -509,6 +519,7 @@ struct net_device *alloc_bfin_candev(void)
priv->can.bittiming_const = &bfin_can_bittiming_const;
priv->can.do_set_bittiming = bfin_can_set_bittiming;
priv->can.do_set_mode = bfin_can_set_mode;
priv->can.do_get_berr_counter = bfin_can_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES;

return dev;
Expand Down Expand Up @@ -636,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
33 changes: 20 additions & 13 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 All @@ -327,16 +326,24 @@ EXPORT_SYMBOL_GPL(can_put_echo_skb);
* is handled in the device driver. The driver must protect
* access to priv->echo_skb, if necessary.
*/
void can_get_echo_skb(struct net_device *dev, unsigned int idx)
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx)
{
struct can_priv *priv = netdev_priv(dev);

BUG_ON(idx >= priv->echo_skb_max);

if (priv->echo_skb[idx]) {
struct sk_buff *skb = priv->echo_skb[idx];
struct can_frame *cf = (struct can_frame *)skb->data;
u8 dlc = cf->can_dlc;

netif_rx(priv->echo_skb[idx]);
priv->echo_skb[idx] = NULL;

return dlc;
}

return 0;
}
EXPORT_SYMBOL_GPL(can_get_echo_skb);

Expand Down Expand Up @@ -392,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 @@ -433,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 @@ -545,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
Loading

0 comments on commit d07d4c2

Please sign in to comment.