kernel: drop usbdev LED trigger
authorRafał Miłecki <rafal@milecki.pl>
Wed, 19 Oct 2016 10:09:45 +0000 (12:09 +0200)
committerRafał Miłecki <rafal@milecki.pl>
Wed, 19 Oct 2016 10:09:45 +0000 (12:09 +0200)
It was LEDE's trigger that was replaced by upstream usbport one.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
package/kernel/linux/modules/leds.mk
target/linux/adm5120/patches-3.18/009-adm5120_leds_switch_trigger.patch
target/linux/brcm2708/patches-4.4/0073-BCM270x_DT-Add-pwr_led-and-the-required-input-trigge.patch
target/linux/generic/config-3.18
target/linux/generic/config-4.1
target/linux/generic/config-4.4
target/linux/generic/files/drivers/leds/ledtrig-usbdev.c [deleted file]
target/linux/generic/patches-3.18/832-ledtrig_usbdev.patch [deleted file]
target/linux/generic/patches-4.1/832-ledtrig_usbdev.patch [deleted file]
target/linux/generic/patches-4.4/832-ledtrig_usbdev.patch [deleted file]

index efcb030564421ff5b6d6cd3187fdd1b14b300df1..e3ee0491e650599beb3b4b14e500c042dc92fe2c 100644 (file)
@@ -90,22 +90,6 @@ endef
 $(eval $(call KernelPackage,ledtrig-netfilter))
 
 
-define KernelPackage/ledtrig-usbdev
-  SUBMENU:=$(LEDS_MENU)
-  TITLE:=LED USB device Trigger
-  DEPENDS:=@USB_SUPPORT kmod-usb-core
-  KCONFIG:=CONFIG_LEDS_TRIGGER_USBDEV
-  FILES:=$(LINUX_DIR)/drivers/leds/ledtrig-usbdev.ko
-  AUTOLOAD:=$(call AutoLoad,50,ledtrig-usbdev)
-endef
-
-define KernelPackage/ledtrig-usbdev/description
- Kernel module to drive LEDs based on USB device presence/activity
-endef
-
-$(eval $(call KernelPackage,ledtrig-usbdev))
-
-
 define KernelPackage/ledtrig-default-on
   SUBMENU:=$(LEDS_MENU)
   TITLE:=LED Default ON Trigger
index 4b7f532279fc63b2a78bcdcef92b21f574cf235e..f6dbdfc87d9ff2e045b0690d1e73a78ea50019cc 100644 (file)
@@ -15,8 +15,8 @@
  endif # NEW_LEDS
 --- a/drivers/leds/Makefile
 +++ b/drivers/leds/Makefile
-@@ -64,3 +64,4 @@ obj-$(CONFIG_LEDS_TRIGGERS)          += trigger/
+@@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085)                += leds-d
+ # LED Triggers
  obj-$(CONFIG_LEDS_TRIGGERS)           += trigger/
  obj-$(CONFIG_LEDS_TRIGGER_NETDEV)     += ledtrig-netdev.o
- obj-$(CONFIG_LEDS_TRIGGER_USBDEV)     += ledtrig-usbdev.o
 +obj-$(CONFIG_LEDS_TRIGGER_ADM5120_SWITCH) += ledtrig-adm5120-switch.o
index 63ac021aaddb90611c3152dafe3ec231330982f5..d817298541d2e14e9d293d2542bb861afb14f1f0 100644 (file)
@@ -79,9 +79,9 @@ See: https://github.com/raspberrypi/linux/issues/1064
        else
 --- a/drivers/leds/trigger/Kconfig
 +++ b/drivers/leds/trigger/Kconfig
-@@ -122,4 +122,11 @@ config LEDS_TRIGGER_USBDEV
-         This allows LEDs to be controlled by the presence/activity of
-         an USB device. If unsure, say N.
+@@ -115,4 +115,11 @@ config LEDS_TRIGGER_NETDEV
+         This allows LEDs to be controlled by network device activity.
+         If unsure, say Y.
  
 +config LEDS_TRIGGER_INPUT
 +      tristate "LED Input Trigger"
index a5cc156add1038408e88b9ddfe1f88351780b656..0ccd9ac75652c379f35eec2f30dfcebab0974aee 100644 (file)
@@ -1858,7 +1858,6 @@ CONFIG_LEDS_TRIGGER_NETDEV=y
 # CONFIG_LEDS_TRIGGER_ONESHOT is not set
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_TRANSIENT is not set
-# CONFIG_LEDS_TRIGGER_USBDEV is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_LIB80211 is not set
 # CONFIG_LIB80211_CRYPT_CCMP is not set
