From: Felix Fietkau Date: Tue, 19 Jul 2016 12:18:02 +0000 (+0200) Subject: kernel: remove obsolete patch adding usb_find_device_by_name X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=5a92e049d5452df12d2577f1da3bc13e498d0b23;p=openwrt%2Fstaging%2Fzorun.git kernel: remove obsolete patch adding usb_find_device_by_name ledtrig-usbdev does not need it anymore Signed-off-by: Felix Fietkau --- diff --git a/target/linux/generic/patches-3.18/820-usb_add_usb_find_device_by_name.patch b/target/linux/generic/patches-3.18/820-usb_add_usb_find_device_by_name.patch deleted file mode 100644 index e381cc97be..0000000000 --- a/target/linux/generic/patches-3.18/820-usb_add_usb_find_device_by_name.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -690,6 +690,71 @@ int __usb_get_extra_descriptor(char *buf - } - EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); - -+static struct usb_device *match_device_name(struct usb_device *dev, -+ const char *name) -+{ -+ struct usb_device *ret_dev = NULL; -+ struct usb_device *childdev = NULL; -+ int child; -+ -+ dev_dbg(&dev->dev, "check for name %s ...\n", name); -+ -+ /* see if this device matches */ -+ if (strcmp(dev_name(&dev->dev), name) == 0 ) { -+ dev_dbg(&dev->dev, "matched this device!\n"); -+ ret_dev = usb_get_dev(dev); -+ goto exit; -+ } -+ /* look through all of the children of this device */ -+ usb_hub_for_each_child(dev, child, childdev) { -+ if (childdev) { -+ usb_lock_device(childdev); -+ ret_dev = match_device_name(childdev, name); -+ usb_unlock_device(childdev); -+ if (ret_dev) -+ goto exit; -+ } -+ } -+exit: -+ return ret_dev; -+} -+ -+/** -+ * usb_find_device_by_name - find a specific usb device in the system -+ * @name: the name of the device to find -+ * -+ * Returns a pointer to a struct usb_device if such a specified usb -+ * device is present in the system currently. The usage count of the -+ * device will be incremented if a device is found. Make sure to call -+ * usb_put_dev() when the caller is finished with the device. -+ * -+ * If a device with the specified bus id is not found, NULL is returned. -+ */ -+struct usb_device *usb_find_device_by_name(const char *name) -+{ -+ struct list_head *buslist; -+ struct usb_bus *bus; -+ struct usb_device *dev = NULL; -+ -+ mutex_lock(&usb_bus_list_lock); -+ for (buslist = usb_bus_list.next; -+ buslist != &usb_bus_list; -+ buslist = buslist->next) { -+ bus = container_of(buslist, struct usb_bus, bus_list); -+ if (!bus->root_hub) -+ continue; -+ usb_lock_device(bus->root_hub); -+ dev = match_device_name(bus->root_hub, name); -+ usb_unlock_device(bus->root_hub); -+ if (dev) -+ goto exit; -+ } -+exit: -+ mutex_unlock(&usb_bus_list_lock); -+ return dev; -+} -+EXPORT_SYMBOL_GPL(usb_find_device_by_name); -+ - /** - * usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP - * @dev: device the buffer will be used with ---- a/include/linux/usb.h -+++ b/include/linux/usb.h -@@ -721,6 +721,7 @@ static inline bool usb_device_no_sg_cons - return udev && udev->bus && udev->bus->no_sg_constraint; - } - -+extern struct usb_device *usb_find_device_by_name(const char *name); - - /*-------------------------------------------------------------------------*/ - diff --git a/target/linux/generic/patches-4.1/820-usb_add_usb_find_device_by_name.patch b/target/linux/generic/patches-4.1/820-usb_add_usb_find_device_by_name.patch deleted file mode 100644 index 906f0e215e..0000000000 --- a/target/linux/generic/patches-4.1/820-usb_add_usb_find_device_by_name.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -704,6 +704,71 @@ int __usb_get_extra_descriptor(char *buf - } - EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); - -+static struct usb_device *match_device_name(struct usb_device *dev, -+ const char *name) -+{ -+ struct usb_device *ret_dev = NULL; -+ struct usb_device *childdev = NULL; -+ int child; -+ -+ dev_dbg(&dev->dev, "check for name %s ...\n", name); -+ -+ /* see if this device matches */ -+ if (strcmp(dev_name(&dev->dev), name) == 0 ) { -+ dev_dbg(&dev->dev, "matched this device!\n"); -+ ret_dev = usb_get_dev(dev); -+ goto exit; -+ } -+ /* look through all of the children of this device */ -+ usb_hub_for_each_child(dev, child, childdev) { -+ if (childdev) { -+ usb_lock_device(childdev); -+ ret_dev = match_device_name(childdev, name); -+ usb_unlock_device(childdev); -+ if (ret_dev) -+ goto exit; -+ } -+ } -+exit: -+ return ret_dev; -+} -+ -+/** -+ * usb_find_device_by_name - find a specific usb device in the system -+ * @name: the name of the device to find -+ * -+ * Returns a pointer to a struct usb_device if such a specified usb -+ * device is present in the system currently. The usage count of the -+ * device will be incremented if a device is found. Make sure to call -+ * usb_put_dev() when the caller is finished with the device. -+ * -+ * If a device with the specified bus id is not found, NULL is returned. -+ */ -+struct usb_device *usb_find_device_by_name(const char *name) -+{ -+ struct list_head *buslist; -+ struct usb_bus *bus; -+ struct usb_device *dev = NULL; -+ -+ mutex_lock(&usb_bus_list_lock); -+ for (buslist = usb_bus_list.next; -+ buslist != &usb_bus_list; -+ buslist = buslist->next) { -+ bus = container_of(buslist, struct usb_bus, bus_list); -+ if (!bus->root_hub) -+ continue; -+ usb_lock_device(bus->root_hub); -+ dev = match_device_name(bus->root_hub, name); -+ usb_unlock_device(bus->root_hub); -+ if (dev) -+ goto exit; -+ } -+exit: -+ mutex_unlock(&usb_bus_list_lock); -+ return dev; -+} -+EXPORT_SYMBOL_GPL(usb_find_device_by_name); -+ - /** - * usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP - * @dev: device the buffer will be used with ---- a/include/linux/usb.h -+++ b/include/linux/usb.h -@@ -721,6 +721,7 @@ static inline bool usb_device_no_sg_cons - return udev && udev->bus && udev->bus->no_sg_constraint; - } - -+extern struct usb_device *usb_find_device_by_name(const char *name); - - /*-------------------------------------------------------------------------*/ - diff --git a/target/linux/generic/patches-4.4/820-usb_add_usb_find_device_by_name.patch b/target/linux/generic/patches-4.4/820-usb_add_usb_find_device_by_name.patch deleted file mode 100644 index 1740d74179..0000000000 --- a/target/linux/generic/patches-4.4/820-usb_add_usb_find_device_by_name.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- a/drivers/usb/core/usb.c -+++ b/drivers/usb/core/usb.c -@@ -704,6 +704,71 @@ int __usb_get_extra_descriptor(char *buf - } - EXPORT_SYMBOL_GPL(__usb_get_extra_descriptor); - -+static struct usb_device *match_device_name(struct usb_device *dev, -+ const char *name) -+{ -+ struct usb_device *ret_dev = NULL; -+ struct usb_device *childdev = NULL; -+ int child; -+ -+ dev_dbg(&dev->dev, "check for name %s ...\n", name); -+ -+ /* see if this device matches */ -+ if (strcmp(dev_name(&dev->dev), name) == 0 ) { -+ dev_dbg(&dev->dev, "matched this device!\n"); -+ ret_dev = usb_get_dev(dev); -+ goto exit; -+ } -+ /* look through all of the children of this device */ -+ usb_hub_for_each_child(dev, child, childdev) { -+ if (childdev) { -+ usb_lock_device(childdev); -+ ret_dev = match_device_name(childdev, name); -+ usb_unlock_device(childdev); -+ if (ret_dev) -+ goto exit; -+ } -+ } -+exit: -+ return ret_dev; -+} -+ -+/** -+ * usb_find_device_by_name - find a specific usb device in the system -+ * @name: the name of the device to find -+ * -+ * Returns a pointer to a struct usb_device if such a specified usb -+ * device is present in the system currently. The usage count of the -+ * device will be incremented if a device is found. Make sure to call -+ * usb_put_dev() when the caller is finished with the device. -+ * -+ * If a device with the specified bus id is not found, NULL is returned. -+ */ -+struct usb_device *usb_find_device_by_name(const char *name) -+{ -+ struct list_head *buslist; -+ struct usb_bus *bus; -+ struct usb_device *dev = NULL; -+ -+ mutex_lock(&usb_bus_list_lock); -+ for (buslist = usb_bus_list.next; -+ buslist != &usb_bus_list; -+ buslist = buslist->next) { -+ bus = container_of(buslist, struct usb_bus, bus_list); -+ if (!bus->root_hub) -+ continue; -+ usb_lock_device(bus->root_hub); -+ dev = match_device_name(bus->root_hub, name); -+ usb_unlock_device(bus->root_hub); -+ if (dev) -+ goto exit; -+ } -+exit: -+ mutex_unlock(&usb_bus_list_lock); -+ return dev; -+} -+EXPORT_SYMBOL_GPL(usb_find_device_by_name); -+ - /** - * usb_alloc_coherent - allocate dma-consistent buffer for URB_NO_xxx_DMA_MAP - * @dev: device the buffer will be used with ---- a/include/linux/usb.h -+++ b/include/linux/usb.h -@@ -729,6 +729,7 @@ static inline bool usb_device_no_sg_cons - return udev && udev->bus && udev->bus->no_sg_constraint; - } - -+extern struct usb_device *usb_find_device_by_name(const char *name); - - /*-------------------------------------------------------------------------*/ -