The netdev trigger is suitable to do everything that the can trigger can do. So drop the latter. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- Note I don't have a setup where I could test my claim, so confirmation by someone who can would be awesome. drivers/net/can/Kconfig | 11 -- drivers/net/can/Makefile | 2 - drivers/net/can/at91_can.c | 10 -- drivers/net/can/c_can/c_can.c | 11 -- drivers/net/can/dev.c | 5 - drivers/net/can/flexcan.c | 8 -- drivers/net/can/ifi_canfd/ifi_canfd.c | 9 -- drivers/net/can/led.c | 143 -------------------------- drivers/net/can/m_can/m_can.c | 9 -- drivers/net/can/rcar/rcar_can.c | 8 -- drivers/net/can/rcar/rcar_canfd.c | 7 -- drivers/net/can/rx-offload.c | 2 - drivers/net/can/sja1000/sja1000.c | 15 +-- drivers/net/can/spi/hi311x.c | 8 -- drivers/net/can/spi/mcp251x.c | 10 -- drivers/net/can/sun4i_can.c | 7 -- drivers/net/can/ti_hecc.c | 9 -- drivers/net/can/usb/mcba_usb.c | 7 -- drivers/net/can/usb/usb_8dev.c | 11 -- drivers/net/can/xilinx_can.c | 9 -- include/linux/can/dev.h | 10 -- include/linux/can/led.h | 54 ---------- 22 files changed, 1 insertion(+), 364 deletions(-) delete mode 100644 drivers/net/can/led.c delete mode 100644 include/linux/can/led.h diff --git a/drivers/net/can/Kconfig b/drivers/net/can/Kconfig index 2cb75988b328..fec311ffdbc2 100644 --- a/drivers/net/can/Kconfig +++ b/drivers/net/can/Kconfig @@ -70,17 +70,6 @@ config CAN_CALC_BITTIMING arguments "tq", "prop_seg", "phase_seg1", "phase_seg2" and "sjw". If unsure, say Y. -config CAN_LEDS - bool "Enable LED triggers for Netlink based drivers" - depends on LEDS_CLASS - select LEDS_TRIGGERS - ---help--- - This option adds two LED triggers for packet receive and transmit - events on each supported CAN device. - - Say Y here if you are working on a system with led-class supported - LEDs and you want to use them as canbus activity indicators. - config CAN_AT91 tristate "Atmel AT91 onchip CAN controller" depends on (ARCH_AT91 || COMPILE_TEST) && HAS_IOMEM diff --git a/drivers/net/can/Makefile b/drivers/net/can/Makefile index 44922bf29b6a..f0545b53230c 100644 --- a/drivers/net/can/Makefile +++ b/drivers/net/can/Makefile @@ -11,8 +11,6 @@ obj-$(CONFIG_CAN_DEV) += can-dev.o can-dev-y += dev.o can-dev-y += rx-offload.o -can-dev-$(CONFIG_CAN_LEDS) += led.o - obj-y += rcar/ obj-y += spi/ obj-y += usb/ diff --git a/drivers/net/can/at91_can.c b/drivers/net/can/at91_can.c index d98c69045b17..42fb36686fb3 100644 --- a/drivers/net/can/at91_can.c +++ b/drivers/net/can/at91_can.c @@ -27,7 +27,6 @@ #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #define AT91_MB_MASK(i) ((1 << (i)) - 1) @@ -625,8 +624,6 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb) stats->rx_packets++; stats->rx_bytes += cf->can_dlc; netif_receive_skb(skb); - - can_led_event(dev, CAN_LED_EVENT_RX); } /** @@ -862,7 +859,6 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr) /* _NOTE_: subtract AT91_MB_TX_FIRST offset from mb! */ can_get_echo_skb(dev, mb - get_mb_tx_first(priv)); dev->stats.tx_packets++; - can_led_event(dev, CAN_LED_EVENT_TX); } } @@ -1118,8 +1114,6 @@ static int at91_open(struct net_device *dev) goto out_close; } - can_led_event(dev, CAN_LED_EVENT_OPEN); - /* start chip and queuing */ at91_chip_start(dev); napi_enable(&priv->napi); @@ -1151,8 +1145,6 @@ static int at91_close(struct net_device *dev) close_candev(dev); - can_led_event(dev, CAN_LED_EVENT_STOP); - return 0; } @@ -1348,8 +1340,6 @@ static int at91_can_probe(struct platform_device *pdev) goto exit_free; } - devm_can_led_init(dev); - dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n", priv->reg_base, dev->irq); diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c index 606b7d8ffe13..f1d5a9d76df5 100644 --- a/drivers/net/can/c_can/c_can.c +++ b/drivers/net/can/c_can/c_can.c @@ -40,7 +40,6 @@ #include <linux/can.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include "c_can.h" @@ -727,7 +726,6 @@ static void c_can_do_tx(struct net_device *dev) if (pkts) { stats->tx_bytes += bytes; stats->tx_packets += pkts; - can_led_event(dev, CAN_LED_EVENT_TX); } } @@ -868,9 +866,6 @@ static int c_can_do_rx_poll(struct net_device *dev, int quota) quota -= n; } - if (pkts) - can_led_event(dev, CAN_LED_EVENT_RX); - return pkts; } @@ -1122,8 +1117,6 @@ static int c_can_open(struct net_device *dev) if (err) goto exit_start_fail; - can_led_event(dev, CAN_LED_EVENT_OPEN); - napi_enable(&priv->napi); /* enable status change, error and module interrupts */ c_can_irq_control(priv, true); @@ -1154,8 +1147,6 @@ static int c_can_close(struct net_device *dev) c_can_reset_ram(priv, false); c_can_pm_runtime_put_sync(priv); - can_led_event(dev, CAN_LED_EVENT_STOP); - return 0; } @@ -1295,8 +1286,6 @@ int register_c_can_dev(struct net_device *dev) err = register_candev(dev); if (err) c_can_pm_runtime_disable(priv); - else - devm_can_led_init(dev); return err; } diff --git a/drivers/net/can/dev.c b/drivers/net/can/dev.c index 3c71f1cb205f..b46baae05e5d 100644 --- a/drivers/net/can/dev.c +++ b/drivers/net/can/dev.c @@ -26,7 +26,6 @@ #include <linux/can/dev.h> #include <linux/can/skb.h> #include <linux/can/netlink.h> -#include <linux/can/led.h> #include <linux/of.h> #include <net/rtnetlink.h> @@ -1269,8 +1268,6 @@ static __init int can_dev_init(void) { int err; - can_led_notifier_init(); - err = rtnl_link_register(&can_link_ops); if (!err) printk(KERN_INFO MOD_DESC "\n"); @@ -1282,8 +1279,6 @@ module_init(can_dev_init); static __exit void can_dev_exit(void) { rtnl_link_unregister(&can_link_ops); - - can_led_notifier_exit(); } module_exit(can_dev_exit); diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c index d53a45bf2a72..6531ba99439f 100644 --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -24,7 +24,6 @@ #include <linux/can.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include <linux/can/rx-offload.h> #include <linux/clk.h> #include <linux/delay.h> @@ -795,7 +794,6 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id) handled = IRQ_HANDLED; stats->tx_bytes += can_get_echo_skb(dev, 0); stats->tx_packets++; - can_led_event(dev, CAN_LED_EVENT_TX); /* after sending a RTR frame MB is in RX mode */ priv->write(FLEXCAN_MB_CODE_TX_INACTIVE, @@ -1128,8 +1126,6 @@ static int flexcan_open(struct net_device *dev) if (err) goto out_free_irq; - can_led_event(dev, CAN_LED_EVENT_OPEN); - can_rx_offload_enable(&priv->offload); netif_start_queue(dev); @@ -1161,8 +1157,6 @@ static int flexcan_close(struct net_device *dev) close_candev(dev); - can_led_event(dev, CAN_LED_EVENT_STOP); - return 0; } @@ -1405,8 +1399,6 @@ static int flexcan_probe(struct platform_device *pdev) goto failed_register; } - devm_can_led_init(dev); - dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%d)\n", priv->regs, dev->irq); diff --git a/drivers/net/can/ifi_canfd/ifi_canfd.c b/drivers/net/can/ifi_canfd/ifi_canfd.c index fedd927ba6ed..9bdd24035b78 100644 --- a/drivers/net/can/ifi_canfd/ifi_canfd.c +++ b/drivers/net/can/ifi_canfd/ifi_canfd.c @@ -345,9 +345,6 @@ static int ifi_canfd_do_rx_poll(struct net_device *ndev, int quota) rxst = readl(priv->base + IFI_CANFD_RXSTCMD); } - if (pkts) - can_led_event(ndev, CAN_LED_EVENT_RX); - return pkts; } @@ -631,7 +628,6 @@ static irqreturn_t ifi_canfd_isr(int irq, void *dev_id) if (isr & IFI_CANFD_INTERRUPT_TXFIFO_REMOVE) { stats->tx_bytes += can_get_echo_skb(ndev, 0); stats->tx_packets++; - can_led_event(ndev, CAN_LED_EVENT_TX); } if (isr & tx_irq_mask) @@ -835,7 +831,6 @@ static int ifi_canfd_open(struct net_device *ndev) ifi_canfd_start(ndev); - can_led_event(ndev, CAN_LED_EVENT_OPEN); napi_enable(&priv->napi); netif_start_queue(ndev); @@ -858,8 +853,6 @@ static int ifi_canfd_close(struct net_device *ndev) close_candev(ndev); - can_led_event(ndev, CAN_LED_EVENT_STOP); - return 0; } @@ -1008,8 +1001,6 @@ static int ifi_canfd_plat_probe(struct platform_device *pdev) goto err_reg; } - devm_can_led_init(ndev); - dev_info(dev, "Driver registered: regs=%p, irq=%d, clock=%d\n", priv->base, ndev->irq, priv->can.clock.freq); diff --git a/drivers/net/can/led.c b/drivers/net/can/led.c deleted file mode 100644 index c1b667675fa1..000000000000 --- a/drivers/net/can/led.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2012, Fabio Baltieri <fabio.baltieri@xxxxxxxxx> - * Copyright 2012, Kurt Van Dijck <kurt.van.dijck@xxxxxx> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#include <linux/module.h> -#include <linux/device.h> -#include <linux/kernel.h> -#include <linux/slab.h> -#include <linux/netdevice.h> -#include <linux/can/dev.h> - -#include <linux/can/led.h> - -static unsigned long led_delay = 50; -module_param(led_delay, ulong, 0644); -MODULE_PARM_DESC(led_delay, - "blink delay time for activity leds (msecs, default: 50)."); - -/* Trigger a LED event in response to a CAN device event */ -void can_led_event(struct net_device *netdev, enum can_led_event event) -{ - struct can_priv *priv = netdev_priv(netdev); - - switch (event) { - case CAN_LED_EVENT_OPEN: - led_trigger_event(priv->tx_led_trig, LED_FULL); - led_trigger_event(priv->rx_led_trig, LED_FULL); - led_trigger_event(priv->rxtx_led_trig, LED_FULL); - break; - case CAN_LED_EVENT_STOP: - led_trigger_event(priv->tx_led_trig, LED_OFF); - led_trigger_event(priv->rx_led_trig, LED_OFF); - led_trigger_event(priv->rxtx_led_trig, LED_OFF); - break; - case CAN_LED_EVENT_TX: - if (led_delay) { - led_trigger_blink_oneshot(priv->tx_led_trig, - &led_delay, &led_delay, 1); - led_trigger_blink_oneshot(priv->rxtx_led_trig, - &led_delay, &led_delay, 1); - } - break; - case CAN_LED_EVENT_RX: - if (led_delay) { - led_trigger_blink_oneshot(priv->rx_led_trig, - &led_delay, &led_delay, 1); - led_trigger_blink_oneshot(priv->rxtx_led_trig, - &led_delay, &led_delay, 1); - } - break; - } -} -EXPORT_SYMBOL_GPL(can_led_event); - -static void can_led_release(struct device *gendev, void *res) -{ - struct can_priv *priv = netdev_priv(to_net_dev(gendev)); - - led_trigger_unregister_simple(priv->tx_led_trig); - led_trigger_unregister_simple(priv->rx_led_trig); - led_trigger_unregister_simple(priv->rxtx_led_trig); -} - -/* Register CAN LED triggers for a CAN device - * - * This is normally called from a driver's probe function - */ -void devm_can_led_init(struct net_device *netdev) -{ - struct can_priv *priv = netdev_priv(netdev); - void *res; - - res = devres_alloc(can_led_release, 0, GFP_KERNEL); - if (!res) { - netdev_err(netdev, "cannot register LED triggers\n"); - return; - } - - snprintf(priv->tx_led_trig_name, sizeof(priv->tx_led_trig_name), - "%s-tx", netdev->name); - snprintf(priv->rx_led_trig_name, sizeof(priv->rx_led_trig_name), - "%s-rx", netdev->name); - snprintf(priv->rxtx_led_trig_name, sizeof(priv->rxtx_led_trig_name), - "%s-rxtx", netdev->name); - - led_trigger_register_simple(priv->tx_led_trig_name, - &priv->tx_led_trig); - led_trigger_register_simple(priv->rx_led_trig_name, - &priv->rx_led_trig); - led_trigger_register_simple(priv->rxtx_led_trig_name, - &priv->rxtx_led_trig); - - devres_add(&netdev->dev, res); -} -EXPORT_SYMBOL_GPL(devm_can_led_init); - -/* NETDEV rename notifier to rename the associated led triggers too */ -static int can_led_notifier(struct notifier_block *nb, unsigned long msg, - void *ptr) -{ - struct net_device *netdev = netdev_notifier_info_to_dev(ptr); - struct can_priv *priv = safe_candev_priv(netdev); - char name[CAN_LED_NAME_SZ]; - - if (!priv) - return NOTIFY_DONE; - - if (!priv->tx_led_trig || !priv->rx_led_trig || !priv->rxtx_led_trig) - return NOTIFY_DONE; - - if (msg == NETDEV_CHANGENAME) { - snprintf(name, sizeof(name), "%s-tx", netdev->name); - led_trigger_rename_static(name, priv->tx_led_trig); - - snprintf(name, sizeof(name), "%s-rx", netdev->name); - led_trigger_rename_static(name, priv->rx_led_trig); - - snprintf(name, sizeof(name), "%s-rxtx", netdev->name); - led_trigger_rename_static(name, priv->rxtx_led_trig); - } - - return NOTIFY_DONE; -} - -/* notifier block for netdevice event */ -static struct notifier_block can_netdev_notifier __read_mostly = { - .notifier_call = can_led_notifier, -}; - -int __init can_led_notifier_init(void) -{ - return register_netdevice_notifier(&can_netdev_notifier); -} - -void __exit can_led_notifier_exit(void) -{ - unregister_netdevice_notifier(&can_netdev_notifier); -} diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c index b397a33f3d32..11f54fb7f114 100644 --- a/drivers/net/can/m_can/m_can.c +++ b/drivers/net/can/m_can/m_can.c @@ -530,9 +530,6 @@ static int m_can_do_rx_poll(struct net_device *dev, int quota) rxfs = m_can_read(priv, M_CAN_RXF0S); } - if (pkts) - can_led_event(dev, CAN_LED_EVENT_RX); - return pkts; } @@ -908,14 +905,12 @@ static irqreturn_t m_can_isr(int irq, void *dev_id) /* Transmission Complete Interrupt*/ stats->tx_bytes += can_get_echo_skb(dev, 0); stats->tx_packets++; - can_led_event(dev, CAN_LED_EVENT_TX); netif_wake_queue(dev); } } else { if (ir & IR_TEFN) { /* New TX FIFO Element arrived */ m_can_echo_tx_event(dev); - can_led_event(dev, CAN_LED_EVENT_TX); if (netif_queue_stopped(dev) && !m_can_tx_fifo_full(priv)) netif_wake_queue(dev); @@ -1329,7 +1324,6 @@ static int m_can_open(struct net_device *dev) /* start the m_can controller */ m_can_start(dev); - can_led_event(dev, CAN_LED_EVENT_OPEN); napi_enable(&priv->napi); netif_start_queue(dev); @@ -1363,7 +1357,6 @@ static int m_can_close(struct net_device *dev) m_can_clk_stop(priv); free_irq(dev->irq, dev); close_candev(dev); - can_led_event(dev, CAN_LED_EVENT_STOP); return 0; } @@ -1666,8 +1659,6 @@ static int m_can_plat_probe(struct platform_device *pdev) goto clk_disable; } - devm_can_led_init(dev); - of_can_transceiver(dev); dev_info(&pdev->dev, "%s device registered (irq=%d, version=%d)\n", diff --git a/drivers/net/can/rcar/rcar_can.c b/drivers/net/can/rcar/rcar_can.c index 11662f479e76..1dc3ad3ad173 100644 --- a/drivers/net/can/rcar/rcar_can.c +++ b/drivers/net/can/rcar/rcar_can.c @@ -16,7 +16,6 @@ #include <linux/errno.h> #include <linux/netdevice.h> #include <linux/platform_device.h> -#include <linux/can/led.h> #include <linux/can/dev.h> #include <linux/clk.h> #include <linux/can/platform/rcar_can.h> @@ -388,7 +387,6 @@ static void rcar_can_tx_done(struct net_device *ndev) /* Clear interrupt */ isr = readb(&priv->regs->isr); writeb(isr & ~RCAR_CAN_ISR_TXFF, &priv->regs->isr); - can_led_event(ndev, CAN_LED_EVENT_TX); } static irqreturn_t rcar_can_interrupt(int irq, void *dev_id) @@ -530,7 +528,6 @@ static int rcar_can_open(struct net_device *ndev) ndev->irq, err); goto out_close; } - can_led_event(ndev, CAN_LED_EVENT_OPEN); rcar_can_start(ndev); netif_start_queue(ndev); return 0; @@ -580,7 +577,6 @@ static int rcar_can_close(struct net_device *ndev) clk_disable_unprepare(priv->can_clk); clk_disable_unprepare(priv->clk); close_candev(ndev); - can_led_event(ndev, CAN_LED_EVENT_STOP); return 0; } @@ -663,8 +659,6 @@ static void rcar_can_rx_pkt(struct rcar_can_priv *priv) readb(&priv->regs->mb[RCAR_CAN_RX_FIFO_MBX].data[dlc]); } - can_led_event(priv->ndev, CAN_LED_EVENT_RX); - stats->rx_bytes += cf->can_dlc; stats->rx_packets++; netif_receive_skb(skb); @@ -824,8 +818,6 @@ static int rcar_can_probe(struct platform_device *pdev) goto fail_candev; } - devm_can_led_init(ndev); - dev_info(&pdev->dev, "device registered (IRQ%d)\n", ndev->irq); return 0; diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c index 602c19e23f05..45e3b79d6ad1 100644 --- a/drivers/net/can/rcar/rcar_canfd.c +++ b/drivers/net/can/rcar/rcar_canfd.c @@ -33,7 +33,6 @@ #include <linux/errno.h> #include <linux/netdevice.h> #include <linux/platform_device.h> -#include <linux/can/led.h> #include <linux/can/dev.h> #include <linux/clk.h> #include <linux/of.h> @@ -1071,7 +1070,6 @@ static void rcar_canfd_tx_done(struct net_device *ndev) /* Clear interrupt */ rcar_canfd_write(priv->base, RCANFD_CFSTS(ch, RCANFD_CFFIFO_IDX), sts & ~RCANFD_CFSTS_CFTXIF); - can_led_event(ndev, CAN_LED_EVENT_TX); } static irqreturn_t rcar_canfd_global_interrupt(int irq, void *dev_id) @@ -1286,7 +1284,6 @@ static int rcar_canfd_open(struct net_device *ndev) if (err) goto out_close; netif_start_queue(ndev); - can_led_event(ndev, CAN_LED_EVENT_OPEN); return 0; out_close: napi_disable(&priv->napi); @@ -1335,7 +1332,6 @@ static int rcar_canfd_close(struct net_device *ndev) napi_disable(&priv->napi); clk_disable_unprepare(gpriv->can_clk); close_candev(ndev); - can_led_event(ndev, CAN_LED_EVENT_STOP); return 0; } @@ -1480,8 +1476,6 @@ static void rcar_canfd_rx_pkt(struct rcar_canfd_channel *priv) */ rcar_canfd_write(priv->base, RCANFD_RFPCTR(ridx), 0xff); - can_led_event(priv->ndev, CAN_LED_EVENT_RX); - stats->rx_bytes += cf->len; stats->rx_packets++; netif_receive_skb(skb); @@ -1608,7 +1602,6 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch, goto fail_candev; } spin_lock_init(&priv->tx_lock); - devm_can_led_init(ndev); gpriv->ch[priv->channel] = priv; dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel); return 0; diff --git a/drivers/net/can/rx-offload.c b/drivers/net/can/rx-offload.c index d94dae216820..f266b1168214 100644 --- a/drivers/net/can/rx-offload.c +++ b/drivers/net/can/rx-offload.c @@ -71,8 +71,6 @@ static int can_rx_offload_napi_poll(struct napi_struct *napi, int quota) napi_reschedule(&offload->napi); } - can_led_event(offload->dev, CAN_LED_EVENT_RX); - return work_done; } diff --git a/drivers/net/can/sja1000/sja1000.c b/drivers/net/can/sja1000/sja1000.c index 9f107798f904..b8430b6fc17d 100644 --- a/drivers/net/can/sja1000/sja1000.c +++ b/drivers/net/can/sja1000/sja1000.c @@ -60,7 +60,6 @@ #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include "sja1000.h" @@ -383,8 +382,6 @@ static void sja1000_rx(struct net_device *dev) stats->rx_packets++; stats->rx_bytes += cf->can_dlc; netif_rx(skb); - - can_led_event(dev, CAN_LED_EVENT_RX); } static int sja1000_err(struct net_device *dev, uint8_t isrc, uint8_t status) @@ -536,7 +533,6 @@ irqreturn_t sja1000_interrupt(int irq, void *dev_id) can_get_echo_skb(dev, 0); } netif_wake_queue(dev); - can_led_event(dev, CAN_LED_EVENT_TX); } if (isrc & IRQ_RI) { /* receive interrupt */ @@ -592,8 +588,6 @@ static int sja1000_open(struct net_device *dev) /* init and start chi */ sja1000_start(dev); - can_led_event(dev, CAN_LED_EVENT_OPEN); - netif_start_queue(dev); return 0; @@ -611,8 +605,6 @@ static int sja1000_close(struct net_device *dev) close_candev(dev); - can_led_event(dev, CAN_LED_EVENT_STOP); - return 0; } @@ -675,12 +667,7 @@ int register_sja1000dev(struct net_device *dev) set_reset_mode(dev); chipset_init(dev); - ret = register_candev(dev); - - if (!ret) - devm_can_led_init(dev); - - return ret; + return register_candev(dev); } EXPORT_SYMBOL_GPL(register_sja1000dev); diff --git a/drivers/net/can/spi/hi311x.c b/drivers/net/can/spi/hi311x.c index 53e320c92a8b..2be0e6092250 100644 --- a/drivers/net/can/spi/hi311x.c +++ b/drivers/net/can/spi/hi311x.c @@ -19,7 +19,6 @@ #include <linux/can/core.h> #include <linux/can/dev.h> -#include <linux/can/led.h> #include <linux/clk.h> #include <linux/completion.h> #include <linux/delay.h> @@ -370,8 +369,6 @@ static void hi3110_hw_rx(struct spi_device *spi) priv->net->stats.rx_packets++; priv->net->stats.rx_bytes += frame->can_dlc; - can_led_event(priv->net, CAN_LED_EVENT_RX); - netif_rx_ni(skb); } @@ -583,8 +580,6 @@ static int hi3110_stop(struct net_device *net) mutex_unlock(&priv->hi3110_lock); - can_led_event(net, CAN_LED_EVENT_STOP); - return 0; } @@ -741,7 +736,6 @@ static irqreturn_t hi3110_can_ist(int irq, void *dev_id) if (priv->tx_len && statf & HI3110_STAT_TXMTY) { net->stats.tx_packets++; net->stats.tx_bytes += priv->tx_len - 1; - can_led_event(net, CAN_LED_EVENT_TX); if (priv->tx_len) { can_get_echo_skb(net, 0); priv->tx_len = 0; @@ -802,7 +796,6 @@ static int hi3110_open(struct net_device *net) if (ret) goto out_free_wq; - can_led_event(net, CAN_LED_EVENT_OPEN); netif_wake_queue(net); mutex_unlock(&priv->hi3110_lock); @@ -972,7 +965,6 @@ static int hi3110_can_probe(struct spi_device *spi) if (ret) goto error_probe; - devm_can_led_init(net); netdev_info(net, "%x successfully initialized.\n", priv->model); return 0; diff --git a/drivers/net/can/spi/mcp251x.c b/drivers/net/can/spi/mcp251x.c index e90817608645..d12be2c2ea0c 100644 --- a/drivers/net/can/spi/mcp251x.c +++ b/drivers/net/can/spi/mcp251x.c @@ -56,7 +56,6 @@ #include <linux/can/core.h> #include <linux/can/dev.h> -#include <linux/can/led.h> #include <linux/can/platform/mcp251x.h> #include <linux/clk.h> #include <linux/completion.h> @@ -502,8 +501,6 @@ static void mcp251x_hw_rx(struct spi_device *spi, int buf_idx) priv->net->stats.rx_packets++; priv->net->stats.rx_bytes += frame->can_dlc; - can_led_event(priv->net, CAN_LED_EVENT_RX); - netif_rx_ni(skb); } @@ -718,8 +715,6 @@ static int mcp251x_stop(struct net_device *net) mutex_unlock(&priv->mcp_lock); - can_led_event(net, CAN_LED_EVENT_STOP); - return 0; } @@ -918,7 +913,6 @@ static irqreturn_t mcp251x_can_ist(int irq, void *dev_id) if (intf & CANINTF_TX) { net->stats.tx_packets++; net->stats.tx_bytes += priv->tx_len - 1; - can_led_event(net, CAN_LED_EVENT_TX); if (priv->tx_len) { can_get_echo_skb(net, 0); priv->tx_len = 0; @@ -981,8 +975,6 @@ static int mcp251x_open(struct net_device *net) goto open_unlock; } - can_led_event(net, CAN_LED_EVENT_OPEN); - netif_wake_queue(net); open_unlock: @@ -1156,8 +1148,6 @@ static int mcp251x_can_probe(struct spi_device *spi) if (ret) goto error_probe; - devm_can_led_init(net); - netdev_info(net, "MCP%x successfully initialized.\n", priv->model); return 0; diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c index 1ac2090a1721..8da47b99a15c 100644 --- a/drivers/net/can/sun4i_can.c +++ b/drivers/net/can/sun4i_can.c @@ -51,7 +51,6 @@ #include <linux/can.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include <linux/clk.h> #include <linux/delay.h> #include <linux/interrupt.h> @@ -503,8 +502,6 @@ static void sun4i_can_rx(struct net_device *dev) stats->rx_packets++; stats->rx_bytes += cf->can_dlc; netif_rx(skb); - - can_led_event(dev, CAN_LED_EVENT_RX); } static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status) @@ -658,7 +655,6 @@ static irqreturn_t sun4i_can_interrupt(int irq, void *dev_id) stats->tx_packets++; can_get_echo_skb(dev, 0); netif_wake_queue(dev); - can_led_event(dev, CAN_LED_EVENT_TX); } if ((isrc & SUN4I_INT_RBUF_VLD) && !(isrc & SUN4I_INT_DATA_OR)) { @@ -716,7 +712,6 @@ static int sun4ican_open(struct net_device *dev) goto exit_can_start; } - can_led_event(dev, CAN_LED_EVENT_OPEN); netif_start_queue(dev); return 0; @@ -740,7 +735,6 @@ static int sun4ican_close(struct net_device *dev) free_irq(dev->irq, dev); close_candev(dev); - can_led_event(dev, CAN_LED_EVENT_STOP); return 0; } @@ -833,7 +827,6 @@ static int sun4ican_probe(struct platform_device *pdev) DRV_NAME, err); goto exit_free; } - devm_can_led_init(dev); dev_info(&pdev->dev, "device registered (base=%p, irq=%d)\n", priv->base, dev->irq); diff --git a/drivers/net/can/ti_hecc.c b/drivers/net/can/ti_hecc.c index db6ea936dc3f..5c3e261cf62a 100644 --- a/drivers/net/can/ti_hecc.c +++ b/drivers/net/can/ti_hecc.c @@ -33,7 +33,6 @@ #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #define DRV_NAME "ti_hecc" #define HECC_MODULE_VERSION "0.7" @@ -567,7 +566,6 @@ static int ti_hecc_rx_pkt(struct ti_hecc_priv *priv, int mbxno) spin_unlock_irqrestore(&priv->mbx_lock, flags); stats->rx_bytes += cf->can_dlc; - can_led_event(priv->ndev, CAN_LED_EVENT_RX); netif_receive_skb(skb); stats->rx_packets++; @@ -772,7 +770,6 @@ static irqreturn_t ti_hecc_interrupt(int irq, void *dev_id) stats->tx_bytes += hecc_read_mbx(priv, mbxno, HECC_CANMCF) & 0xF; stats->tx_packets++; - can_led_event(ndev, CAN_LED_EVENT_TX); can_get_echo_skb(ndev, mbxno); --priv->tx_tail; } @@ -828,8 +825,6 @@ static int ti_hecc_open(struct net_device *ndev) return err; } - can_led_event(ndev, CAN_LED_EVENT_OPEN); - ti_hecc_start(ndev); napi_enable(&priv->napi); netif_start_queue(ndev); @@ -848,8 +843,6 @@ static int ti_hecc_close(struct net_device *ndev) close_candev(ndev); ti_hecc_transceiver_switch(priv, 0); - can_led_event(ndev, CAN_LED_EVENT_STOP); - return 0; } @@ -977,8 +970,6 @@ static int ti_hecc_probe(struct platform_device *pdev) goto probe_exit_clk; } - devm_can_led_init(ndev); - dev_info(&pdev->dev, "device registered (reg_base=%p, irq=%u)\n", priv->base, (u32) ndev->irq); diff --git a/drivers/net/can/usb/mcba_usb.c b/drivers/net/can/usb/mcba_usb.c index 8d8c2086424d..5d8a1d66f048 100644 --- a/drivers/net/can/usb/mcba_usb.c +++ b/drivers/net/can/usb/mcba_usb.c @@ -21,7 +21,6 @@ #include <linux/can.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include <linux/module.h> #include <linux/netdevice.h> #include <linux/signal.h> @@ -247,7 +246,6 @@ static void mcba_usb_write_bulk_callback(struct urb *urb) netdev->stats.tx_packets++; netdev->stats.tx_bytes += ctx->dlc; - can_led_event(netdev, CAN_LED_EVENT_TX); can_get_echo_skb(netdev, ctx->ndx); } @@ -469,7 +467,6 @@ static void mcba_usb_process_can(struct mcba_priv *priv, stats->rx_packets++; stats->rx_bytes += cf->can_dlc; - can_led_event(priv->netdev, CAN_LED_EVENT_RX); netif_rx(skb); } @@ -711,7 +708,6 @@ static int mcba_usb_open(struct net_device *netdev) priv->can_speed_check = true; priv->can.state = CAN_STATE_ERROR_ACTIVE; - can_led_event(netdev, CAN_LED_EVENT_OPEN); netif_start_queue(netdev); return 0; @@ -736,7 +732,6 @@ static int mcba_usb_close(struct net_device *netdev) mcba_urb_unlink(priv); close_candev(netdev); - can_led_event(netdev, CAN_LED_EVENT_STOP); return 0; } @@ -851,8 +846,6 @@ static int mcba_usb_probe(struct usb_interface *intf, goto cleanup_free_candev; } - devm_can_led_init(netdev); - /* Start USB dev only if we have successfully registered CAN device */ err = mcba_usb_start(priv); if (err) { diff --git a/drivers/net/can/usb/usb_8dev.c b/drivers/net/can/usb/usb_8dev.c index 27861c417c94..39fe1807e709 100644 --- a/drivers/net/can/usb/usb_8dev.c +++ b/drivers/net/can/usb/usb_8dev.c @@ -32,7 +32,6 @@ #include <linux/can.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> /* driver constants */ #define MAX_RX_URBS 20 @@ -494,8 +493,6 @@ static void usb_8dev_rx_can_msg(struct usb_8dev_priv *priv, stats->rx_packets++; stats->rx_bytes += cf->can_dlc; netif_rx(skb); - - can_led_event(priv->netdev, CAN_LED_EVENT_RX); } else { netdev_warn(priv->netdev, "frame type %d unknown", msg->type); @@ -598,8 +595,6 @@ static void usb_8dev_write_bulk_callback(struct urb *urb) can_get_echo_skb(netdev, context->echo_index); - can_led_event(netdev, CAN_LED_EVENT_TX); - /* Release context */ context->echo_index = MAX_TX_URBS; @@ -820,8 +815,6 @@ static int usb_8dev_open(struct net_device *netdev) if (err) return err; - can_led_event(netdev, CAN_LED_EVENT_OPEN); - /* finally start device */ err = usb_8dev_start(priv); if (err) { @@ -874,8 +867,6 @@ static int usb_8dev_close(struct net_device *netdev) close_candev(netdev); - can_led_event(netdev, CAN_LED_EVENT_STOP); - return err; } @@ -982,8 +973,6 @@ static int usb_8dev_probe(struct usb_interface *intf, (version>>8) & 0xff, version & 0xff); } - devm_can_led_init(netdev); - return 0; cleanup_unregister_candev: diff --git a/drivers/net/can/xilinx_can.c b/drivers/net/can/xilinx_can.c index 89aec07c225f..04ed394815bd 100644 --- a/drivers/net/can/xilinx_can.c +++ b/drivers/net/can/xilinx_can.c @@ -31,7 +31,6 @@ #include <linux/types.h> #include <linux/can/dev.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include <linux/pm_runtime.h> #define DRIVER_NAME "xilinx_can" @@ -722,9 +721,6 @@ static int xcan_rx_poll(struct napi_struct *napi, int quota) isr = priv->read_reg(priv, XCAN_ISR_OFFSET); } - if (work_done) - can_led_event(ndev, CAN_LED_EVENT_RX); - if (work_done < quota) { napi_complete_done(napi, work_done); ier = priv->read_reg(priv, XCAN_IER_OFFSET); @@ -753,7 +749,6 @@ static void xcan_tx_interrupt(struct net_device *ndev, u32 isr) stats->tx_packets++; isr = priv->read_reg(priv, XCAN_ISR_OFFSET); } - can_led_event(ndev, CAN_LED_EVENT_TX); netif_wake_queue(ndev); } @@ -873,7 +868,6 @@ static int xcan_open(struct net_device *ndev) goto err_candev; } - can_led_event(ndev, CAN_LED_EVENT_OPEN); napi_enable(&priv->napi); netif_start_queue(ndev); @@ -905,7 +899,6 @@ static int xcan_close(struct net_device *ndev) free_irq(ndev->irq, ndev); close_candev(ndev); - can_led_event(ndev, CAN_LED_EVENT_STOP); pm_runtime_put(priv->dev); return 0; @@ -1168,8 +1161,6 @@ static int xcan_probe(struct platform_device *pdev) goto err_disableclks; } - devm_can_led_init(ndev); - pm_runtime_put(&pdev->dev); netdev_dbg(ndev, "reg_base=0x%p irq=%d clock=%d, tx fifo depth:%d\n", diff --git a/include/linux/can/dev.h b/include/linux/can/dev.h index 055aaf5ed9af..057c73c72caa 100644 --- a/include/linux/can/dev.h +++ b/include/linux/can/dev.h @@ -16,7 +16,6 @@ #include <linux/can.h> #include <linux/can/error.h> -#include <linux/can/led.h> #include <linux/can/netlink.h> #include <linux/netdevice.h> @@ -70,15 +69,6 @@ struct can_priv { unsigned int echo_skb_max; struct sk_buff **echo_skb; - -#ifdef CONFIG_CAN_LEDS - struct led_trigger *tx_led_trig; - char tx_led_trig_name[CAN_LED_NAME_SZ]; - struct led_trigger *rx_led_trig; - char rx_led_trig_name[CAN_LED_NAME_SZ]; - struct led_trigger *rxtx_led_trig; - char rxtx_led_trig_name[CAN_LED_NAME_SZ]; -#endif }; /* diff --git a/include/linux/can/led.h b/include/linux/can/led.h deleted file mode 100644 index 2746f7c2f87d..000000000000 --- a/include/linux/can/led.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2012, Fabio Baltieri <fabio.baltieri@xxxxxxxxx> - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef _CAN_LED_H -#define _CAN_LED_H - -#include <linux/if.h> -#include <linux/leds.h> -#include <linux/netdevice.h> - -enum can_led_event { - CAN_LED_EVENT_OPEN, - CAN_LED_EVENT_STOP, - CAN_LED_EVENT_TX, - CAN_LED_EVENT_RX, -}; - -#ifdef CONFIG_CAN_LEDS - -/* keep space for interface name + "-tx"/"-rx"/"-rxtx" - * suffix and null terminator - */ -#define CAN_LED_NAME_SZ (IFNAMSIZ + 6) - -void can_led_event(struct net_device *netdev, enum can_led_event event); -void devm_can_led_init(struct net_device *netdev); -int __init can_led_notifier_init(void); -void __exit can_led_notifier_exit(void); - -#else - -static inline void can_led_event(struct net_device *netdev, - enum can_led_event event) -{ -} -static inline void devm_can_led_init(struct net_device *netdev) -{ -} -static inline int can_led_notifier_init(void) -{ - return 0; -} -static inline void can_led_notifier_exit(void) -{ -} - -#endif - -#endif /* !_CAN_LED_H */ -- 2.17.0