index 8600709e4b7057aa4450bda6b96452545a01ff44..fc7359e9d66f86c932c4ec69c0a592e7cc3d491b 100644 (file)
@@ -1931,7 +1931,6 @@ CONFIG_LEDS_TRIGGER_NETDEV=y
 # CONFIG_LEDS_TRIGGER_ONESHOT is not set
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_TRANSIENT is not set
-# CONFIG_LEDS_TRIGGER_USBDEV is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_LIB80211 is not set
 # CONFIG_LIB80211_CRYPT_CCMP is not set
index 8aabcf94baf07b8c0202f91ca0b15577781938d8..687c18386b20489e04ce506526a5a787aaaab078 100644 (file)
@@ -1925,7 +1925,6 @@ CONFIG_LEDS_TRIGGER_NETDEV=y
 # CONFIG_LEDS_TRIGGER_ONESHOT is not set
 CONFIG_LEDS_TRIGGER_TIMER=y
 # CONFIG_LEDS_TRIGGER_TRANSIENT is not set
-# CONFIG_LEDS_TRIGGER_USBDEV is not set
 # CONFIG_LEGACY_PTYS is not set
 # CONFIG_LIB80211 is not set
 # CONFIG_LIB80211_CRYPT_CCMP is not set
diff --git a/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c b/target/linux/generic/files/drivers/leds/ledtrig-usbdev.c
deleted file mode 100644 (file)
index 2524bce..0000000
+++ /dev/null
@@ -1,371 +0,0 @@
-/*
- * LED USB device Trigger
- *
- * Toggles the LED to reflect the presence and activity of an USB device
- * Copyright (C) Gabor Juhos <juhosg@openwrt.org>
- *
- * derived from ledtrig-netdev.c:
- *     Copyright 2007 Oliver Jowett <oliver@opencloud.com>
- *
- * ledtrig-netdev.c derived from ledtrig-timer.c:
- *     Copyright 2005-2006 Openedhand Ltd.
- *     Author: Richard Purdie <rpurdie@openedhand.com>
- *
- * 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/jiffies.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/list.h>
-#include <linux/spinlock.h>
-#include <linux/device.h>
-#include <linux/sysdev.h>
-#include <linux/timer.h>
-#include <linux/ctype.h>
-#include <linux/slab.h>
-#include <linux/leds.h>
-#include <linux/usb.h>
-
-#include "leds.h"
-
-#define DEV_BUS_ID_SIZE                32
-
-/*
- * Configurable sysfs attributes:
- *
- * device_name - name of the USB device to monitor
- * activity_interval - duration of LED blink, in milliseconds
- */
-
-struct usbdev_trig_data {
-       rwlock_t lock;
-
-       struct timer_list timer;
-       struct notifier_block notifier;
-
-       struct led_classdev *led_cdev;
-       struct usb_device *usb_dev;
-
-       char device_name[DEV_BUS_ID_SIZE];
-       unsigned interval;
-       int last_urbnum;
-};
-
-static void usbdev_trig_update_state(struct usbdev_trig_data *td)
-{
-       if (td->usb_dev)
-               led_set_brightness(td->led_cdev, LED_FULL);
-       else
-               led_set_brightness(td->led_cdev, LED_OFF);
-
-       if (td->interval && td->usb_dev)
-               mod_timer(&td->timer, jiffies + td->interval);
-       else
-               del_timer(&td->timer);
-}
-
-static ssize_t usbdev_trig_name_show(struct device *dev,
-                                    struct device_attribute *attr,
-                                    char *buf)
-{
-       struct led_classdev *led_cdev = dev_get_drvdata(dev);
-       struct usbdev_trig_data *td = led_cdev->trigger_data;
-
-       read_lock(&td->lock);
-       sprintf(buf, "%s\n", td->device_name);
-       read_unlock(&td->lock);
-
-       return strlen(buf) + 1;
-}
-
-struct usbdev_trig_match {
-       char *device_name;
-       struct usb_device *usb_dev;
-};
-
-static int usbdev_trig_find_usb_dev(struct usb_device *usb_dev, void *data)
-{
-       struct usbdev_trig_match *match = data;
-
-       if (strcmp(dev_name(&usb_dev->dev), match->device_name) != 0)
-               return 0;
-
-       if (WARN_ON(match->usb_dev))
-               return 0;
-
-       dev_dbg(&usb_dev->dev, "matched this device!\n");
-       match->usb_dev = usb_get_dev(usb_dev);
-
-       return 0;
-}
-
-static ssize_t usbdev_trig_name_store(struct device *dev,
-                                     struct device_attribute *attr,
-                                     const char *buf,
-                                     size_t size)
-{
-       struct led_classdev *led_cdev = dev_get_drvdata(dev);
-       struct usbdev_trig_data *td = led_cdev->trigger_data;
-
-       if (size < 0 || size >= DEV_BUS_ID_SIZE)
-               return -EINVAL;
-
-       write_lock(&td->lock);
-
-       strcpy(td->device_name, buf);
-       if (size > 0 && td->device_name[size - 1] == '\n')
-               td->device_name[size - 1] = 0;
-
-       if (td->device_name[0] != 0) {
-               struct usbdev_trig_match match = {
-                       .device_name = td->device_name,
-               };
-
-               /* check for existing device to update from */
-               usb_for_each_dev(&match, usbdev_trig_find_usb_dev);
-               if (match.usb_dev) {
-                       if (td->usb_dev)
-                               usb_put_dev(td->usb_dev);
-
-                       td->usb_dev = match.usb_dev;
-                       td->last_urbnum = atomic_read(&match.usb_dev->urbnum);
-               }
-
-               /* updates LEDs, may start timers */
-               usbdev_trig_update_state(td);
-       }
-
-       write_unlock(&td->lock);
-       return size;
-}
-
-static DEVICE_ATTR(device_name, 0644, usbdev_trig_name_show,
-                  usbdev_trig_name_store);
-
-static ssize_t usbdev_trig_interval_show(struct device *dev,
-                                        struct device_attribute *attr,
-                                        char *buf)
-{
-       struct led_classdev *led_cdev = dev_get_drvdata(dev);
-       struct usbdev_trig_data *td = led_cdev->trigger_data;
-
-       read_lock(&td->lock);
-       sprintf(buf, "%u\n", jiffies_to_msecs(td->interval));
-       read_unlock(&td->lock);
-
-       return strlen(buf) + 1;
-}
-
-static ssize_t usbdev_trig_interval_store(struct device *dev,
-                                         struct device_attribute *attr,
-                                         const char *buf,
-                                         size_t size)
-{
-       struct led_classdev *led_cdev = dev_get_drvdata(dev);
-       struct usbdev_trig_data *td = led_cdev->trigger_data;
-       int ret = -EINVAL;
-       char *after;
-       unsigned long value = simple_strtoul(buf, &after, 10);
-       size_t count = after - buf;
-
-       if (*after && isspace(*after))
-               count++;
-
-       if (count == size && value <= 10000) {
-               write_lock(&td->lock);
-               td->interval = msecs_to_jiffies(value);
-               usbdev_trig_update_state(td); /* resets timer */
-               write_unlock(&td->lock);
-               ret = count;
-       }
-
-       return ret;
-}
-
-static DEVICE_ATTR(activity_interval, 0644, usbdev_trig_interval_show,
-                  usbdev_trig_interval_store);
-
-static int usbdev_trig_notify(struct notifier_block *nb,
-                             unsigned long evt,
-                             void *data)
-{
-       struct usb_device *usb_dev;
-       struct usbdev_trig_data *td;
-
-       if (evt != USB_DEVICE_ADD && evt != USB_DEVICE_REMOVE)
-               return NOTIFY_DONE;
-
-       usb_dev = data;
-       td = container_of(nb, struct usbdev_trig_data, notifier);
-
-       write_lock(&td->lock);
-
-       if (strcmp(dev_name(&usb_dev->dev), td->device_name))
-               goto done;
-
-       if (evt == USB_DEVICE_ADD) {
-               usb_get_dev(usb_dev);
-               if (td->usb_dev != NULL)
-                       usb_put_dev(td->usb_dev);
-               td->usb_dev = usb_dev;
-               td->last_urbnum = atomic_read(&usb_dev->urbnum);
-       } else if (evt == USB_DEVICE_REMOVE) {
-               if (td->usb_dev != NULL) {
-                       usb_put_dev(td->usb_dev);
-                       td->usb_dev = NULL;
-               }
-       }
-
-       usbdev_trig_update_state(td);
-
-done:
-       write_unlock(&td->lock);
-       return NOTIFY_DONE;
-}
-
-/* here's the real work! */
-static void usbdev_trig_timer(unsigned long arg)
-{
-       struct usbdev_trig_data *td = (struct usbdev_trig_data *)arg;
-       int new_urbnum;
-
-       write_lock(&td->lock);
-
-       if (!td->usb_dev || td->interval == 0) {
-               /*
-                * we don't need to do timer work, just reflect device presence
-                */
-               if (td->usb_dev)
-                       led_set_brightness(td->led_cdev, LED_FULL);
-               else
-                       led_set_brightness(td->led_cdev, LED_OFF);
-
-               goto no_restart;
-       }
-
-       if (td->interval)
-               new_urbnum = atomic_read(&td->usb_dev->urbnum);
-       else
-               new_urbnum = 0;
-
-       if (td->usb_dev) {
-               /*
-                * Base state is ON (device is present). If there's no device,
-                * we don't get this far and the LED is off.
-                * OFF -> ON always
-                * ON -> OFF on activity
-                */
-               if (td->led_cdev->brightness == LED_OFF)
-                       led_set_brightness(td->led_cdev, LED_FULL);
-               else if (td->last_urbnum != new_urbnum)
-                       led_set_brightness(td->led_cdev, LED_OFF);
-       } else {
-               /*
-                * base state is OFF
-                * ON -> OFF always
-                * OFF -> ON on activity
-                */
-               if (td->led_cdev->brightness == LED_FULL)
-                       led_set_brightness(td->led_cdev, LED_OFF);
-               else if (td->last_urbnum != new_urbnum)
-                       led_set_brightness(td->led_cdev, LED_FULL);
-       }
-
-       td->last_urbnum = new_urbnum;
-       mod_timer(&td->timer, jiffies + td->interval);
-
-no_restart:
-       write_unlock(&td->lock);
-}
-
-static void usbdev_trig_activate(struct led_classdev *led_cdev)
-{
-       struct usbdev_trig_data *td;
-       int rc;
-
-       td = kzalloc(sizeof(struct usbdev_trig_data), GFP_KERNEL);
-       if (!td)
-               return;
-
-       rwlock_init(&td->lock);
-
-       td->notifier.notifier_call = usbdev_trig_notify;
-       td->notifier.priority = 10;
-
-       setup_timer(&td->timer, usbdev_trig_timer, (unsigned long) td);
-
-       td->led_cdev = led_cdev;
-       td->interval = msecs_to_jiffies(50);
-
-       led_cdev->trigger_data = td;
-
-       rc = device_create_file(led_cdev->dev, &dev_attr_device_name);
-       if (rc)
-               goto err_out;
-
-       rc = device_create_file(led_cdev->dev, &dev_attr_activity_interval);
-       if (rc)
-               goto err_out_device_name;
-
-       usb_register_notify(&td->notifier);
-       return;
-
-err_out_device_name:
-       device_remove_file(led_cdev->dev, &dev_attr_device_name);
-err_out:
-       led_cdev->trigger_data = NULL;
-       kfree(td);
-}
-
-static void usbdev_trig_deactivate(struct led_classdev *led_cdev)
-{
-       struct usbdev_trig_data *td = led_cdev->trigger_data;
-
-       if (td) {
-               usb_unregister_notify(&td->notifier);
-
-               device_remove_file(led_cdev->dev, &dev_attr_device_name);
-               device_remove_file(led_cdev->dev, &dev_attr_activity_interval);
-
-               write_lock(&td->lock);
-
-               if (td->usb_dev) {
-                       usb_put_dev(td->usb_dev);
-                       td->usb_dev = NULL;
-               }
-
-               write_unlock(&td->lock);
-
-               del_timer_sync(&td->timer);
-
-               kfree(td);
-       }
-}
-
-static struct led_trigger usbdev_led_trigger = {
-       .name           = "usbdev",
-       .activate       = usbdev_trig_activate,
-       .deactivate     = usbdev_trig_deactivate,
-};
-
-static int __init usbdev_trig_init(void)
-{
-       return led_trigger_register(&usbdev_led_trigger);
-}
-
-static void __exit usbdev_trig_exit(void)
-{
-       led_trigger_unregister(&usbdev_led_trigger);
-}
-
-module_init(usbdev_trig_init);
-module_exit(usbdev_trig_exit);
-
-MODULE_AUTHOR("Gabor Juhos <juhosg@openwrt.org>");
-MODULE_DESCRIPTION("USB device LED trigger");
-MODULE_LICENSE("GPL v2");
diff --git a/target/linux/generic/patches-3.18/832-ledtrig_usbdev.patch b/target/linux/generic/patches-3.18/832-ledtrig_usbdev.patch
deleted file mode 100644 (file)
index b3dbc57..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/drivers/leds/trigger/Kconfig
-+++ b/drivers/leds/trigger/Kconfig
-@@ -115,4 +115,11 @@ config LEDS_TRIGGER_NETDEV
-         This allows LEDs to be controlled by network device activity.
-         If unsure, say Y.
-+config LEDS_TRIGGER_USBDEV
-+      tristate "LED USB device Trigger"
-+      depends on USB && LEDS_TRIGGERS
-+      help
-+        This allows LEDs to be controlled by the presence/activity of
-+        an USB device. If unsure, say N.
-+
- endif # LEDS_TRIGGERS
---- a/drivers/leds/Makefile
-+++ b/drivers/leds/Makefile
-@@ -63,3 +63,4 @@ obj-$(CONFIG_LEDS_DAC124S085)                += leds-d
- # LED Triggers
- obj-$(CONFIG_LEDS_TRIGGERS)           += trigger/
- obj-$(CONFIG_LEDS_TRIGGER_NETDEV)     += ledtrig-netdev.o
-+obj-$(CONFIG_LEDS_TRIGGER_USBDEV)     += ledtrig-usbdev.o
---- a/drivers/leds/ledtrig-usbdev.c
-+++ b/drivers/leds/ledtrig-usbdev.c
-@@ -24,7 +24,6 @@
- #include <linux/list.h>
- #include <linux/spinlock.h>
- #include <linux/device.h>
--#include <linux/sysdev.h>
- #include <linux/timer.h>
- #include <linux/ctype.h>
- #include <linux/slab.h>
diff --git a/target/linux/generic/patches-4.1/832-ledtrig_usbdev.patch b/target/linux/generic/patches-4.1/832-ledtrig_usbdev.patch
deleted file mode 100644 (file)
index b83efd2..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/drivers/leds/trigger/Kconfig
-+++ b/drivers/leds/trigger/Kconfig
-@@ -115,4 +115,11 @@ config LEDS_TRIGGER_NETDEV
-         This allows LEDs to be controlled by network device activity.
-         If unsure, say Y.
-+config LEDS_TRIGGER_USBDEV
-+      tristate "LED USB device Trigger"
-+      depends on USB && LEDS_TRIGGERS
-+      help
-+        This allows LEDs to be controlled by the presence/activity of
-+        an USB device. If unsure, say N.
-+
- endif # LEDS_TRIGGERS
---- a/drivers/leds/Makefile
-+++ b/drivers/leds/Makefile
-@@ -66,3 +66,4 @@ obj-$(CONFIG_LEDS_DAC124S085)                += leds-d
- # LED Triggers
- obj-$(CONFIG_LEDS_TRIGGERS)           += trigger/
- obj-$(CONFIG_LEDS_TRIGGER_NETDEV)     += ledtrig-netdev.o
-+obj-$(CONFIG_LEDS_TRIGGER_USBDEV)     += ledtrig-usbdev.o
---- a/drivers/leds/ledtrig-usbdev.c
-+++ b/drivers/leds/ledtrig-usbdev.c
-@@ -24,7 +24,6 @@
- #include <linux/list.h>
- #include <linux/spinlock.h>
- #include <linux/device.h>
--#include <linux/sysdev.h>
- #include <linux/timer.h>
- #include <linux/ctype.h>
- #include <linux/slab.h>
diff --git a/target/linux/generic/patches-4.4/832-ledtrig_usbdev.patch b/target/linux/generic/patches-4.4/832-ledtrig_usbdev.patch
deleted file mode 100644 (file)
index 73bbb2e..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
---- a/drivers/leds/trigger/Kconfig
-+++ b/drivers/leds/trigger/Kconfig
-@@ -115,4 +115,11 @@ config LEDS_TRIGGER_NETDEV
-         This allows LEDs to be controlled by network device activity.
-         If unsure, say Y.
-+config LEDS_TRIGGER_USBDEV
-+      tristate "LED USB device Trigger"
-+      depends on USB && LEDS_TRIGGERS
-+      help
-+        This allows LEDs to be controlled by the presence/activity of
-+        an USB device. If unsure, say N.
-+
- endif # LEDS_TRIGGERS
---- a/drivers/leds/Makefile
-+++ b/drivers/leds/Makefile
-@@ -73,3 +73,4 @@ obj-$(CONFIG_LEDS_DAC124S085)                += leds-d
- # LED Triggers
- obj-$(CONFIG_LEDS_TRIGGERS)           += trigger/
- obj-$(CONFIG_LEDS_TRIGGER_NETDEV)     += ledtrig-netdev.o
-+obj-$(CONFIG_LEDS_TRIGGER_USBDEV)     += ledtrig-usbdev.o
---- a/drivers/leds/ledtrig-usbdev.c
-+++ b/drivers/leds/ledtrig-usbdev.c
-@@ -24,7 +24,6 @@
- #include <linux/list.h>
- #include <linux/spinlock.h>
- #include <linux/device.h>
--#include <linux/sysdev.h>
- #include <linux/timer.h>
- #include <linux/ctype.h>
- #include <linux/slab.h>