Commit 707d79e5 authored by David S. Miller's avatar David S. Miller

Merge tag 'linux-can-next-for-3.20-20150121' of...

Merge tag 'linux-can-next-for-3.20-20150121' of git://git.kernel.org/pub/scm/linux/kernel/git/mkl/linux-can-next

Marc Kleine-Budde says:

====================
pull-request: can-next 2015-21-01

this is a pull request of 4 patches for net-next/master.

Andri Yngvason contributes one patch to further consolidate the CAN
state change handling. The next patch is by kbuild test robot/Fengguang
Wu which fixes a coccinelle warning in the CAN infrastructure. The two
last patches are by me, they remove a unused variable from the flexcan
and at91_can driver.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 4141d93f ef186f25
...@@ -138,7 +138,6 @@ struct at91_devtype_data { ...@@ -138,7 +138,6 @@ struct at91_devtype_data {
struct at91_priv { struct at91_priv {
struct can_priv can; /* must be the first member! */ struct can_priv can; /* must be the first member! */
struct net_device *dev;
struct napi_struct napi; struct napi_struct napi;
void __iomem *reg_base; void __iomem *reg_base;
...@@ -1350,7 +1349,6 @@ static int at91_can_probe(struct platform_device *pdev) ...@@ -1350,7 +1349,6 @@ static int at91_can_probe(struct platform_device *pdev)
priv->can.do_get_berr_counter = at91_get_berr_counter; priv->can.do_get_berr_counter = at91_get_berr_counter;
priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES | priv->can.ctrlmode_supported = CAN_CTRLMODE_3_SAMPLES |
CAN_CTRLMODE_LISTENONLY; CAN_CTRLMODE_LISTENONLY;
priv->dev = dev;
priv->reg_base = addr; priv->reg_base = addr;
priv->devtype_data = *devtype_data; priv->devtype_data = *devtype_data;
priv->clk = clk; priv->clk = clk;
......
...@@ -352,6 +352,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status) ...@@ -352,6 +352,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
netdev_dbg(dev, "bus-off mode interrupt\n"); netdev_dbg(dev, "bus-off mode interrupt\n");
state = CAN_STATE_BUS_OFF; state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
priv->can.can_stats.bus_off++;
can_bus_off(dev); can_bus_off(dev);
} }
......
...@@ -866,7 +866,7 @@ static int c_can_handle_state_change(struct net_device *dev, ...@@ -866,7 +866,7 @@ static int c_can_handle_state_change(struct net_device *dev,
case C_CAN_BUS_OFF: case C_CAN_BUS_OFF:
/* bus-off state */ /* bus-off state */
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
can_bus_off(dev); priv->can.can_stats.bus_off++;
break; break;
default: default:
break; break;
......
...@@ -535,6 +535,7 @@ static int cc770_err(struct net_device *dev, u8 status) ...@@ -535,6 +535,7 @@ static int cc770_err(struct net_device *dev, u8 status)
cc770_write_reg(priv, control, CTRL_INI); cc770_write_reg(priv, control, CTRL_INI);
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
priv->can.can_stats.bus_off++;
can_bus_off(dev); can_bus_off(dev);
} else if (status & STAT_WARN) { } else if (status & STAT_WARN) {
cf->can_id |= CAN_ERR_CRTL; cf->can_id |= CAN_ERR_CRTL;
......
...@@ -289,9 +289,11 @@ static void can_update_state_error_stats(struct net_device *dev, ...@@ -289,9 +289,11 @@ static void can_update_state_error_stats(struct net_device *dev,
priv->can_stats.error_passive++; priv->can_stats.error_passive++;
break; break;
case CAN_STATE_BUS_OFF: case CAN_STATE_BUS_OFF:
priv->can_stats.bus_off++;
break;
default: default:
break; break;
}; }
} }
static int can_tx_state_to_frame(struct net_device *dev, enum can_state state) static int can_tx_state_to_frame(struct net_device *dev, enum can_state state)
...@@ -544,7 +546,6 @@ void can_bus_off(struct net_device *dev) ...@@ -544,7 +546,6 @@ void can_bus_off(struct net_device *dev)
netdev_dbg(dev, "bus-off\n"); netdev_dbg(dev, "bus-off\n");
netif_carrier_off(dev); netif_carrier_off(dev);
priv->can_stats.bus_off++;
if (priv->restart_ms) if (priv->restart_ms)
mod_timer(&priv->restart_timer, mod_timer(&priv->restart_timer,
......
...@@ -247,7 +247,6 @@ struct flexcan_devtype_data { ...@@ -247,7 +247,6 @@ struct flexcan_devtype_data {
struct flexcan_priv { struct flexcan_priv {
struct can_priv can; struct can_priv can;
struct net_device *dev;
struct napi_struct napi; struct napi_struct napi;
void __iomem *base; void __iomem *base;
...@@ -1220,7 +1219,6 @@ static int flexcan_probe(struct platform_device *pdev) ...@@ -1220,7 +1219,6 @@ static int flexcan_probe(struct platform_device *pdev)
CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_3_SAMPLES | CAN_CTRLMODE_LISTENONLY | CAN_CTRLMODE_3_SAMPLES |
CAN_CTRLMODE_BERR_REPORTING; CAN_CTRLMODE_BERR_REPORTING;
priv->base = base; priv->base = base;
priv->dev = dev;
priv->clk_ipg = clk_ipg; priv->clk_ipg = clk_ipg;
priv->clk_per = clk_per; priv->clk_per = clk_per;
priv->pdata = dev_get_platdata(&pdev->dev); priv->pdata = dev_get_platdata(&pdev->dev);
......
...@@ -1008,6 +1008,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg) ...@@ -1008,6 +1008,7 @@ static int ican3_handle_cevtind(struct ican3_dev *mod, struct ican3_msg *msg)
if (status & SR_BS) { if (status & SR_BS) {
state = CAN_STATE_BUS_OFF; state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
mod->can.can_stats.bus_off++;
can_bus_off(dev); can_bus_off(dev);
} else if (status & SR_ES) { } else if (status & SR_ES) {
if (rxerr >= 128 || txerr >= 128) if (rxerr >= 128 || txerr >= 128)
......
...@@ -589,6 +589,7 @@ static int m_can_handle_state_change(struct net_device *dev, ...@@ -589,6 +589,7 @@ static int m_can_handle_state_change(struct net_device *dev,
/* bus-off state */ /* bus-off state */
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
m_can_disable_all_interrupts(priv); m_can_disable_all_interrupts(priv);
priv->can.can_stats.bus_off++;
can_bus_off(dev); can_bus_off(dev);
break; break;
default: default:
......
...@@ -505,6 +505,7 @@ static void pch_can_error(struct net_device *ndev, u32 status) ...@@ -505,6 +505,7 @@ static void pch_can_error(struct net_device *ndev, u32 status)
pch_can_set_rx_all(priv, 0); pch_can_set_rx_all(priv, 0);
state = CAN_STATE_BUS_OFF; state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
priv->can.can_stats.bus_off++;
can_bus_off(ndev); can_bus_off(ndev);
} }
......
...@@ -331,6 +331,7 @@ static void rcar_can_error(struct net_device *ndev) ...@@ -331,6 +331,7 @@ static void rcar_can_error(struct net_device *ndev)
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
/* Clear interrupt condition */ /* Clear interrupt condition */
writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr); writeb(~RCAR_CAN_EIFR_BOEIF, &priv->regs->eifr);
priv->can.can_stats.bus_off++;
can_bus_off(ndev); can_bus_off(ndev);
if (skb) if (skb)
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
......
...@@ -261,6 +261,7 @@ static int softing_handle_1(struct softing *card) ...@@ -261,6 +261,7 @@ static int softing_handle_1(struct softing *card)
++priv->can.can_stats.error_passive; ++priv->can.can_stats.error_passive;
else if (can_state == CAN_STATE_BUS_OFF) { else if (can_state == CAN_STATE_BUS_OFF) {
/* this calls can_close_cleanup() */ /* this calls can_close_cleanup() */
++priv->can.can_stats.bus_off;
can_bus_off(netdev); can_bus_off(netdev);
netif_stop_queue(netdev); netif_stop_queue(netdev);
} }
......
...@@ -905,6 +905,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) ...@@ -905,6 +905,7 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id)
if (priv->can.state == CAN_STATE_BUS_OFF) { if (priv->can.state == CAN_STATE_BUS_OFF) {
if (priv->can.restart_ms == 0) { if (priv->can.restart_ms == 0) {
priv->force_quit = 1; priv->force_quit = 1;
priv->can.can_stats.bus_off++;
can_bus_off(net); can_bus_off(net);
mcp251x_hw_sleep(spi); mcp251x_hw_sleep(spi);
break; break;
......
...@@ -715,6 +715,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status, ...@@ -715,6 +715,7 @@ static int ti_hecc_error(struct net_device *ndev, int int_status,
hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR); hecc_clear_bit(priv, HECC_CANMC, HECC_CANMC_CCR);
/* Disable all interrupts in bus-off to avoid int hog */ /* Disable all interrupts in bus-off to avoid int hog */
hecc_write(priv, HECC_CANGIM, 0); hecc_write(priv, HECC_CANGIM, 0);
++priv->can.can_stats.bus_off;
can_bus_off(ndev); can_bus_off(ndev);
} }
......
...@@ -347,6 +347,7 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg) ...@@ -347,6 +347,7 @@ static void ems_usb_rx_err(struct ems_usb *dev, struct ems_cpc_msg *msg)
dev->can.state = CAN_STATE_BUS_OFF; dev->can.state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
dev->can.can_stats.bus_off++;
can_bus_off(dev->netdev); can_bus_off(dev->netdev);
} else if (state & SJA1000_SR_ES) { } else if (state & SJA1000_SR_ES) {
dev->can.state = CAN_STATE_ERROR_WARNING; dev->can.state = CAN_STATE_ERROR_WARNING;
......
...@@ -250,6 +250,7 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv, ...@@ -250,6 +250,7 @@ static void esd_usb2_rx_event(struct esd_usb2_net_priv *priv,
case ESD_BUSSTATE_BUSOFF: case ESD_BUSSTATE_BUSOFF:
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
priv->can.can_stats.bus_off++;
can_bus_off(priv->netdev); can_bus_off(priv->netdev);
break; break;
case ESD_BUSSTATE_WARN: case ESD_BUSSTATE_WARN:
......
...@@ -488,6 +488,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n, ...@@ -488,6 +488,7 @@ static int pcan_usb_decode_error(struct pcan_usb_msg_context *mc, u8 n,
switch (new_state) { switch (new_state) {
case CAN_STATE_BUS_OFF: case CAN_STATE_BUS_OFF:
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
mc->pdev->dev.can.can_stats.bus_off++;
can_bus_off(mc->netdev); can_bus_off(mc->netdev);
break; break;
......
...@@ -634,6 +634,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if, ...@@ -634,6 +634,7 @@ static int pcan_usb_pro_handle_error(struct pcan_usb_pro_interface *usb_if,
switch (new_state) { switch (new_state) {
case CAN_STATE_BUS_OFF: case CAN_STATE_BUS_OFF:
can_frame->can_id |= CAN_ERR_BUSOFF; can_frame->can_id |= CAN_ERR_BUSOFF;
dev->can.can_stats.bus_off++;
can_bus_off(netdev); can_bus_off(netdev);
break; break;
......
...@@ -377,6 +377,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv, ...@@ -377,6 +377,7 @@ static void usb_8dev_rx_err_msg(struct usb_8dev_priv *priv,
case USB_8DEV_STATUSMSG_BUSOFF: case USB_8DEV_STATUSMSG_BUSOFF:
priv->can.state = CAN_STATE_BUS_OFF; priv->can.state = CAN_STATE_BUS_OFF;
cf->can_id |= CAN_ERR_BUSOFF; cf->can_id |= CAN_ERR_BUSOFF;
priv->can.can_stats.bus_off++;
can_bus_off(priv->netdev); can_bus_off(priv->netdev);
break; break;
case USB_8DEV_STATUSMSG_OVERRUN: case USB_8DEV_STATUSMSG_OVERRUN:
......
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