From: Greg Kroah-Hartman Date: Mon, 14 Jul 2025 12:54:39 +0000 (+0200) Subject: drop regulator and asoc patches from 5.10 and 5.4 X-Git-Tag: v5.15.188~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=9b2bbd91ede1f084075e868b6b26924d4f8e0cce;p=thirdparty%2Fkernel%2Fstable-queue.git drop regulator and asoc patches from 5.10 and 5.4 same issue as 5.15 --- diff --git a/queue-5.10/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch b/queue-5.10/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch deleted file mode 100644 index 894127166d..0000000000 --- a/queue-5.10/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch +++ /dev/null @@ -1,85 +0,0 @@ -From abb59de07dbce537619cdce4291ac0aec60aa6b8 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 24 Mar 2025 19:51:29 +0800 -Subject: ASoC: codec: wcd9335: Convert to GPIO descriptors - -From: Peng Fan - -[ Upstream commit d5099bc1b56417733f4cccf10c61ee74dadd5562 ] - -of_gpio.h is deprecated, update the driver to use GPIO descriptors. -- Use dev_gpiod_get to get GPIO descriptor. -- Use gpiod_set_value to configure output value. - -With legacy of_gpio API, the driver set gpio value 0 to assert reset, -and 1 to deassert reset. And the reset-gpios use GPIO_ACTIVE_LOW flag in -DTS, so set GPIOD_OUT_LOW when get GPIO descriptors, and set value 1 means -output low, set value 0 means output high with gpiod API. - -The in-tree DTS files have the right polarity set up already so we can -expect this to "just work" - -Reviewed-by: Linus Walleij -Signed-off-by: Peng Fan -Link: https://patch.msgid.link/20250324-wcd-gpiod-v2-3-773f67ce3b56@nxp.com -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index ac297bc6c9a12..a4d1cd296a76d 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -16,7 +16,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -338,7 +338,7 @@ struct wcd9335_codec { - int comp_enabled[COMPANDER_MAX]; - - int intr1; -- int reset_gpio; -+ struct gpio_desc *reset_gpio; - struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; - - unsigned int rx_port_value; -@@ -5024,12 +5024,11 @@ static const struct regmap_irq_chip wcd9335_regmap_irq1_chip = { - static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - { - struct device *dev = wcd->dev; -- struct device_node *np = dev->of_node; - int ret; - -- wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); -- if (wcd->reset_gpio < 0) -- return dev_err_probe(dev, wcd->reset_gpio, "Reset GPIO missing from DT\n"); -+ wcd->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); -+ if (IS_ERR(wcd->reset_gpio)) -+ return dev_err_probe(dev, PTR_ERR(wcd->reset_gpio), "Reset GPIO missing from DT\n"); - - wcd->mclk = devm_clk_get(dev, "mclk"); - if (IS_ERR(wcd->mclk)) -@@ -5072,9 +5071,9 @@ static int wcd9335_power_on_reset(struct wcd9335_codec *wcd) - */ - usleep_range(600, 650); - -- gpio_direction_output(wcd->reset_gpio, 0); -+ gpiod_set_value(wcd->reset_gpio, 1); - msleep(20); -- gpio_set_value(wcd->reset_gpio, 1); -+ gpiod_set_value(wcd->reset_gpio, 0); - msleep(20); - - return 0; --- -2.39.5 - diff --git a/queue-5.10/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch b/queue-5.10/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch deleted file mode 100644 index 698e944406..0000000000 --- a/queue-5.10/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch +++ /dev/null @@ -1,88 +0,0 @@ -From d123202ff5409b54bb2ad776f00cc88fb4f2717f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 26 May 2025 11:47:01 +0200 -Subject: ASoC: codecs: wcd9335: Fix missing free of regulator supplies - -From: Krzysztof Kozlowski - -[ Upstream commit 9079db287fc3e38e040b0edeb0a25770bb679c8e ] - -Driver gets and enables all regulator supplies in probe path -(wcd9335_parse_dt() and wcd9335_power_on_reset()), but does not cleanup -in final error paths and in unbind (missing remove() callback). This -leads to leaked memory and unbalanced regulator enable count during -probe errors or unbind. - -Fix this by converting entire code into devm_regulator_bulk_get_enable() -which also greatly simplifies the code. - -Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") -Cc: stable@vger.kernel.org -Signed-off-by: Krzysztof Kozlowski -Link: https://patch.msgid.link/20250526-b4-b4-asoc-wcd9395-vdd-px-fixes-v1-1-0b8a2993b7d3@linaro.org -Signed-off-by: Mark Brown -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 25 +++++++------------------ - 1 file changed, 7 insertions(+), 18 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index a4d1cd296a76d..fe364cb353967 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -339,7 +339,6 @@ struct wcd9335_codec { - - int intr1; - struct gpio_desc *reset_gpio; -- struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; - - unsigned int rx_port_value; - unsigned int tx_port_value; -@@ -366,6 +365,10 @@ struct wcd9335_irq { - char *name; - }; - -+static const char * const wcd9335_supplies[] = { -+ "vdd-buck", "vdd-buck-sido", "vdd-tx", "vdd-rx", "vdd-io", -+}; -+ - static const struct wcd9335_slim_ch wcd9335_tx_chs[WCD9335_TX_MAX] = { - WCD9335_SLIM_TX_CH(0), - WCD9335_SLIM_TX_CH(1), -@@ -5038,30 +5041,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - if (IS_ERR(wcd->native_clk)) - return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n"); - -- wcd->supplies[0].supply = "vdd-buck"; -- wcd->supplies[1].supply = "vdd-buck-sido"; -- wcd->supplies[2].supply = "vdd-tx"; -- wcd->supplies[3].supply = "vdd-rx"; -- wcd->supplies[4].supply = "vdd-io"; -- -- ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies); -+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd9335_supplies), -+ wcd9335_supplies); - if (ret) -- return dev_err_probe(dev, ret, "Failed to get supplies\n"); -+ return dev_err_probe(dev, ret, "Failed to get and enable supplies\n"); - - return 0; - } - - static int wcd9335_power_on_reset(struct wcd9335_codec *wcd) - { -- struct device *dev = wcd->dev; -- int ret; -- -- ret = regulator_bulk_enable(WCD9335_MAX_SUPPLY, wcd->supplies); -- if (ret) { -- dev_err(dev, "Failed to get supplies: err = %d\n", ret); -- return ret; -- } -- - /* - * For WCD9335, it takes about 600us for the Vout_A and - * Vout_D to be ready after BUCK_SIDO is powered up. --- -2.39.5 - diff --git a/queue-5.10/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch b/queue-5.10/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch deleted file mode 100644 index 7d6eaab8ea..0000000000 --- a/queue-5.10/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 38eac094424e3aa4dee1b706dc5e0e14be1864cb Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 12 Jun 2024 18:15:17 +0200 -Subject: ASoC: codecs: wcd9335: Handle nicer probe deferral and simplify with - dev_err_probe() - -From: Krzysztof Kozlowski - -[ Upstream commit 4a03b5dbad466c902d522f3405daa4e5d80578c5 ] - -wcd9335_parse_dt() function is called only from probe(), so printing -errors on resource acquisition is discouraged, because it can pollute -dmesg. Use dev_err_probe() to fix this and also make the code a bit -simpler. - -Signed-off-by: Krzysztof Kozlowski -Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-4-0d15885b2a06@linaro.org -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 28 +++++++++------------------- - 1 file changed, 9 insertions(+), 19 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index 33c29a1f52d00..ac297bc6c9a12 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -5028,22 +5028,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - int ret; - - wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); -- if (wcd->reset_gpio < 0) { -- dev_err(dev, "Reset GPIO missing from DT\n"); -- return wcd->reset_gpio; -- } -+ if (wcd->reset_gpio < 0) -+ return dev_err_probe(dev, wcd->reset_gpio, "Reset GPIO missing from DT\n"); - - wcd->mclk = devm_clk_get(dev, "mclk"); -- if (IS_ERR(wcd->mclk)) { -- dev_err(dev, "mclk not found\n"); -- return PTR_ERR(wcd->mclk); -- } -+ if (IS_ERR(wcd->mclk)) -+ return dev_err_probe(dev, PTR_ERR(wcd->mclk), "mclk not found\n"); - - wcd->native_clk = devm_clk_get(dev, "slimbus"); -- if (IS_ERR(wcd->native_clk)) { -- dev_err(dev, "slimbus clock not found\n"); -- return PTR_ERR(wcd->native_clk); -- } -+ if (IS_ERR(wcd->native_clk)) -+ return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n"); - - wcd->supplies[0].supply = "vdd-buck"; - wcd->supplies[1].supply = "vdd-buck-sido"; -@@ -5052,10 +5046,8 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - wcd->supplies[4].supply = "vdd-io"; - - ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies); -- if (ret) { -- dev_err(dev, "Failed to get supplies: err = %d\n", ret); -- return ret; -- } -+ if (ret) -+ return dev_err_probe(dev, ret, "Failed to get supplies\n"); - - return 0; - } -@@ -5158,10 +5150,8 @@ static int wcd9335_slim_probe(struct slim_device *slim) - - wcd->dev = dev; - ret = wcd9335_parse_dt(wcd); -- if (ret) { -- dev_err(dev, "Error parsing DT: %d\n", ret); -+ if (ret) - return ret; -- } - - ret = wcd9335_power_on_reset(wcd); - if (ret) --- -2.39.5 - diff --git a/queue-5.10/regulator-add-devm-helpers-for-get-and-enable.patch b/queue-5.10/regulator-add-devm-helpers-for-get-and-enable.patch deleted file mode 100644 index 24270f623c..0000000000 --- a/queue-5.10/regulator-add-devm-helpers-for-get-and-enable.patch +++ /dev/null @@ -1,283 +0,0 @@ -From b0d350e9828b248dd7b4c2cbdec4fbcba6ae05df Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 12 Aug 2022 13:10:37 +0300 -Subject: regulator: Add devm helpers for get and enable - -From: Matti Vaittinen - -[ Upstream commit da279e6965b3838e99e5c0ab8f76b87bf86b31a5 ] - -A few regulator consumer drivers seem to be just getting a regulator, -enabling it and registering a devm-action to disable the regulator at -the driver detach and then forget about it. - -We can simplify this a bit by adding a devm-helper for this pattern. -Add devm_regulator_get_enable() and devm_regulator_get_enable_optional() - -Signed-off-by: Matti Vaittinen -Link: https://lore.kernel.org/r/ed7b8841193bb9749d426f3cb3b199c9460794cd.1660292316.git.mazziesaccount@gmail.com -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - drivers/regulator/devres.c | 164 +++++++++++++++++++++++++++++ - include/linux/regulator/consumer.h | 27 +++++ - 2 files changed, 191 insertions(+) - -diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c -index 9aec9541f78fc..e9fb842e82faa 100644 ---- a/drivers/regulator/devres.c -+++ b/drivers/regulator/devres.c -@@ -70,6 +70,65 @@ struct regulator *devm_regulator_get_exclusive(struct device *dev, - } - EXPORT_SYMBOL_GPL(devm_regulator_get_exclusive); - -+static void regulator_action_disable(void *d) -+{ -+ struct regulator *r = (struct regulator *)d; -+ -+ regulator_disable(r); -+} -+ -+static int _devm_regulator_get_enable(struct device *dev, const char *id, -+ int get_type) -+{ -+ struct regulator *r; -+ int ret; -+ -+ r = _devm_regulator_get(dev, id, get_type); -+ if (IS_ERR(r)) -+ return PTR_ERR(r); -+ -+ ret = regulator_enable(r); -+ if (!ret) -+ ret = devm_add_action_or_reset(dev, ®ulator_action_disable, r); -+ -+ if (ret) -+ devm_regulator_put(r); -+ -+ return ret; -+} -+ -+/** -+ * devm_regulator_get_enable_optional - Resource managed regulator get and enable -+ * @dev: device to supply -+ * @id: supply name or regulator ID. -+ * -+ * Get and enable regulator for duration of the device life-time. -+ * regulator_disable() and regulator_put() are automatically called on driver -+ * detach. See regulator_get_optional() and regulator_enable() for more -+ * information. -+ */ -+int devm_regulator_get_enable_optional(struct device *dev, const char *id) -+{ -+ return _devm_regulator_get_enable(dev, id, OPTIONAL_GET); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_get_enable_optional); -+ -+/** -+ * devm_regulator_get_enable - Resource managed regulator get and enable -+ * @dev: device to supply -+ * @id: supply name or regulator ID. -+ * -+ * Get and enable regulator for duration of the device life-time. -+ * regulator_disable() and regulator_put() are automatically called on driver -+ * detach. See regulator_get() and regulator_enable() for more -+ * information. -+ */ -+int devm_regulator_get_enable(struct device *dev, const char *id) -+{ -+ return _devm_regulator_get_enable(dev, id, NORMAL_GET); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_get_enable); -+ - /** - * devm_regulator_get_optional - Resource managed regulator_get_optional() - * @dev: device to supply -@@ -194,6 +253,111 @@ int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, - } - EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const); - -+static int devm_regulator_bulk_match(struct device *dev, void *res, -+ void *data) -+{ -+ struct regulator_bulk_devres *match = res; -+ struct regulator_bulk_data *target = data; -+ -+ /* -+ * We check the put uses same consumer list as the get did. -+ * We _could_ scan all entries in consumer array and check the -+ * regulators match but ATM I don't see the need. We can change this -+ * later if needed. -+ */ -+ return match->consumers == target; -+} -+ -+/** -+ * devm_regulator_bulk_put - Resource managed regulator_bulk_put() -+ * @consumers: consumers to free -+ * -+ * Deallocate regulators allocated with devm_regulator_bulk_get(). Normally -+ * this function will not need to be called and the resource management -+ * code will ensure that the resource is freed. -+ */ -+void devm_regulator_bulk_put(struct regulator_bulk_data *consumers) -+{ -+ int rc; -+ struct regulator *regulator = consumers[0].consumer; -+ -+ rc = devres_release(regulator->dev, devm_regulator_bulk_release, -+ devm_regulator_bulk_match, consumers); -+ if (rc != 0) -+ WARN_ON(rc); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_put); -+ -+static void devm_regulator_bulk_disable(void *res) -+{ -+ struct regulator_bulk_devres *devres = res; -+ int i; -+ -+ for (i = 0; i < devres->num_consumers; i++) -+ regulator_disable(devres->consumers[i].consumer); -+} -+ -+/** -+ * devm_regulator_bulk_get_enable - managed get'n enable multiple regulators -+ * -+ * @dev: device to supply -+ * @num_consumers: number of consumers to register -+ * @id: list of supply names or regulator IDs -+ * -+ * @return 0 on success, an errno on failure. -+ * -+ * This helper function allows drivers to get several regulator -+ * consumers in one operation with management, the regulators will -+ * automatically be freed when the device is unbound. If any of the -+ * regulators cannot be acquired then any regulators that were -+ * allocated will be freed before returning to the caller. -+ */ -+int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, -+ const char * const *id) -+{ -+ struct regulator_bulk_devres *devres; -+ struct regulator_bulk_data *consumers; -+ int i, ret; -+ -+ devres = devm_kmalloc(dev, sizeof(*devres), GFP_KERNEL); -+ if (!devres) -+ return -ENOMEM; -+ -+ devres->consumers = devm_kcalloc(dev, num_consumers, sizeof(*consumers), -+ GFP_KERNEL); -+ consumers = devres->consumers; -+ if (!consumers) -+ return -ENOMEM; -+ -+ devres->num_consumers = num_consumers; -+ -+ for (i = 0; i < num_consumers; i++) -+ consumers[i].supply = id[i]; -+ -+ ret = devm_regulator_bulk_get(dev, num_consumers, consumers); -+ if (ret) -+ return ret; -+ -+ for (i = 0; i < num_consumers; i++) { -+ ret = regulator_enable(consumers[i].consumer); -+ if (ret) -+ goto unwind; -+ } -+ -+ ret = devm_add_action(dev, devm_regulator_bulk_disable, devres); -+ if (!ret) -+ return 0; -+ -+unwind: -+ while (--i >= 0) -+ regulator_disable(consumers[i].consumer); -+ -+ devm_regulator_bulk_put(consumers); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_enable); -+ - static void devm_rdev_release(struct device *dev, void *res) - { - regulator_unregister(*(struct regulator_dev **)res); -diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h -index bba7c3e4cd870..3abb23c68fde7 100644 ---- a/include/linux/regulator/consumer.h -+++ b/include/linux/regulator/consumer.h -@@ -189,6 +189,8 @@ struct regulator *__must_check regulator_get_optional(struct device *dev, - const char *id); - struct regulator *__must_check devm_regulator_get_optional(struct device *dev, - const char *id); -+int devm_regulator_get_enable(struct device *dev, const char *id); -+int devm_regulator_get_enable_optional(struct device *dev, const char *id); - void regulator_put(struct regulator *regulator); - void devm_regulator_put(struct regulator *regulator); - -@@ -231,12 +233,15 @@ int __must_check regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); -+void devm_regulator_bulk_put(struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get_const( - struct device *dev, int num_consumers, - const struct regulator_bulk_data *in_consumers, - struct regulator_bulk_data **out_consumers); - int __must_check regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers); -+int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, -+ const char * const *id); - int regulator_bulk_disable(int num_consumers, - struct regulator_bulk_data *consumers); - int regulator_bulk_force_disable(int num_consumers, -@@ -341,6 +346,17 @@ devm_regulator_get_exclusive(struct device *dev, const char *id) - return ERR_PTR(-ENODEV); - } - -+static inline int devm_regulator_get_enable(struct device *dev, const char *id) -+{ -+ return -ENODEV; -+} -+ -+static inline int devm_regulator_get_enable_optional(struct device *dev, -+ const char *id) -+{ -+ return -ENODEV; -+} -+ - static inline struct regulator *__must_check - regulator_get_optional(struct device *dev, const char *id) - { -@@ -362,6 +378,10 @@ static inline void devm_regulator_put(struct regulator *regulator) - { - } - -+static inline void devm_regulator_bulk_put(struct regulator_bulk_data *consumers) -+{ -+} -+ - static inline int regulator_register_supply_alias(struct device *dev, - const char *id, - struct device *alias_dev, -@@ -462,6 +482,13 @@ static inline int regulator_bulk_enable(int num_consumers, - return 0; - } - -+static inline int devm_regulator_bulk_get_enable(struct device *dev, -+ int num_consumers, -+ const char * const *id) -+{ -+ return 0; -+} -+ - static inline int regulator_bulk_disable(int num_consumers, - struct regulator_bulk_data *consumers) - { --- -2.39.5 - diff --git a/queue-5.10/regulator-core-allow-drivers-to-define-their-init-da.patch b/queue-5.10/regulator-core-allow-drivers-to-define-their-init-da.patch deleted file mode 100644 index 450fbe57ff..0000000000 --- a/queue-5.10/regulator-core-allow-drivers-to-define-their-init-da.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 7b7b3dd1748d9e2267e2083ae8a2f3b885aec12d Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 26 Jul 2022 10:38:23 -0700 -Subject: regulator: core: Allow drivers to define their init data as const - -From: Douglas Anderson - -[ Upstream commit 1de452a0edda26f1483d1d934f692eab13ba669a ] - -Drivers tend to want to define the names of their regulators somewhere -in their source file as "static const". This means, inevitable, that -every driver out there open codes something like this: - -static const char * const supply_names[] = { - "vcc", "vccl", -}; - -static int get_regulators(struct my_data *data) -{ - int i; - - data->supplies = devm_kzalloc(...) - if (!data->supplies) - return -ENOMEM; - - for (i = 0; i < ARRAY_SIZE(supply_names); i++) - data->supplies[i].supply = supply_names[i]; - - return devm_regulator_bulk_get(data->dev, - ARRAY_SIZE(supply_names), - data->supplies); -} - -Let's make this more convenient by doing providing a helper that does -the copy. - -I have chosen to have the "const" input structure here be the exact -same structure as the normal one passed to -devm_regulator_bulk_get(). This is slightly inefficent since the input -data can't possibly have anything useful for "ret" or consumer and -thus we waste 8 bytes per structure. This seems an OK tradeoff for not -introducing an extra structure. - -Signed-off-by: Douglas Anderson -Link: https://lore.kernel.org/r/20220726103631.v2.6.I38fc508a73135a5c1b873851f3553ff2a3a625f5@changeid -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - drivers/regulator/devres.c | 28 ++++++++++++++++++++++++++++ - include/linux/regulator/consumer.h | 4 ++++ - 2 files changed, 32 insertions(+) - -diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c -index 3091210889e31..9aec9541f78fc 100644 ---- a/drivers/regulator/devres.c -+++ b/drivers/regulator/devres.c -@@ -166,6 +166,34 @@ int devm_regulator_bulk_get(struct device *dev, int num_consumers, - } - EXPORT_SYMBOL_GPL(devm_regulator_bulk_get); - -+/** -+ * devm_regulator_bulk_get_const - devm_regulator_bulk_get() w/ const data -+ * -+ * @dev: device to supply -+ * @num_consumers: number of consumers to register -+ * @in_consumers: const configuration of consumers -+ * @out_consumers: in_consumers is copied here and this is passed to -+ * devm_regulator_bulk_get(). -+ * -+ * This is a convenience function to allow bulk regulator configuration -+ * to be stored "static const" in files. -+ * -+ * Return: 0 on success, an errno on failure. -+ */ -+int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, -+ const struct regulator_bulk_data *in_consumers, -+ struct regulator_bulk_data **out_consumers) -+{ -+ *out_consumers = devm_kmemdup(dev, in_consumers, -+ num_consumers * sizeof(*in_consumers), -+ GFP_KERNEL); -+ if (*out_consumers == NULL) -+ return -ENOMEM; -+ -+ return devm_regulator_bulk_get(dev, num_consumers, *out_consumers); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const); -+ - static void devm_rdev_release(struct device *dev, void *res) - { - regulator_unregister(*(struct regulator_dev **)res); -diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h -index 20e84a84fb779..bba7c3e4cd870 100644 ---- a/include/linux/regulator/consumer.h -+++ b/include/linux/regulator/consumer.h -@@ -231,6 +231,10 @@ int __must_check regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); -+int __must_check devm_regulator_bulk_get_const( -+ struct device *dev, int num_consumers, -+ const struct regulator_bulk_data *in_consumers, -+ struct regulator_bulk_data **out_consumers); - int __must_check regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers); - int regulator_bulk_disable(int num_consumers, --- -2.39.5 - diff --git a/queue-5.10/series b/queue-5.10/series index d4e1af5f6f..6e6bfcb611 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -30,11 +30,6 @@ usb-typec-tcpm-tcpci_maxim-fix-bounds-check-in-proce.patch fs-jfs-consolidate-sanity-checking-in-dbmount.patch jfs-validate-ag-parameters-in-dbmount-to-prevent-cra.patch media-omap3isp-use-sgtable-based-scatterlist-wrapper.patch -regulator-core-allow-drivers-to-define-their-init-da.patch -regulator-add-devm-helpers-for-get-and-enable.patch -asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch -asoc-codec-wcd9335-convert-to-gpio-descriptors.patch -asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch can-tcan4x5x-fix-power-regulator-retrieval-during-pr.patch f2fs-don-t-over-report-free-space-or-inodes-in-statv.patch rdma-core-use-refcount_t-instead-of-atomic_t-on-refc.patch diff --git a/queue-5.4/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch b/queue-5.4/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch deleted file mode 100644 index 111fc04219..0000000000 --- a/queue-5.4/asoc-codec-wcd9335-convert-to-gpio-descriptors.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 0e5651eed4a47f98c947e2ea862884c4c8e19f89 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 24 Mar 2025 19:51:29 +0800 -Subject: ASoC: codec: wcd9335: Convert to GPIO descriptors - -From: Peng Fan - -[ Upstream commit d5099bc1b56417733f4cccf10c61ee74dadd5562 ] - -of_gpio.h is deprecated, update the driver to use GPIO descriptors. -- Use dev_gpiod_get to get GPIO descriptor. -- Use gpiod_set_value to configure output value. - -With legacy of_gpio API, the driver set gpio value 0 to assert reset, -and 1 to deassert reset. And the reset-gpios use GPIO_ACTIVE_LOW flag in -DTS, so set GPIOD_OUT_LOW when get GPIO descriptors, and set value 1 means -output low, set value 0 means output high with gpiod API. - -The in-tree DTS files have the right polarity set up already so we can -expect this to "just work" - -Reviewed-by: Linus Walleij -Signed-off-by: Peng Fan -Link: https://patch.msgid.link/20250324-wcd-gpiod-v2-3-773f67ce3b56@nxp.com -Reviewed-by: Bartosz Golaszewski -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 15 +++++++-------- - 1 file changed, 7 insertions(+), 8 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index 61e3da5ec1ae3..98a4c613e400f 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -16,7 +16,7 @@ - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -338,7 +338,7 @@ struct wcd9335_codec { - int comp_enabled[COMPANDER_MAX]; - - int intr1; -- int reset_gpio; -+ struct gpio_desc *reset_gpio; - struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; - - unsigned int rx_port_value; -@@ -5024,12 +5024,11 @@ static const struct regmap_irq_chip wcd9335_regmap_irq1_chip = { - static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - { - struct device *dev = wcd->dev; -- struct device_node *np = dev->of_node; - int ret; - -- wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); -- if (wcd->reset_gpio < 0) -- return dev_err_probe(dev, wcd->reset_gpio, "Reset GPIO missing from DT\n"); -+ wcd->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); -+ if (IS_ERR(wcd->reset_gpio)) -+ return dev_err_probe(dev, PTR_ERR(wcd->reset_gpio), "Reset GPIO missing from DT\n"); - - wcd->mclk = devm_clk_get(dev, "mclk"); - if (IS_ERR(wcd->mclk)) -@@ -5072,9 +5071,9 @@ static int wcd9335_power_on_reset(struct wcd9335_codec *wcd) - */ - usleep_range(600, 650); - -- gpio_direction_output(wcd->reset_gpio, 0); -+ gpiod_set_value(wcd->reset_gpio, 1); - msleep(20); -- gpio_set_value(wcd->reset_gpio, 1); -+ gpiod_set_value(wcd->reset_gpio, 0); - msleep(20); - - return 0; --- -2.39.5 - diff --git a/queue-5.4/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch b/queue-5.4/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch deleted file mode 100644 index 64fbd3af3f..0000000000 --- a/queue-5.4/asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch +++ /dev/null @@ -1,88 +0,0 @@ -From abfba995c67afea3452f2bacabb983d5452048c7 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Mon, 26 May 2025 11:47:01 +0200 -Subject: ASoC: codecs: wcd9335: Fix missing free of regulator supplies - -From: Krzysztof Kozlowski - -[ Upstream commit 9079db287fc3e38e040b0edeb0a25770bb679c8e ] - -Driver gets and enables all regulator supplies in probe path -(wcd9335_parse_dt() and wcd9335_power_on_reset()), but does not cleanup -in final error paths and in unbind (missing remove() callback). This -leads to leaked memory and unbalanced regulator enable count during -probe errors or unbind. - -Fix this by converting entire code into devm_regulator_bulk_get_enable() -which also greatly simplifies the code. - -Fixes: 20aedafdf492 ("ASoC: wcd9335: add support to wcd9335 codec") -Cc: stable@vger.kernel.org -Signed-off-by: Krzysztof Kozlowski -Link: https://patch.msgid.link/20250526-b4-b4-asoc-wcd9395-vdd-px-fixes-v1-1-0b8a2993b7d3@linaro.org -Signed-off-by: Mark Brown -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 25 +++++++------------------ - 1 file changed, 7 insertions(+), 18 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index 98a4c613e400f..5e4373987e2aa 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -339,7 +339,6 @@ struct wcd9335_codec { - - int intr1; - struct gpio_desc *reset_gpio; -- struct regulator_bulk_data supplies[WCD9335_MAX_SUPPLY]; - - unsigned int rx_port_value; - unsigned int tx_port_value; -@@ -366,6 +365,10 @@ struct wcd9335_irq { - char *name; - }; - -+static const char * const wcd9335_supplies[] = { -+ "vdd-buck", "vdd-buck-sido", "vdd-tx", "vdd-rx", "vdd-io", -+}; -+ - static const struct wcd9335_slim_ch wcd9335_tx_chs[WCD9335_TX_MAX] = { - WCD9335_SLIM_TX_CH(0), - WCD9335_SLIM_TX_CH(1), -@@ -5038,30 +5041,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - if (IS_ERR(wcd->native_clk)) - return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n"); - -- wcd->supplies[0].supply = "vdd-buck"; -- wcd->supplies[1].supply = "vdd-buck-sido"; -- wcd->supplies[2].supply = "vdd-tx"; -- wcd->supplies[3].supply = "vdd-rx"; -- wcd->supplies[4].supply = "vdd-io"; -- -- ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies); -+ ret = devm_regulator_bulk_get_enable(dev, ARRAY_SIZE(wcd9335_supplies), -+ wcd9335_supplies); - if (ret) -- return dev_err_probe(dev, ret, "Failed to get supplies\n"); -+ return dev_err_probe(dev, ret, "Failed to get and enable supplies\n"); - - return 0; - } - - static int wcd9335_power_on_reset(struct wcd9335_codec *wcd) - { -- struct device *dev = wcd->dev; -- int ret; -- -- ret = regulator_bulk_enable(WCD9335_MAX_SUPPLY, wcd->supplies); -- if (ret) { -- dev_err(dev, "Failed to get supplies: err = %d\n", ret); -- return ret; -- } -- - /* - * For WCD9335, it takes about 600us for the Vout_A and - * Vout_D to be ready after BUCK_SIDO is powered up. --- -2.39.5 - diff --git a/queue-5.4/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch b/queue-5.4/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch deleted file mode 100644 index 00e90b22cd..0000000000 --- a/queue-5.4/asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch +++ /dev/null @@ -1,85 +0,0 @@ -From dc639c2d0b154b2f556aeeb2d1defd59d95f1e31 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 12 Jun 2024 18:15:17 +0200 -Subject: ASoC: codecs: wcd9335: Handle nicer probe deferral and simplify with - dev_err_probe() - -From: Krzysztof Kozlowski - -[ Upstream commit 4a03b5dbad466c902d522f3405daa4e5d80578c5 ] - -wcd9335_parse_dt() function is called only from probe(), so printing -errors on resource acquisition is discouraged, because it can pollute -dmesg. Use dev_err_probe() to fix this and also make the code a bit -simpler. - -Signed-off-by: Krzysztof Kozlowski -Link: https://msgid.link/r/20240612-asoc-wcd9xxx-wide-cleanups-v1-4-0d15885b2a06@linaro.org -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - sound/soc/codecs/wcd9335.c | 28 +++++++++------------------- - 1 file changed, 9 insertions(+), 19 deletions(-) - -diff --git a/sound/soc/codecs/wcd9335.c b/sound/soc/codecs/wcd9335.c -index a952b94545130..61e3da5ec1ae3 100644 ---- a/sound/soc/codecs/wcd9335.c -+++ b/sound/soc/codecs/wcd9335.c -@@ -5028,22 +5028,16 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - int ret; - - wcd->reset_gpio = of_get_named_gpio(np, "reset-gpios", 0); -- if (wcd->reset_gpio < 0) { -- dev_err(dev, "Reset GPIO missing from DT\n"); -- return wcd->reset_gpio; -- } -+ if (wcd->reset_gpio < 0) -+ return dev_err_probe(dev, wcd->reset_gpio, "Reset GPIO missing from DT\n"); - - wcd->mclk = devm_clk_get(dev, "mclk"); -- if (IS_ERR(wcd->mclk)) { -- dev_err(dev, "mclk not found\n"); -- return PTR_ERR(wcd->mclk); -- } -+ if (IS_ERR(wcd->mclk)) -+ return dev_err_probe(dev, PTR_ERR(wcd->mclk), "mclk not found\n"); - - wcd->native_clk = devm_clk_get(dev, "slimbus"); -- if (IS_ERR(wcd->native_clk)) { -- dev_err(dev, "slimbus clock not found\n"); -- return PTR_ERR(wcd->native_clk); -- } -+ if (IS_ERR(wcd->native_clk)) -+ return dev_err_probe(dev, PTR_ERR(wcd->native_clk), "slimbus clock not found\n"); - - wcd->supplies[0].supply = "vdd-buck"; - wcd->supplies[1].supply = "vdd-buck-sido"; -@@ -5052,10 +5046,8 @@ static int wcd9335_parse_dt(struct wcd9335_codec *wcd) - wcd->supplies[4].supply = "vdd-io"; - - ret = regulator_bulk_get(dev, WCD9335_MAX_SUPPLY, wcd->supplies); -- if (ret) { -- dev_err(dev, "Failed to get supplies: err = %d\n", ret); -- return ret; -- } -+ if (ret) -+ return dev_err_probe(dev, ret, "Failed to get supplies\n"); - - return 0; - } -@@ -5158,10 +5150,8 @@ static int wcd9335_slim_probe(struct slim_device *slim) - - wcd->dev = dev; - ret = wcd9335_parse_dt(wcd); -- if (ret) { -- dev_err(dev, "Error parsing DT: %d\n", ret); -+ if (ret) - return ret; -- } - - ret = wcd9335_power_on_reset(wcd); - if (ret) --- -2.39.5 - diff --git a/queue-5.4/regulator-add-devm-helpers-for-get-and-enable.patch b/queue-5.4/regulator-add-devm-helpers-for-get-and-enable.patch deleted file mode 100644 index fc59508f83..0000000000 --- a/queue-5.4/regulator-add-devm-helpers-for-get-and-enable.patch +++ /dev/null @@ -1,283 +0,0 @@ -From e2fe9d4626853de1ec63fa984bc52398c782d032 Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Fri, 12 Aug 2022 13:10:37 +0300 -Subject: regulator: Add devm helpers for get and enable - -From: Matti Vaittinen - -[ Upstream commit da279e6965b3838e99e5c0ab8f76b87bf86b31a5 ] - -A few regulator consumer drivers seem to be just getting a regulator, -enabling it and registering a devm-action to disable the regulator at -the driver detach and then forget about it. - -We can simplify this a bit by adding a devm-helper for this pattern. -Add devm_regulator_get_enable() and devm_regulator_get_enable_optional() - -Signed-off-by: Matti Vaittinen -Link: https://lore.kernel.org/r/ed7b8841193bb9749d426f3cb3b199c9460794cd.1660292316.git.mazziesaccount@gmail.com -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - drivers/regulator/devres.c | 164 +++++++++++++++++++++++++++++ - include/linux/regulator/consumer.h | 27 +++++ - 2 files changed, 191 insertions(+) - -diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c -index 762cc3ed85e9c..13b7d9e18d383 100644 ---- a/drivers/regulator/devres.c -+++ b/drivers/regulator/devres.c -@@ -70,6 +70,65 @@ struct regulator *devm_regulator_get_exclusive(struct device *dev, - } - EXPORT_SYMBOL_GPL(devm_regulator_get_exclusive); - -+static void regulator_action_disable(void *d) -+{ -+ struct regulator *r = (struct regulator *)d; -+ -+ regulator_disable(r); -+} -+ -+static int _devm_regulator_get_enable(struct device *dev, const char *id, -+ int get_type) -+{ -+ struct regulator *r; -+ int ret; -+ -+ r = _devm_regulator_get(dev, id, get_type); -+ if (IS_ERR(r)) -+ return PTR_ERR(r); -+ -+ ret = regulator_enable(r); -+ if (!ret) -+ ret = devm_add_action_or_reset(dev, ®ulator_action_disable, r); -+ -+ if (ret) -+ devm_regulator_put(r); -+ -+ return ret; -+} -+ -+/** -+ * devm_regulator_get_enable_optional - Resource managed regulator get and enable -+ * @dev: device to supply -+ * @id: supply name or regulator ID. -+ * -+ * Get and enable regulator for duration of the device life-time. -+ * regulator_disable() and regulator_put() are automatically called on driver -+ * detach. See regulator_get_optional() and regulator_enable() for more -+ * information. -+ */ -+int devm_regulator_get_enable_optional(struct device *dev, const char *id) -+{ -+ return _devm_regulator_get_enable(dev, id, OPTIONAL_GET); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_get_enable_optional); -+ -+/** -+ * devm_regulator_get_enable - Resource managed regulator get and enable -+ * @dev: device to supply -+ * @id: supply name or regulator ID. -+ * -+ * Get and enable regulator for duration of the device life-time. -+ * regulator_disable() and regulator_put() are automatically called on driver -+ * detach. See regulator_get() and regulator_enable() for more -+ * information. -+ */ -+int devm_regulator_get_enable(struct device *dev, const char *id) -+{ -+ return _devm_regulator_get_enable(dev, id, NORMAL_GET); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_get_enable); -+ - /** - * devm_regulator_get_optional - Resource managed regulator_get_optional() - * @dev: device for regulator "consumer" -@@ -194,6 +253,111 @@ int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, - } - EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const); - -+static int devm_regulator_bulk_match(struct device *dev, void *res, -+ void *data) -+{ -+ struct regulator_bulk_devres *match = res; -+ struct regulator_bulk_data *target = data; -+ -+ /* -+ * We check the put uses same consumer list as the get did. -+ * We _could_ scan all entries in consumer array and check the -+ * regulators match but ATM I don't see the need. We can change this -+ * later if needed. -+ */ -+ return match->consumers == target; -+} -+ -+/** -+ * devm_regulator_bulk_put - Resource managed regulator_bulk_put() -+ * @consumers: consumers to free -+ * -+ * Deallocate regulators allocated with devm_regulator_bulk_get(). Normally -+ * this function will not need to be called and the resource management -+ * code will ensure that the resource is freed. -+ */ -+void devm_regulator_bulk_put(struct regulator_bulk_data *consumers) -+{ -+ int rc; -+ struct regulator *regulator = consumers[0].consumer; -+ -+ rc = devres_release(regulator->dev, devm_regulator_bulk_release, -+ devm_regulator_bulk_match, consumers); -+ if (rc != 0) -+ WARN_ON(rc); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_put); -+ -+static void devm_regulator_bulk_disable(void *res) -+{ -+ struct regulator_bulk_devres *devres = res; -+ int i; -+ -+ for (i = 0; i < devres->num_consumers; i++) -+ regulator_disable(devres->consumers[i].consumer); -+} -+ -+/** -+ * devm_regulator_bulk_get_enable - managed get'n enable multiple regulators -+ * -+ * @dev: device to supply -+ * @num_consumers: number of consumers to register -+ * @id: list of supply names or regulator IDs -+ * -+ * @return 0 on success, an errno on failure. -+ * -+ * This helper function allows drivers to get several regulator -+ * consumers in one operation with management, the regulators will -+ * automatically be freed when the device is unbound. If any of the -+ * regulators cannot be acquired then any regulators that were -+ * allocated will be freed before returning to the caller. -+ */ -+int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, -+ const char * const *id) -+{ -+ struct regulator_bulk_devres *devres; -+ struct regulator_bulk_data *consumers; -+ int i, ret; -+ -+ devres = devm_kmalloc(dev, sizeof(*devres), GFP_KERNEL); -+ if (!devres) -+ return -ENOMEM; -+ -+ devres->consumers = devm_kcalloc(dev, num_consumers, sizeof(*consumers), -+ GFP_KERNEL); -+ consumers = devres->consumers; -+ if (!consumers) -+ return -ENOMEM; -+ -+ devres->num_consumers = num_consumers; -+ -+ for (i = 0; i < num_consumers; i++) -+ consumers[i].supply = id[i]; -+ -+ ret = devm_regulator_bulk_get(dev, num_consumers, consumers); -+ if (ret) -+ return ret; -+ -+ for (i = 0; i < num_consumers; i++) { -+ ret = regulator_enable(consumers[i].consumer); -+ if (ret) -+ goto unwind; -+ } -+ -+ ret = devm_add_action(dev, devm_regulator_bulk_disable, devres); -+ if (!ret) -+ return 0; -+ -+unwind: -+ while (--i >= 0) -+ regulator_disable(consumers[i].consumer); -+ -+ devm_regulator_bulk_put(consumers); -+ -+ return ret; -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_enable); -+ - static void devm_rdev_release(struct device *dev, void *res) - { - regulator_unregister(*(struct regulator_dev **)res); -diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h -index 7d3a399a556da..cabfad359c1e2 100644 ---- a/include/linux/regulator/consumer.h -+++ b/include/linux/regulator/consumer.h -@@ -187,6 +187,8 @@ struct regulator *__must_check regulator_get_optional(struct device *dev, - const char *id); - struct regulator *__must_check devm_regulator_get_optional(struct device *dev, - const char *id); -+int devm_regulator_get_enable(struct device *dev, const char *id); -+int devm_regulator_get_enable_optional(struct device *dev, const char *id); - void regulator_put(struct regulator *regulator); - void devm_regulator_put(struct regulator *regulator); - -@@ -229,12 +231,15 @@ int __must_check regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); -+void devm_regulator_bulk_put(struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get_const( - struct device *dev, int num_consumers, - const struct regulator_bulk_data *in_consumers, - struct regulator_bulk_data **out_consumers); - int __must_check regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers); -+int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers, -+ const char * const *id); - int regulator_bulk_disable(int num_consumers, - struct regulator_bulk_data *consumers); - int regulator_bulk_force_disable(int num_consumers, -@@ -331,6 +336,17 @@ devm_regulator_get_exclusive(struct device *dev, const char *id) - return ERR_PTR(-ENODEV); - } - -+static inline int devm_regulator_get_enable(struct device *dev, const char *id) -+{ -+ return -ENODEV; -+} -+ -+static inline int devm_regulator_get_enable_optional(struct device *dev, -+ const char *id) -+{ -+ return -ENODEV; -+} -+ - static inline struct regulator *__must_check - regulator_get_optional(struct device *dev, const char *id) - { -@@ -352,6 +368,10 @@ static inline void devm_regulator_put(struct regulator *regulator) - { - } - -+static inline void devm_regulator_bulk_put(struct regulator_bulk_data *consumers) -+{ -+} -+ - static inline int regulator_register_supply_alias(struct device *dev, - const char *id, - struct device *alias_dev, -@@ -452,6 +472,13 @@ static inline int regulator_bulk_enable(int num_consumers, - return 0; - } - -+static inline int devm_regulator_bulk_get_enable(struct device *dev, -+ int num_consumers, -+ const char * const *id) -+{ -+ return 0; -+} -+ - static inline int regulator_bulk_disable(int num_consumers, - struct regulator_bulk_data *consumers) - { --- -2.39.5 - diff --git a/queue-5.4/regulator-consumer-add-missing-stubs-to-regulator-co.patch b/queue-5.4/regulator-consumer-add-missing-stubs-to-regulator-co.patch deleted file mode 100644 index 9f35539d1f..0000000000 --- a/queue-5.4/regulator-consumer-add-missing-stubs-to-regulator-co.patch +++ /dev/null @@ -1,81 +0,0 @@ -From db1b25500157acd3f65d8036bb569e5990a82e2f Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Wed, 20 Jan 2021 23:58:44 +0300 -Subject: regulator: consumer: Add missing stubs to regulator/consumer.h - -From: Dmitry Osipenko - -[ Upstream commit 51dfb6ca3728bd0a0a3c23776a12d2a15a1d2457 ] - -Add missing stubs to regulator/consumer.h in order to fix COMPILE_TEST -of the kernel. In particular this should fix compile-testing of OPP core -because of a missing stub for regulator_sync_voltage(). - -Reported-by: kernel test robot -Signed-off-by: Dmitry Osipenko -Link: https://lore.kernel.org/r/20210120205844.12658-1-digetx@gmail.com -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - include/linux/regulator/consumer.h | 30 ++++++++++++++++++++++++++++++ - 1 file changed, 30 insertions(+) - -diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h -index 6a92fd3105a31..b670ede051460 100644 ---- a/include/linux/regulator/consumer.h -+++ b/include/linux/regulator/consumer.h -@@ -321,6 +321,12 @@ regulator_get_exclusive(struct device *dev, const char *id) - return ERR_PTR(-ENODEV); - } - -+static inline struct regulator *__must_check -+devm_regulator_get_exclusive(struct device *dev, const char *id) -+{ -+ return ERR_PTR(-ENODEV); -+} -+ - static inline struct regulator *__must_check - regulator_get_optional(struct device *dev, const char *id) - { -@@ -476,6 +482,11 @@ static inline int regulator_get_voltage(struct regulator *regulator) - return -EINVAL; - } - -+static inline int regulator_sync_voltage(struct regulator *regulator) -+{ -+ return -EINVAL; -+} -+ - static inline int regulator_is_supported_voltage(struct regulator *regulator, - int min_uV, int max_uV) - { -@@ -568,6 +579,25 @@ static inline int devm_regulator_unregister_notifier(struct regulator *regulator - return 0; - } - -+static inline int regulator_suspend_enable(struct regulator_dev *rdev, -+ suspend_state_t state) -+{ -+ return -EINVAL; -+} -+ -+static inline int regulator_suspend_disable(struct regulator_dev *rdev, -+ suspend_state_t state) -+{ -+ return -EINVAL; -+} -+ -+static inline int regulator_set_suspend_voltage(struct regulator *regulator, -+ int min_uV, int max_uV, -+ suspend_state_t state) -+{ -+ return -EINVAL; -+} -+ - static inline void *regulator_get_drvdata(struct regulator *regulator) - { - return NULL; --- -2.39.5 - diff --git a/queue-5.4/regulator-core-allow-drivers-to-define-their-init-da.patch b/queue-5.4/regulator-core-allow-drivers-to-define-their-init-da.patch deleted file mode 100644 index 90f09f284b..0000000000 --- a/queue-5.4/regulator-core-allow-drivers-to-define-their-init-da.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 27abab1e558a1009373c626c887310fcbdc1c01b Mon Sep 17 00:00:00 2001 -From: Sasha Levin -Date: Tue, 26 Jul 2022 10:38:23 -0700 -Subject: regulator: core: Allow drivers to define their init data as const - -From: Douglas Anderson - -[ Upstream commit 1de452a0edda26f1483d1d934f692eab13ba669a ] - -Drivers tend to want to define the names of their regulators somewhere -in their source file as "static const". This means, inevitable, that -every driver out there open codes something like this: - -static const char * const supply_names[] = { - "vcc", "vccl", -}; - -static int get_regulators(struct my_data *data) -{ - int i; - - data->supplies = devm_kzalloc(...) - if (!data->supplies) - return -ENOMEM; - - for (i = 0; i < ARRAY_SIZE(supply_names); i++) - data->supplies[i].supply = supply_names[i]; - - return devm_regulator_bulk_get(data->dev, - ARRAY_SIZE(supply_names), - data->supplies); -} - -Let's make this more convenient by doing providing a helper that does -the copy. - -I have chosen to have the "const" input structure here be the exact -same structure as the normal one passed to -devm_regulator_bulk_get(). This is slightly inefficent since the input -data can't possibly have anything useful for "ret" or consumer and -thus we waste 8 bytes per structure. This seems an OK tradeoff for not -introducing an extra structure. - -Signed-off-by: Douglas Anderson -Link: https://lore.kernel.org/r/20220726103631.v2.6.I38fc508a73135a5c1b873851f3553ff2a3a625f5@changeid -Signed-off-by: Mark Brown -Stable-dep-of: 9079db287fc3 ("ASoC: codecs: wcd9335: Fix missing free of regulator supplies") -Signed-off-by: Sasha Levin ---- - drivers/regulator/devres.c | 28 ++++++++++++++++++++++++++++ - include/linux/regulator/consumer.h | 4 ++++ - 2 files changed, 32 insertions(+) - -diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c -index 3ea1c170f8402..762cc3ed85e9c 100644 ---- a/drivers/regulator/devres.c -+++ b/drivers/regulator/devres.c -@@ -166,6 +166,34 @@ int devm_regulator_bulk_get(struct device *dev, int num_consumers, - } - EXPORT_SYMBOL_GPL(devm_regulator_bulk_get); - -+/** -+ * devm_regulator_bulk_get_const - devm_regulator_bulk_get() w/ const data -+ * -+ * @dev: device to supply -+ * @num_consumers: number of consumers to register -+ * @in_consumers: const configuration of consumers -+ * @out_consumers: in_consumers is copied here and this is passed to -+ * devm_regulator_bulk_get(). -+ * -+ * This is a convenience function to allow bulk regulator configuration -+ * to be stored "static const" in files. -+ * -+ * Return: 0 on success, an errno on failure. -+ */ -+int devm_regulator_bulk_get_const(struct device *dev, int num_consumers, -+ const struct regulator_bulk_data *in_consumers, -+ struct regulator_bulk_data **out_consumers) -+{ -+ *out_consumers = devm_kmemdup(dev, in_consumers, -+ num_consumers * sizeof(*in_consumers), -+ GFP_KERNEL); -+ if (*out_consumers == NULL) -+ return -ENOMEM; -+ -+ return devm_regulator_bulk_get(dev, num_consumers, *out_consumers); -+} -+EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const); -+ - static void devm_rdev_release(struct device *dev, void *res) - { - regulator_unregister(*(struct regulator_dev **)res); -diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h -index b670ede051460..7d3a399a556da 100644 ---- a/include/linux/regulator/consumer.h -+++ b/include/linux/regulator/consumer.h -@@ -229,6 +229,10 @@ int __must_check regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); - int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, - struct regulator_bulk_data *consumers); -+int __must_check devm_regulator_bulk_get_const( -+ struct device *dev, int num_consumers, -+ const struct regulator_bulk_data *in_consumers, -+ struct regulator_bulk_data **out_consumers); - int __must_check regulator_bulk_enable(int num_consumers, - struct regulator_bulk_data *consumers); - int regulator_bulk_disable(int num_consumers, --- -2.39.5 - diff --git a/queue-5.4/series b/queue-5.4/series index f90b8d3962..67e20e5b14 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -30,12 +30,6 @@ media-cxusb-use-dev_dbg-rather-than-hand-rolled-debu.patch media-cxusb-no-longer-judge-rbuf-when-the-write-fail.patch media-omap3isp-use-sgtable-based-scatterlist-wrapper.patch media-vivid-change-the-siize-of-the-composing.patch -regulator-consumer-add-missing-stubs-to-regulator-co.patch -regulator-core-allow-drivers-to-define-their-init-da.patch -regulator-add-devm-helpers-for-get-and-enable.patch -asoc-codecs-wcd9335-handle-nicer-probe-deferral-and-.patch -asoc-codec-wcd9335-convert-to-gpio-descriptors.patch -asoc-codecs-wcd9335-fix-missing-free-of-regulator-su.patch rdma-core-use-refcount_t-instead-of-atomic_t-on-refc.patch rdma-iwcm-fix-use-after-free-of-work-objects-after-c.patch i2c-tiny-usb-disable-zero-length-read-messages.patch