mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 09:11:26 +03:00
net: can: mttcan: Make LED support depend on CAN_LEDS
CONFIG_CAN_LEDS has been marked as BROKEN since Linux v4.19 and was finally removed in Linux v5.19. Only compile support for LEDS if enabled in the kernel. Long-term we need to move the MTTCAN driver to use LEDS_TRIGGER_NETDEV. This is a better solution for working with 3rd party Linux kernels that may backport upstream changes to the kernel and hence are not compatible with these existing version checks. Bug 4228080 Bug 4283911 Change-Id: I70e800c4a3699af59742d30111bc3a3cbf80bcb5 Signed-off-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2982135 Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
069925e74b
commit
8409b7c652
@@ -1,6 +1,13 @@
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2022 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
# SPDX-FileCopyrightText: Copyright (c) 2022-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
# CAN_LEDS has been marked as BROKEN since Linux v4.19 and
|
||||
# was finally removed in Linux v5.19. Only compile support
|
||||
# for LEDS if enabled in the kernel.
|
||||
ifdef CONFIG_CAN_LEDS
|
||||
subdir-ccflags-y += -DCONFIG_CAN_LEDS
|
||||
endif
|
||||
|
||||
obj-m := mttcan.o
|
||||
|
||||
mttcan-y = native/m_ttcan_linux.o native/m_ttcan_sys.o hal/m_ttcan.o
|
||||
|
||||
@@ -620,7 +620,7 @@ static void mttcan_tx_complete(struct net_device *dev)
|
||||
|
||||
while (completed_tx) {
|
||||
msg_no = ffs(completed_tx) - 1;
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(CONFIG_CAN_LEDS)
|
||||
can_led_event(dev, CAN_LED_EVENT_TX);
|
||||
#endif
|
||||
clear_bit(msg_no, &ttcan->tx_object);
|
||||
@@ -1312,7 +1312,7 @@ static int mttcan_open(struct net_device *dev)
|
||||
}
|
||||
|
||||
napi_enable(&priv->napi);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(CONFIG_CAN_LEDS)
|
||||
can_led_event(dev, CAN_LED_EVENT_OPEN);
|
||||
#endif
|
||||
|
||||
@@ -1348,7 +1348,7 @@ static int mttcan_close(struct net_device *dev)
|
||||
mttcan_power_down(dev);
|
||||
mttcan_pm_runtime_put_sync(priv);
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(CONFIG_CAN_LEDS)
|
||||
can_led_event(dev, CAN_LED_EVENT_STOP);
|
||||
#endif
|
||||
return 0;
|
||||
@@ -1553,7 +1553,7 @@ static int register_mttcan_dev(struct net_device *dev)
|
||||
|
||||
dev->netdev_ops = &mttcan_netdev_ops;
|
||||
err = register_candev(dev);
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 19, 0)
|
||||
#if defined(CONFIG_CAN_LEDS)
|
||||
if (!err)
|
||||
devm_can_led_init(dev);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user