Skip to content

Commit

Permalink
can: can-dev: remove obsolete CAN LED support
Browse files Browse the repository at this point in the history
Since commit 30f3b42 ("can: mark led trigger as broken") the
CAN specific LED support was disabled and marked as BROKEN. As the
common LED support with CONFIG_LEDS_TRIGGER_NETDEV should do this work
now the code can be removed as preparation for a CAN netdevice Kconfig
rework.

Link: https://lore.kernel.org/all/[email protected]
Suggested-by: Vincent Mailhol <[email protected]>
Signed-off-by: Oliver Hartkopp <[email protected]>
[mkl: remove led.h from MAINTAINERS]
Signed-off-by: Marc Kleine-Budde <[email protected]>
  • Loading branch information
hartkopp authored and marckleinebudde committed May 19, 2022
1 parent caf6b7f commit 6c1e423
Show file tree
Hide file tree
Showing 25 changed files with 2 additions and 378 deletions.
1 change: 0 additions & 1 deletion MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -4376,7 +4376,6 @@ F: drivers/net/can/
F: drivers/phy/phy-can-transceiver.c
F: include/linux/can/bittiming.h
F: include/linux/can/dev.h
F: include/linux/can/led.h
F: include/linux/can/length.h
F: include/linux/can/platform/
F: include/linux/can/rx-offload.h
Expand Down
17 changes: 0 additions & 17 deletions drivers/net/can/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -71,23 +71,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
# The netdev trigger (LEDS_TRIGGER_NETDEV) should be able to do
# everything that this driver is doing. This is marked as broken
# because it uses stuff that is intended to be changed or removed.
# Please consider switching to the netdev trigger and confirm it
# fulfills your needs instead of fixing this driver.
depends on BROKEN
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
Expand Down
10 changes: 0 additions & 10 deletions drivers/net/can/at91_can.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

#include <linux/can/dev.h>
#include <linux/can/error.h>
#include <linux/can/led.h>

#define AT91_MB_MASK(i) ((1 << (i)) - 1)

Expand Down Expand Up @@ -618,8 +617,6 @@ static void at91_read_msg(struct net_device *dev, unsigned int mb)
stats->rx_bytes += cf->len;

netif_receive_skb(skb);

can_led_event(dev, CAN_LED_EVENT_RX);
}

/**
Expand Down Expand Up @@ -854,7 +851,6 @@ static void at91_irq_tx(struct net_device *dev, u32 reg_sr)
mb - get_mb_tx_first(priv),
NULL);
dev->stats.tx_packets++;
can_led_event(dev, CAN_LED_EVENT_TX);
}
}

Expand Down Expand Up @@ -1101,8 +1097,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);
Expand Down Expand Up @@ -1133,8 +1127,6 @@ static int at91_close(struct net_device *dev)

close_candev(dev);

can_led_event(dev, CAN_LED_EVENT_STOP);

return 0;
}

Expand Down Expand Up @@ -1331,8 +1323,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);

Expand Down
16 changes: 1 addition & 15 deletions drivers/net/can/c_can/c_can_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -759,7 +758,6 @@ static void c_can_do_tx(struct net_device *dev)

stats->tx_bytes += bytes;
stats->tx_packets += pkts;
can_led_event(dev, CAN_LED_EVENT_TX);

tail = c_can_get_tx_tail(tx_ring);

Expand Down Expand Up @@ -906,9 +904,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;
}

Expand Down Expand Up @@ -1182,8 +1177,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);
Expand Down Expand Up @@ -1214,8 +1207,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;
}

Expand Down Expand Up @@ -1365,8 +1356,6 @@ static const struct net_device_ops c_can_netdev_ops = {

int register_c_can_dev(struct net_device *dev)
{
int err;

/* Deactivate pins to prevent DRA7 DCAN IP from being
* stuck in transition when module is disabled.
* Pins are activated in c_can_start() and deactivated
Expand All @@ -1378,10 +1367,7 @@ int register_c_can_dev(struct net_device *dev)
dev->netdev_ops = &c_can_netdev_ops;
c_can_set_ethtool_ops(dev);

err = register_candev(dev);
if (!err)
devm_can_led_init(dev);
return err;
return register_candev(dev);
}
EXPORT_SYMBOL_GPL(register_c_can_dev);

Expand Down
10 changes: 0 additions & 10 deletions drivers/net/can/ctucanfd/ctucanfd_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include <linux/string.h>
#include <linux/types.h>
#include <linux/can/error.h>
#include <linux/can/led.h>
#include <linux/pm_runtime.h>

#include "ctucanfd.h"
Expand Down Expand Up @@ -957,9 +956,6 @@ static int ctucan_rx_poll(struct napi_struct *napi, int quota)
ctucan_write32(priv, CTUCANFD_COMMAND, REG_COMMAND_CDO);
}

if (work_done)
can_led_event(ndev, CAN_LED_EVENT_RX);

if (!framecnt && res != 0) {
if (napi_complete_done(napi, work_done)) {
/* Clear and enable RBNEI. It is level-triggered, so
Expand Down Expand Up @@ -1079,8 +1075,6 @@ static void ctucan_tx_interrupt(struct net_device *ndev)
}
} while (some_buffers_processed);

can_led_event(ndev, CAN_LED_EVENT_TX);

spin_lock_irqsave(&priv->tx_lock, flags);

/* Check if at least one TX buffer is free */
Expand Down Expand Up @@ -1236,7 +1230,6 @@ static int ctucan_open(struct net_device *ndev)
}

