public inbox for linux-clk@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code
@ 2025-10-22 13:51 Bartosz Golaszewski
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-10-22 13:51 UTC (permalink / raw)
  To: David Lechner, Michael Turquette, Stephen Boyd, Philipp Zabel
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

The TI DaVinci platform is the only remaining user of reset platform
lookup. Except that we no longer have any legacy, non-DT boards in
mainline so we can now safely remove it from the PSC driver and drop the
legacy lookup support from reset core.

The DaVinci clock driver doesn't see a lot of traffic these days so I
suggest a simple Ack from the clock maintainers and routing it through
the reset core for v6.19.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Changes in v2:
- Fix handling of optional resets
- Link to v1: https://lore.kernel.org/r/20251017-da850-reset-lookup-v1-0-362a309a9f09@linaro.org

---
Bartosz Golaszewski (2):
      clk: davinci: psc: drop unused reset lookup
      reset: remove legacy reset lookup code

 drivers/clk/davinci/psc-da850.c  |   7 ---
 drivers/reset/core.c             | 121 +--------------------------------------
 include/linux/reset-controller.h |  33 -----------
 3 files changed, 3 insertions(+), 158 deletions(-)
---
base-commit: 2433b84761658ef123ae683508bc461b07c5b0f0
change-id: 20251017-da850-reset-lookup-eca37d2d7d9b

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup
  2025-10-22 13:51 [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Bartosz Golaszewski
@ 2025-10-22 13:51 ` Bartosz Golaszewski
  2025-10-23 15:09   ` David Lechner
                     ` (2 more replies)
  2025-10-22 13:51 ` [PATCH v2 2/2] reset: remove legacy reset lookup code Bartosz Golaszewski
  2025-10-30 12:55 ` [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Philipp Zabel
  2 siblings, 3 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-10-22 13:51 UTC (permalink / raw)
  To: David Lechner, Michael Turquette, Stephen Boyd, Philipp Zabel
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

We no longer support any non-DT DaVinci boards so there are no more
users of legacy reset lookup.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/clk/davinci/psc-da850.c | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/drivers/clk/davinci/psc-da850.c b/drivers/clk/davinci/psc-da850.c
index 5a18bca464cdaf3a0f3573cf9d70b79ca591cf28..94081ab1e68872d978e4cb162d8f9101de656d3a 100644
--- a/drivers/clk/davinci/psc-da850.c
+++ b/drivers/clk/davinci/psc-da850.c
@@ -6,7 +6,6 @@
  */
 
 #include <linux/clk-provider.h>
-#include <linux/reset-controller.h>
 #include <linux/clk.h>
 #include <linux/clkdev.h>
 #include <linux/init.h>
@@ -66,14 +65,8 @@ LPSC_CLKDEV3(ecap_clkdev,	"fck",	"ecap.0",
 				"fck",	"ecap.1",
 				"fck",	"ecap.2");
 
-static struct reset_control_lookup da850_psc0_reset_lookup_table[] = {
-	RESET_LOOKUP("da850-psc0", 15, "davinci-rproc.0", NULL),
-};
-
 static int da850_psc0_init(struct device *dev, void __iomem *base)
 {
-	reset_controller_add_lookup(da850_psc0_reset_lookup_table,
-				    ARRAY_SIZE(da850_psc0_reset_lookup_table));
 	return davinci_psc_register_clocks(dev, da850_psc0_info, 16, base);
 }
 

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/2] reset: remove legacy reset lookup code
  2025-10-22 13:51 [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Bartosz Golaszewski
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
@ 2025-10-22 13:51 ` Bartosz Golaszewski
  2025-10-30 12:55 ` [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Philipp Zabel
  2 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-10-22 13:51 UTC (permalink / raw)
  To: David Lechner, Michael Turquette, Stephen Boyd, Philipp Zabel
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

There are no more users of this code. Let's remove the exported symbols
and the implementation from reset core.

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
 drivers/reset/core.c             | 121 +--------------------------------------
 include/linux/reset-controller.h |  33 -----------
 2 files changed, 3 insertions(+), 151 deletions(-)

diff --git a/drivers/reset/core.c b/drivers/reset/core.c
index 22f67fc77ae531c6efba3ce92cc73a2d57397762..8029e547e3db90ddb85c717dfd735bc8a314dd44 100644
--- a/drivers/reset/core.c
+++ b/drivers/reset/core.c
@@ -190,33 +190,6 @@ int devm_reset_controller_register(struct device *dev,
 }
 EXPORT_SYMBOL_GPL(devm_reset_controller_register);
 
-/**
- * reset_controller_add_lookup - register a set of lookup entries
- * @lookup: array of reset lookup entries
- * @num_entries: number of entries in the lookup array
- */
-void reset_controller_add_lookup(struct reset_control_lookup *lookup,
-				 unsigned int num_entries)
-{
-	struct reset_control_lookup *entry;
-	unsigned int i;
-
-	mutex_lock(&reset_lookup_mutex);
-	for (i = 0; i < num_entries; i++) {
-		entry = &lookup[i];
-
-		if (!entry->dev_id || !entry->provider) {
-			pr_warn("%s(): reset lookup entry badly specified, skipping\n",
-				__func__);
-			continue;
-		}
-
-		list_add_tail(&entry->list, &reset_lookup_list);
-	}
-	mutex_unlock(&reset_lookup_mutex);
-}
-EXPORT_SYMBOL_GPL(reset_controller_add_lookup);
-
 static inline struct reset_control_array *
 rstc_to_array(struct reset_control *rstc) {
 	return container_of(rstc, struct reset_control_array, base);
@@ -1081,75 +1054,12 @@ __of_reset_control_get(struct device_node *node, const char *id, int index,
 }
 EXPORT_SYMBOL_GPL(__of_reset_control_get);
 
-static struct reset_controller_dev *
-__reset_controller_by_name(const char *name)
-{
-	struct reset_controller_dev *rcdev;
-
-	lockdep_assert_held(&reset_list_mutex);
-
-	list_for_each_entry(rcdev, &reset_controller_list, list) {
-		if (!rcdev->dev)
-			continue;
-
-		if (!strcmp(name, dev_name(rcdev->dev)))
-			return rcdev;
-	}
-
-	return NULL;
-}
-
-static struct reset_control *
-__reset_control_get_from_lookup(struct device *dev, const char *con_id,
-				enum reset_control_flags flags)
-{
-	bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
-	const struct reset_control_lookup *lookup;
-	struct reset_controller_dev *rcdev;
-	const char *dev_id = dev_name(dev);
-	struct reset_control *rstc = NULL;
-
-	mutex_lock(&reset_lookup_mutex);
-
-	list_for_each_entry(lookup, &reset_lookup_list, list) {
-		if (strcmp(lookup->dev_id, dev_id))
-			continue;
-
-		if ((!con_id && !lookup->con_id) ||
-		    ((con_id && lookup->con_id) &&
-		     !strcmp(con_id, lookup->con_id))) {
-			mutex_lock(&reset_list_mutex);
-			rcdev = __reset_controller_by_name(lookup->provider);
-			if (!rcdev) {
-				mutex_unlock(&reset_list_mutex);
-				mutex_unlock(&reset_lookup_mutex);
-				/* Reset provider may not be ready yet. */
-				return ERR_PTR(-EPROBE_DEFER);
-			}
-
-			flags &= ~RESET_CONTROL_FLAGS_BIT_OPTIONAL;
-
-			rstc = __reset_control_get_internal(rcdev,
-							    lookup->index,
-							    flags);
-			mutex_unlock(&reset_list_mutex);
-			break;
-		}
-	}
-
-	mutex_unlock(&reset_lookup_mutex);
-
-	if (!rstc)
-		return optional ? NULL : ERR_PTR(-ENOENT);
-
-	return rstc;
-}
-
 struct reset_control *__reset_control_get(struct device *dev, const char *id,
 					  int index, enum reset_control_flags flags)
 {
 	bool shared = flags & RESET_CONTROL_FLAGS_BIT_SHARED;
 	bool acquired = flags & RESET_CONTROL_FLAGS_BIT_ACQUIRED;
+	bool optional = flags & RESET_CONTROL_FLAGS_BIT_OPTIONAL;
 
 	if (WARN_ON(shared && acquired))
 		return ERR_PTR(-EINVAL);
@@ -1157,7 +1067,7 @@ struct reset_control *__reset_control_get(struct device *dev, const char *id,
 	if (dev->of_node)
 		return __of_reset_control_get(dev->of_node, id, index, flags);
 
-	return __reset_control_get_from_lookup(dev, id, flags);
+	return optional ? NULL : ERR_PTR(-ENOENT);
 }
 EXPORT_SYMBOL_GPL(__reset_control_get);
 
@@ -1492,31 +1402,6 @@ devm_reset_control_array_get(struct device *dev, enum reset_control_flags flags)
 }
 EXPORT_SYMBOL_GPL(devm_reset_control_array_get);
 
-static int reset_control_get_count_from_lookup(struct device *dev)
-{
-	const struct reset_control_lookup *lookup;
-	const char *dev_id;
-	int count = 0;
-
-	if (!dev)
-		return -EINVAL;
-
-	dev_id = dev_name(dev);
-	mutex_lock(&reset_lookup_mutex);
-
-	list_for_each_entry(lookup, &reset_lookup_list, list) {
-		if (!strcmp(lookup->dev_id, dev_id))
-			count++;
-	}
-
-	mutex_unlock(&reset_lookup_mutex);
-
-	if (count == 0)
-		count = -ENOENT;
-
-	return count;
-}
-
 /**
  * reset_control_get_count - Count number of resets available with a device
  *
@@ -1530,6 +1415,6 @@ int reset_control_get_count(struct device *dev)
 	if (dev->of_node)
 		return of_reset_control_get_count(dev->of_node);
 
-	return reset_control_get_count_from_lookup(dev);
+	return -ENOENT;
 }
 EXPORT_SYMBOL_GPL(reset_control_get_count);
diff --git a/include/linux/reset-controller.h b/include/linux/reset-controller.h
index 357df16ede328657478eceb1ba6065f42a210ea2..46514cb1b9e0626872fe71357b24d54ff0e81a8b 100644
--- a/include/linux/reset-controller.h
+++ b/include/linux/reset-controller.h
@@ -26,31 +26,6 @@ struct module;
 struct device_node;
 struct of_phandle_args;
 
-/**
- * struct reset_control_lookup - represents a single lookup entry
- *
- * @list: internal list of all reset lookup entries
- * @provider: name of the reset controller device controlling this reset line
- * @index: ID of the reset controller in the reset controller device
- * @dev_id: name of the device associated with this reset line
- * @con_id: name of the reset line (can be NULL)
- */
-struct reset_control_lookup {
-	struct list_head list;
-	const char *provider;
-	unsigned int index;
-	const char *dev_id;
-	const char *con_id;
-};
-
-#define RESET_LOOKUP(_provider, _index, _dev_id, _con_id)		\
-	{								\
-		.provider = _provider,					\
-		.index = _index,					\
-		.dev_id = _dev_id,					\
-		.con_id = _con_id,					\
-	}
-
 /**
  * struct reset_controller_dev - reset controller entity that might
  *                               provide multiple reset controls
@@ -90,9 +65,6 @@ void reset_controller_unregister(struct reset_controller_dev *rcdev);
 struct device;
 int devm_reset_controller_register(struct device *dev,
 				   struct reset_controller_dev *rcdev);
-
-void reset_controller_add_lookup(struct reset_control_lookup *lookup,
-				 unsigned int num_entries);
 #else
 static inline int reset_controller_register(struct reset_controller_dev *rcdev)
 {
@@ -108,11 +80,6 @@ static inline int devm_reset_controller_register(struct device *dev,
 {
 	return 0;
 }
-
-static inline void reset_controller_add_lookup(struct reset_control_lookup *lookup,
-					       unsigned int num_entries)
-{
-}
 #endif
 
 #endif

-- 
2.48.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
@ 2025-10-23 15:09   ` David Lechner
  2025-10-24  7:53   ` Bartosz Golaszewski
  2025-10-26  1:38   ` Stephen Boyd
  2 siblings, 0 replies; 7+ messages in thread
From: David Lechner @ 2025-10-23 15:09 UTC (permalink / raw)
  To: Bartosz Golaszewski, Michael Turquette, Stephen Boyd,
	Philipp Zabel
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

On 10/22/25 8:51 AM, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We no longer support any non-DT DaVinci boards so there are no more
> users of legacy reset lookup.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

Acked-by: David Lechner <david@lechnology.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
  2025-10-23 15:09   ` David Lechner
@ 2025-10-24  7:53   ` Bartosz Golaszewski
  2025-10-26  1:38   ` Stephen Boyd
  2 siblings, 0 replies; 7+ messages in thread
From: Bartosz Golaszewski @ 2025-10-24  7:53 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski, Michael Turquette,
	Philipp Zabel, David Lechner

On Wed, Oct 22, 2025 at 3:51 PM Bartosz Golaszewski <brgl@bgdev.pl> wrote:
>
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> We no longer support any non-DT DaVinci boards so there are no more
> users of legacy reset lookup.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

Stephen: if you're ok with this going through the reset tree, could
you just leave your Ack here for completeness?

Bartosz

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
  2025-10-23 15:09   ` David Lechner
  2025-10-24  7:53   ` Bartosz Golaszewski
@ 2025-10-26  1:38   ` Stephen Boyd
  2 siblings, 0 replies; 7+ messages in thread
From: Stephen Boyd @ 2025-10-26  1:38 UTC (permalink / raw)
  To: Bartosz Golaszewski, David Lechner, Michael Turquette,
	Philipp Zabel
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

Quoting Bartosz Golaszewski (2025-10-22 06:51:31)
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> 
> We no longer support any non-DT DaVinci boards so there are no more
> users of legacy reset lookup.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
> ---

Acked-by: Stephen Boyd <sboyd@kernel.org>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code
  2025-10-22 13:51 [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Bartosz Golaszewski
  2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
  2025-10-22 13:51 ` [PATCH v2 2/2] reset: remove legacy reset lookup code Bartosz Golaszewski
@ 2025-10-30 12:55 ` Philipp Zabel
  2 siblings, 0 replies; 7+ messages in thread
From: Philipp Zabel @ 2025-10-30 12:55 UTC (permalink / raw)
  To: Bartosz Golaszewski, David Lechner, Michael Turquette,
	Stephen Boyd
  Cc: linux-clk, linux-kernel, Bartosz Golaszewski

On Mi, 2025-10-22 at 15:51 +0200, Bartosz Golaszewski wrote:
> The TI DaVinci platform is the only remaining user of reset platform
> lookup. Except that we no longer have any legacy, non-DT boards in
> mainline so we can now safely remove it from the PSC driver and drop the
> legacy lookup support from reset core.
> 
> The DaVinci clock driver doesn't see a lot of traffic these days so I
> suggest a simple Ack from the clock maintainers and routing it through
> the reset core for v6.19.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>

Applied to reset/next, thanks!

[1/2] clk: davinci: psc: drop unused reset lookup
      https://git.pengutronix.de/cgit/pza/linux/commit/?id=d8b79ad1f40c
[2/2] reset: remove legacy reset lookup code
      https://git.pengutronix.de/cgit/pza/linux/commit/?id=205b261463ff

regards
Philipp

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2025-10-30 12:55 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-22 13:51 [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Bartosz Golaszewski
2025-10-22 13:51 ` [PATCH v2 1/2] clk: davinci: psc: drop unused reset lookup Bartosz Golaszewski
2025-10-23 15:09   ` David Lechner
2025-10-24  7:53   ` Bartosz Golaszewski
2025-10-26  1:38   ` Stephen Boyd
2025-10-22 13:51 ` [PATCH v2 2/2] reset: remove legacy reset lookup code Bartosz Golaszewski
2025-10-30 12:55 ` [PATCH v2 0/2] reset: remove last remaining user of the legacy lookup and drop unused code Philipp Zabel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox