From 18013b2ae02b2efebdb72030bde18ccab2e4a614 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 5 Dec 2022 19:25:32 +0100 Subject: [PATCH] drop some usb patches --- ...ver-core-add-device-probe-log-helper.patch | 105 ------------------ ...-bcma-add-a-check-for-devm_gpiod_get.patch | 57 ---------- queue-4.19/series | 4 - ...-bcma-add-a-check-for-devm_gpiod_get.patch | 43 ------- ...b-bcma-make-gpio-explicitly-optional.patch | 71 ------------ queue-5.4/series | 1 - ...b-bcma-make-gpio-explicitly-optional.patch | 71 ------------ 7 files changed, 352 deletions(-) delete mode 100644 queue-4.19/driver-core-add-device-probe-log-helper.patch delete mode 100644 queue-4.19/revert-usb-bcma-add-a-check-for-devm_gpiod_get.patch delete mode 100644 queue-4.19/usb-bcma-add-a-check-for-devm_gpiod_get.patch delete mode 100644 queue-4.19/usb-bcma-make-gpio-explicitly-optional.patch delete mode 100644 queue-5.4/usb-bcma-make-gpio-explicitly-optional.patch diff --git a/queue-4.19/driver-core-add-device-probe-log-helper.patch b/queue-4.19/driver-core-add-device-probe-log-helper.patch deleted file mode 100644 index 8789f66040f..00000000000 --- a/queue-4.19/driver-core-add-device-probe-log-helper.patch +++ /dev/null @@ -1,105 +0,0 @@ -From 92d6c1e7725ebaa575fa109605c8379256a7c12c Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 13 Jul 2020 16:43:21 +0200 -Subject: driver core: add device probe log helper - -From: Andrzej Hajda - -[ Upstream commit a787e5400a1ceeb0ef92d71ec43aeb35b1fa1334 ] - -During probe every time driver gets resource it should usually check for -error printk some message if it is not -EPROBE_DEFER and return the error. -This pattern is simple but requires adding few lines after any resource -acquisition code, as a result it is often omitted or implemented only -partially. -dev_err_probe helps to replace such code sequences with simple call, -so code: - if (err != -EPROBE_DEFER) - dev_err(dev, ...); - return err; -becomes: - return dev_err_probe(dev, err, ...); - -Signed-off-by: Andrzej Hajda -Reviewed-by: Rafael J. Wysocki -Reviewed-by: Mark Brown -Reviewed-by: Andy Shevchenko -Link: https://lore.kernel.org/r/20200713144324.23654-2-a.hajda@samsung.com -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: cd136706b4f9 ("USB: bcma: Make GPIO explicitly optional") -Signed-off-by: Sasha Levin ---- - drivers/base/core.c | 42 ++++++++++++++++++++++++++++++++++++++++++ - include/linux/device.h | 3 +++ - 2 files changed, 45 insertions(+) - -diff --git a/drivers/base/core.c b/drivers/base/core.c -index 6e380ad9d08a..b66647277d52 100644 ---- a/drivers/base/core.c -+++ b/drivers/base/core.c -@@ -3334,6 +3334,48 @@ define_dev_printk_level(_dev_info, KERN_INFO); - - #endif - -+/** -+ * dev_err_probe - probe error check and log helper -+ * @dev: the pointer to the struct device -+ * @err: error value to test -+ * @fmt: printf-style format string -+ * @...: arguments as specified in the format string -+ * -+ * This helper implements common pattern present in probe functions for error -+ * checking: print debug or error message depending if the error value is -+ * -EPROBE_DEFER and propagate error upwards. -+ * It replaces code sequence: -+ * if (err != -EPROBE_DEFER) -+ * dev_err(dev, ...); -+ * else -+ * dev_dbg(dev, ...); -+ * return err; -+ * with -+ * return dev_err_probe(dev, err, ...); -+ * -+ * Returns @err. -+ * -+ */ -+int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) -+{ -+ struct va_format vaf; -+ va_list args; -+ -+ va_start(args, fmt); -+ vaf.fmt = fmt; -+ vaf.va = &args; -+ -+ if (err != -EPROBE_DEFER) -+ dev_err(dev, "error %d: %pV", err, &vaf); -+ else -+ dev_dbg(dev, "error %d: %pV", err, &vaf); -+ -+ va_end(args); -+ -+ return err; -+} -+EXPORT_SYMBOL_GPL(dev_err_probe); -+ - static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) - { - return fwnode && !IS_ERR(fwnode->secondary); -diff --git a/include/linux/device.h b/include/linux/device.h -index 37e359d81a86..0e38740fc53b 100644 ---- a/include/linux/device.h -+++ b/include/linux/device.h -@@ -1579,6 +1579,9 @@ do { \ - WARN_ONCE(condition, "%s %s: " format, \ - dev_driver_string(dev), dev_name(dev), ## arg) - -+extern __printf(3, 4) -+int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); -+ - /* Create alias, so I can be autoloaded. */ - #define MODULE_ALIAS_CHARDEV(major,minor) \ - MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor)) --- -2.35.1 - diff --git a/queue-4.19/revert-usb-bcma-add-a-check-for-devm_gpiod_get.patch b/queue-4.19/revert-usb-bcma-add-a-check-for-devm_gpiod_get.patch deleted file mode 100644 index e545fdc864f..00000000000 --- a/queue-4.19/revert-usb-bcma-add-a-check-for-devm_gpiod_get.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 7881f0f70cc03028e6764bc1a63824c0e4825fbf Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 31 Aug 2021 08:54:19 +0200 -Subject: Revert "USB: bcma: Add a check for devm_gpiod_get" -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Rafał Miłecki - -[ Upstream commit d91adc5322ab53df4b6d1989242bfb6c63163eb2 ] - -This reverts commit f3de5d857bb2362b00e2a8d4bc886cd49dcb66db. - -That commit broke USB on all routers that have USB always powered on and -don't require toggling any GPIO. It's a majority of devices actually. - -The original code worked and seemed safe: vcc GPIO is optional and -bcma_hci_platform_power_gpio() takes care of checking the pointer before -using it. - -This revert fixes: -[ 10.801127] bcma_hcd: probe of bcma0:11 failed with error -2 - -Fixes: f3de5d857bb2 ("USB: bcma: Add a check for devm_gpiod_get") -Cc: stable -Cc: Chuhong Yuan -Signed-off-by: Rafał Miłecki -Link: https://lore.kernel.org/r/20210831065419.18371-1-zajec5@gmail.com -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: cd136706b4f9 ("USB: bcma: Make GPIO explicitly optional") -Signed-off-by: Sasha Levin ---- - drivers/usb/host/bcma-hcd.c | 5 +---- - 1 file changed, 1 insertion(+), 4 deletions(-) - -diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c -index 652fa29beb27..2400a826397a 100644 ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -406,12 +406,9 @@ static int bcma_hcd_probe(struct bcma_device *core) - return -ENOMEM; - usb_dev->core = core; - -- if (core->dev.of_node) { -+ if (core->dev.of_node) - usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", - GPIOD_OUT_HIGH); -- if (IS_ERR(usb_dev->gpio_desc)) -- return PTR_ERR(usb_dev->gpio_desc); -- } - - switch (core->id.id) { - case BCMA_CORE_USB20_HOST: --- -2.35.1 - diff --git a/queue-4.19/series b/queue-4.19/series index 1ea3f8910b2..34e7f454c26 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -40,10 +40,6 @@ iio-ms5611-simplify-io-callback-parameters.patch iio-pressure-ms5611-fixed-value-compensation-bug.patch ceph-do-not-update-snapshot-context-when-there-is-no.patch ceph-avoid-putting-the-realm-twice-when-decoding-sna.patch -usb-bcma-add-a-check-for-devm_gpiod_get.patch -driver-core-add-device-probe-log-helper.patch -revert-usb-bcma-add-a-check-for-devm_gpiod_get.patch -usb-bcma-make-gpio-explicitly-optional.patch nilfs2-fix-nilfs_sufile_mark_dirty-not-set-segment-usage-as-dirty.patch input-synaptics-switch-touchpad-on-hp-laptop-15-da30.patch serial-8250-8250_omap-avoid-rs485-rts-glitch-on-set_.patch diff --git a/queue-4.19/usb-bcma-add-a-check-for-devm_gpiod_get.patch b/queue-4.19/usb-bcma-add-a-check-for-devm_gpiod_get.patch deleted file mode 100644 index f44c97bccce..00000000000 --- a/queue-4.19/usb-bcma-add-a-check-for-devm_gpiod_get.patch +++ /dev/null @@ -1,43 +0,0 @@ -From d66cf0f9f69975c272707f73673ed9141267839a Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 16 Oct 2019 16:35:32 +0800 -Subject: USB: bcma: Add a check for devm_gpiod_get - -From: Chuhong Yuan - -[ Upstream commit f3de5d857bb2362b00e2a8d4bc886cd49dcb66db ] - -bcma_hcd_probe misses a check for devm_gpiod_get and may miss -the error. -Add a check for it and return the error if a failure occurs. - -Signed-off-by: Chuhong Yuan -Link: https://lore.kernel.org/r/20191016083531.5734-1-hslester96@gmail.com -Signed-off-by: Greg Kroah-Hartman -Stable-dep-of: cd136706b4f9 ("USB: bcma: Make GPIO explicitly optional") -Signed-off-by: Sasha Levin ---- - drivers/usb/host/bcma-hcd.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c -index 2400a826397a..652fa29beb27 100644 ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -406,9 +406,12 @@ static int bcma_hcd_probe(struct bcma_device *core) - return -ENOMEM; - usb_dev->core = core; - -- if (core->dev.of_node) -+ if (core->dev.of_node) { - usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", - GPIOD_OUT_HIGH); -+ if (IS_ERR(usb_dev->gpio_desc)) -+ return PTR_ERR(usb_dev->gpio_desc); -+ } - - switch (core->id.id) { - case BCMA_CORE_USB20_HOST: --- -2.35.1 - diff --git a/queue-4.19/usb-bcma-make-gpio-explicitly-optional.patch b/queue-4.19/usb-bcma-make-gpio-explicitly-optional.patch deleted file mode 100644 index 18be8a09d1c..00000000000 --- a/queue-4.19/usb-bcma-make-gpio-explicitly-optional.patch +++ /dev/null @@ -1,71 +0,0 @@ -From ac44493f24a7b75ab8b62b826875b87ca28d51bf Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 7 Nov 2022 10:07:53 +0100 -Subject: USB: bcma: Make GPIO explicitly optional -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Linus Walleij - -[ Upstream commit cd136706b4f925aa5d316642543babac90d45910 ] - -What the code does is to not check the return value from -devm_gpiod_get() and then avoid using an erroneous GPIO descriptor -with IS_ERR_OR_NULL(). - -This will miss real errors from the GPIO core that should not be -ignored, such as probe deferral. - -Instead request the GPIO as explicitly optional, which means that -if it doesn't exist, the descriptor returned will be NULL. - -Then we can add error handling and also avoid just doing this on -the device tree path, and simplify the site where the optional -GPIO descriptor is used. - -There were some problems with cleaning up this GPIO descriptor -use in the past, but this is the proper way to deal with it. - -Cc: Rafał Miłecki -Cc: Chuhong Yuan -Signed-off-by: Linus Walleij -Cc: stable -Link: https://lore.kernel.org/r/20221107090753.1404679-1-linus.walleij@linaro.org -Signed-off-by: Greg Kroah-Hartman -Signed-off-by: Sasha Levin ---- - drivers/usb/host/bcma-hcd.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c -index 2400a826397a..d8f2af8fb89d 100644 ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -285,7 +285,7 @@ static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val) - { - struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); - -- if (IS_ERR_OR_NULL(usb_dev->gpio_desc)) -+ if (!usb_dev->gpio_desc) - return; - - gpiod_set_value(usb_dev->gpio_desc, val); -@@ -406,9 +406,11 @@ static int bcma_hcd_probe(struct bcma_device *core) - return -ENOMEM; - usb_dev->core = core; - -- if (core->dev.of_node) -- usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", -- GPIOD_OUT_HIGH); -+ usb_dev->gpio_desc = devm_gpiod_get_optional(&core->dev, "vcc", -+ GPIOD_OUT_HIGH); -+ if (IS_ERR(usb_dev->gpio_desc)) -+ return dev_err_probe(&core->dev, PTR_ERR(usb_dev->gpio_desc), -+ "error obtaining VCC GPIO"); - - switch (core->id.id) { - case BCMA_CORE_USB20_HOST: --- -2.35.1 - diff --git a/queue-5.4/series b/queue-5.4/series index bdccceddfc3..51f97013992 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -52,7 +52,6 @@ iio-ms5611-simplify-io-callback-parameters.patch iio-pressure-ms5611-fixed-value-compensation-bug.patch ceph-do-not-update-snapshot-context-when-there-is-no.patch ceph-avoid-putting-the-realm-twice-when-decoding-sna.patch -usb-bcma-make-gpio-explicitly-optional.patch firmware-google-release-devices-before-unregistering.patch firmware-coreboot-register-bus-in-module-init.patch nilfs2-fix-nilfs_sufile_mark_dirty-not-set-segment-usage-as-dirty.patch diff --git a/queue-5.4/usb-bcma-make-gpio-explicitly-optional.patch b/queue-5.4/usb-bcma-make-gpio-explicitly-optional.patch deleted file mode 100644 index 413af996fdd..00000000000 --- a/queue-5.4/usb-bcma-make-gpio-explicitly-optional.patch +++ /dev/null @@ -1,71 +0,0 @@ -From fc6503b10494eb9d7c522ee466f06a34e9868e76 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 7 Nov 2022 10:07:53 +0100 -Subject: USB: bcma: Make GPIO explicitly optional -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -From: Linus Walleij - -[ Upstream commit cd136706b4f925aa5d316642543babac90d45910 ] - -What the code does is to not check the return value from -devm_gpiod_get() and then avoid using an erroneous GPIO descriptor -with IS_ERR_OR_NULL(). - -This will miss real errors from the GPIO core that should not be -ignored, such as probe deferral. - -Instead request the GPIO as explicitly optional, which means that -if it doesn't exist, the descriptor returned will be NULL. - -Then we can add error handling and also avoid just doing this on -the device tree path, and simplify the site where the optional -GPIO descriptor is used. - -There were some problems with cleaning up this GPIO descriptor -use in the past, but this is the proper way to deal with it. - -Cc: Rafał Miłecki -Cc: Chuhong Yuan -Signed-off-by: Linus Walleij -Cc: stable -Link: https://lore.kernel.org/r/20221107090753.1404679-1-linus.walleij@linaro.org -Signed-off-by: Greg Kroah-Hartman -Signed-off-by: Sasha Levin ---- - drivers/usb/host/bcma-hcd.c | 10 ++++++---- - 1 file changed, 6 insertions(+), 4 deletions(-) - -diff --git a/drivers/usb/host/bcma-hcd.c b/drivers/usb/host/bcma-hcd.c -index 2400a826397a..d8f2af8fb89d 100644 ---- a/drivers/usb/host/bcma-hcd.c -+++ b/drivers/usb/host/bcma-hcd.c -@@ -285,7 +285,7 @@ static void bcma_hci_platform_power_gpio(struct bcma_device *dev, bool val) - { - struct bcma_hcd_device *usb_dev = bcma_get_drvdata(dev); - -- if (IS_ERR_OR_NULL(usb_dev->gpio_desc)) -+ if (!usb_dev->gpio_desc) - return; - - gpiod_set_value(usb_dev->gpio_desc, val); -@@ -406,9 +406,11 @@ static int bcma_hcd_probe(struct bcma_device *core) - return -ENOMEM; - usb_dev->core = core; - -- if (core->dev.of_node) -- usb_dev->gpio_desc = devm_gpiod_get(&core->dev, "vcc", -- GPIOD_OUT_HIGH); -+ usb_dev->gpio_desc = devm_gpiod_get_optional(&core->dev, "vcc", -+ GPIOD_OUT_HIGH); -+ if (IS_ERR(usb_dev->gpio_desc)) -+ return dev_err_probe(&core->dev, PTR_ERR(usb_dev->gpio_desc), -+ "error obtaining VCC GPIO"); - - switch (core->id.id) { - case BCMA_CORE_USB20_HOST: --- -2.35.1 - -- 2.47.3