netdev_info(ndev, "ctu_can_fd device registered\n");
can_led_event(ndev, CAN_LED_EVENT_OPEN);
napi_enable(&priv->napi);
netif_start_queue(ndev);

Expand Down Expand Up @@ -1269,7 +1262,6 @@ static int ctucan_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;
Expand Down Expand Up @@ -1434,8 +1426,6 @@ int ctucan_probe_common(struct device *dev, void __iomem *addr, int irq, unsigne
goto err_deviceoff;
}

devm_can_led_init(ndev);

pm_runtime_put(dev);

netdev_dbg(ndev, "mem_base=0x%p irq=%d clock=%d, no. of txt buffers:%d\n",
Expand Down
2 changes: 0 additions & 2 deletions drivers/net/can/dev/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ can-dev-y += length.o
can-dev-y += netlink.o
can-dev-y += rx-offload.o
can-dev-y += skb.o

can-dev-$(CONFIG_CAN_LEDS) += led.o
5 changes: 0 additions & 5 deletions drivers/net/can/dev/dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <linux/can/can-ml.h>
#include <linux/can/dev.h>
#include <linux/can/skb.h>
#include <linux/can/led.h>
#include <linux/gpio/consumer.h>
#include <linux/of.h>

Expand Down Expand Up @@ -512,8 +511,6 @@ static __init int can_dev_init(void)
{
int err;

can_led_notifier_init();

err = can_netlink_register();
if (!err)
pr_info(MOD_DESC "\n");
Expand All @@ -525,8 +522,6 @@ module_init(can_dev_init);
static __exit void can_dev_exit(void)
{
can_netlink_unregister();

can_led_notifier_exit();
}
module_exit(can_dev_exit);

Expand Down
2 changes: 0 additions & 2 deletions drivers/net/can/dev/rx-offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,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;
}

Expand Down
7 changes: 0 additions & 7 deletions drivers/net/can/flexcan/flexcan-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,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/firmware/imx/sci.h>
Expand Down Expand Up @@ -1081,7 +1080,6 @@ static irqreturn_t flexcan_irq(int irq, void *dev_id)
can_rx_offload_get_echo_skb(&priv->offload, 0,
reg_ctrl << 16, NULL);
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,
Expand Down Expand Up @@ -1738,8 +1736,6 @@ static int flexcan_open(struct net_device *dev)

flexcan_chip_interrupts_enable(dev);

can_led_event(dev, CAN_LED_EVENT_OPEN);

netif_start_queue(dev);

return 0;
Expand Down Expand Up @@ -1785,8 +1781,6 @@ static int flexcan_close(struct net_device *dev)

pm_runtime_put(priv->dev);

can_led_event(dev, CAN_LED_EVENT_STOP);

return 0;
}

Expand Down Expand Up @@ -2189,7 +2183,6 @@ static int flexcan_probe(struct platform_device *pdev)
}

of_can_transceiver(dev);
devm_can_led_init(dev);

return 0;

Expand Down
9 changes: 0 additions & 9 deletions drivers/net/can/ifi_canfd/ifi_canfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -626,7 +623,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, NULL);
stats->tx_packets++;
can_led_event(ndev, CAN_LED_EVENT_TX);
}

if (isr & tx_irq_mask)
Expand Down Expand Up @@ -830,7 +826,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);

Expand All @@ -853,8 +848,6 @@ static int ifi_canfd_close(struct net_device *ndev)

close_candev(ndev);

can_led_event(ndev, CAN_LED_EVENT_STOP);

return 0;
}

Expand Down Expand Up @@ -1004,8 +997,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);

Expand Down
Loading

0 comments on commit 6c1e423

Please sign in to comment.