[openwrt/openwrt] kernel: refresh swconfig_leds to handle new trigger locking

LEDE Commits lede-commits at lists.infradead.org
Mon May 22 13:40:33 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/fb6de77a824d6d7542ad314721448fcb8c6ccc1a

commit fb6de77a824d6d7542ad314721448fcb8c6ccc1a
Author: Christian Marangi <ansuelsmth at gmail.com>
AuthorDate: Thu Oct 20 02:20:17 2022 +0200

    kernel: refresh swconfig_leds to handle new trigger locking
    
    Refresh swconfig_leds source to handle new trigger locking that is now a
    spinlock.
    
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .../linux/generic/files/drivers/net/phy/swconfig_leds.c  | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c
index df53e5cd4a..1d309c046c 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig_leds.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig_leds.c
@@ -85,7 +85,11 @@ swconfig_trig_update_port_mask(struct led_trigger *trigger)
 	sw_trig = (void *) trigger;
 
 	port_mask = 0;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
+	spin_lock(&trigger->leddev_list_lock);
+#else
 	read_lock(&trigger->leddev_list_lock);
+#endif
 	list_for_each(entry, &trigger->led_cdevs) {
 		struct led_classdev *led_cdev;
 		struct swconfig_trig_data *trig_data;
@@ -98,7 +102,11 @@ swconfig_trig_update_port_mask(struct led_trigger *trigger)
 			read_unlock(&trig_data->lock);
 		}
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
+	spin_unlock(&trigger->leddev_list_lock);
+#else
 	read_unlock(&trigger->leddev_list_lock);
+#endif
 
 	sw_trig->port_mask = port_mask;
 
@@ -418,14 +426,22 @@ swconfig_trig_update_leds(struct switch_led_trigger *sw_trig)
 	struct led_trigger *trigger;
 
 	trigger = &sw_trig->trig;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
+	spin_lock(&trigger->leddev_list_lock);
+#else
 	read_lock(&trigger->leddev_list_lock);
+#endif
 	list_for_each(entry, &trigger->led_cdevs) {
 		struct led_classdev *led_cdev;
 
 		led_cdev = list_entry(entry, struct led_classdev, trig_list);
 		swconfig_trig_led_event(sw_trig, led_cdev);
 	}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(5,16,0)
+	spin_unlock(&trigger->leddev_list_lock);
+#else
 	read_unlock(&trigger->leddev_list_lock);
+#endif
 }
 
 static void




More information about the lede-commits mailing list