linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] driver core: make bus_get_device_klist() static
@ 2023-01-09 17:58 Greg Kroah-Hartman
  2023-01-09 17:58 ` [PATCH 2/6] driver core: remove subsys_find_device_by_id() Greg Kroah-Hartman
                   ` (5 more replies)
  0 siblings, 6 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

No one calls this function outside of drivers/base/bus.c so make it
static so it does not need to be exported anymore.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 3 +--
 include/linux/device/bus.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index e1bf741063e0..4e6fdb65a157 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -927,11 +927,10 @@ struct kset *bus_get_kset(struct bus_type *bus)
 }
 EXPORT_SYMBOL_GPL(bus_get_kset);
 
-struct klist *bus_get_device_klist(struct bus_type *bus)
+static struct klist *bus_get_device_klist(struct bus_type *bus)
 {
 	return &bus->p->klist_devices;
 }
-EXPORT_SYMBOL_GPL(bus_get_device_klist);
 
 /*
  * Yes, this forcibly breaks the klist abstraction temporarily.  It
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index f2cf7c4ddd20..0699b3970344 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -287,6 +287,5 @@ extern int bus_unregister_notifier(struct bus_type *bus,
 #define BUS_NOTIFY_DRIVER_NOT_BOUND	0x00000008 /* driver fails to be bound */
 
 extern struct kset *bus_get_kset(struct bus_type *bus);
-extern struct klist *bus_get_device_klist(struct bus_type *bus);
 
 #endif
-- 
2.39.0


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

* [PATCH 2/6] driver core: remove subsys_find_device_by_id()
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
@ 2023-01-09 17:58 ` Greg Kroah-Hartman
  2023-01-10 12:34   ` Rafael J. Wysocki
  2023-01-09 17:58 ` [PATCH 3/6] driver core: make subsys_dev_iter_init() static Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

This function has not been called by any code in the kernel tree in many
many years so remove it as it is unused.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 41 --------------------------------------
 include/linux/device/bus.h |  2 --
 2 files changed, 43 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 4e6fdb65a157..45aa8d996f0a 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -363,47 +363,6 @@ struct device *bus_find_device(struct bus_type *bus,
 }
 EXPORT_SYMBOL_GPL(bus_find_device);
 
-/**
- * subsys_find_device_by_id - find a device with a specific enumeration number
- * @subsys: subsystem
- * @id: index 'id' in struct device
- * @hint: device to check first
- *
- * Check the hint's next object and if it is a match return it directly,
- * otherwise, fall back to a full list search. Either way a reference for
- * the returned object is taken.
- */
-struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id,
-					struct device *hint)
-{
-	struct klist_iter i;
-	struct device *dev;
-
-	if (!subsys)
-		return NULL;
-
-	if (hint) {
-		klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus);
-		dev = next_device(&i);
-		if (dev && dev->id == id && get_device(dev)) {
-			klist_iter_exit(&i);
-			return dev;
-		}
-		klist_iter_exit(&i);
-	}
-
-	klist_iter_init_node(&subsys->p->klist_devices, &i, NULL);
-	while ((dev = next_device(&i))) {
-		if (dev->id == id && get_device(dev)) {
-			klist_iter_exit(&i);
-			return dev;
-		}
-	}
-	klist_iter_exit(&i);
-	return NULL;
-}
-EXPORT_SYMBOL_GPL(subsys_find_device_by_id);
-
 static struct device_driver *next_driver(struct klist_iter *i)
 {
 	struct klist_node *n = klist_next(i);
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 0699b3970344..d865440d8c02 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -250,8 +250,6 @@ bus_find_device_by_acpi_dev(struct bus_type *bus, const void *adev)
 }
 #endif
 
-struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
-					struct device *hint);
 int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
 		     void *data, int (*fn)(struct device_driver *, void *));
 void bus_sort_breadthfirst(struct bus_type *bus,
-- 
2.39.0


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

* [PATCH 3/6] driver core: make subsys_dev_iter_init() static
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
  2023-01-09 17:58 ` [PATCH 2/6] driver core: remove subsys_find_device_by_id() Greg Kroah-Hartman
@ 2023-01-09 17:58 ` Greg Kroah-Hartman
  2023-01-10 12:35   ` Rafael J. Wysocki
  2023-01-09 17:58 ` [PATCH 4/6] driver core: make subsys_dev_iter_next() static Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

No one outside of drivers/base/bus.c calls this function so make it
static and remove the exported symbol.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 5 ++---
 include/linux/device/bus.h | 4 ----
 2 files changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 45aa8d996f0a..a375305a11dd 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -953,8 +953,8 @@ EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
  * otherwise if it is NULL, the iteration starts at the beginning of
  * the list.
  */
-void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
-			  struct device *start, const struct device_type *type)
+static void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
+				 struct device *start, const struct device_type *type)
 {
 	struct klist_node *start_knode = NULL;
 
@@ -963,7 +963,6 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
 	klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode);
 	iter->type = type;
 }
-EXPORT_SYMBOL_GPL(subsys_dev_iter_init);
 
 /**
  * subsys_dev_iter_next - iterate to the next device
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index d865440d8c02..a1da2f8647af 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -154,10 +154,6 @@ struct subsys_dev_iter {
 	struct klist_iter		ki;
 	const struct device_type	*type;
 };
-void subsys_dev_iter_init(struct subsys_dev_iter *iter,
-			 struct bus_type *subsys,
-			 struct device *start,
-			 const struct device_type *type);
 struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 
-- 
2.39.0


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

* [PATCH 4/6] driver core: make subsys_dev_iter_next() static
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
  2023-01-09 17:58 ` [PATCH 2/6] driver core: remove subsys_find_device_by_id() Greg Kroah-Hartman
  2023-01-09 17:58 ` [PATCH 3/6] driver core: make subsys_dev_iter_init() static Greg Kroah-Hartman
@ 2023-01-09 17:58 ` Greg Kroah-Hartman
  2023-01-10 12:35   ` Rafael J. Wysocki
  2023-01-09 17:58 ` [PATCH 5/6] driver core: make subsys_dev_iter_exit() static Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

The function subsys_dev_iter_next() is only used in drivers/base/bus.c
so make it static to that file and remove the global export.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 3 +--
 include/linux/device/bus.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index a375305a11dd..4be73f58d0ad 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -976,7 +976,7 @@ static void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *
  * free to do whatever it wants to do with the device including
  * calling back into subsys code.
  */
-struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
+static struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
 {
 	struct klist_node *knode;
 	struct device *dev;
@@ -990,7 +990,6 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
 			return dev;
 	}
 }
-EXPORT_SYMBOL_GPL(subsys_dev_iter_next);
 
 /**
  * subsys_dev_iter_exit - finish iteration
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index a1da2f8647af..5a7590bc7913 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -154,7 +154,6 @@ struct subsys_dev_iter {
 	struct klist_iter		ki;
 	const struct device_type	*type;
 };
-struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
 void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 
 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
-- 
2.39.0


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

* [PATCH 5/6] driver core: make subsys_dev_iter_exit() static
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2023-01-09 17:58 ` [PATCH 4/6] driver core: make subsys_dev_iter_next() static Greg Kroah-Hartman
@ 2023-01-09 17:58 ` Greg Kroah-Hartman
  2023-01-10 12:36   ` Rafael J. Wysocki
  2023-01-09 17:58 ` [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file Greg Kroah-Hartman
  2023-01-10 12:33 ` [PATCH 1/6] driver core: make bus_get_device_klist() static Rafael J. Wysocki
  5 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

The function subsys_dev_iter_exit() is not used outside of
drivers/base/bus.c so make it static to that file and remove the global
export.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 3 +--
 include/linux/device/bus.h | 1 -
 2 files changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 4be73f58d0ad..e0fe07872a74 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -998,11 +998,10 @@ static struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
  * Finish an iteration.  Always call this function after iteration is
  * complete whether the iteration ran till the end or not.
  */
-void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
+static void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
 {
 	klist_iter_exit(&iter->ki);
 }
-EXPORT_SYMBOL_GPL(subsys_dev_iter_exit);
 
 int subsys_interface_register(struct subsys_interface *sif)
 {
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index 5a7590bc7913..ffa562f2d975 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -154,7 +154,6 @@ struct subsys_dev_iter {
 	struct klist_iter		ki;
 	const struct device_type	*type;
 };
-void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
 
 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
 		     int (*fn)(struct device *dev, void *data));
-- 
2.39.0


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

* [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2023-01-09 17:58 ` [PATCH 5/6] driver core: make subsys_dev_iter_exit() static Greg Kroah-Hartman
@ 2023-01-09 17:58 ` Greg Kroah-Hartman
  2023-01-10 12:37   ` Rafael J. Wysocki
  2023-01-10 12:33 ` [PATCH 1/6] driver core: make bus_get_device_klist() static Rafael J. Wysocki
  5 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-09 17:58 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rafael J. Wysocki

struct subsys_dev_iter is not used by any code outside of
drivers/base/bus.c so move it into that file and out of the global bus.h
file.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c         | 5 +++++
 include/linux/device/bus.h | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index e0fe07872a74..e0953656d5ac 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -941,6 +941,11 @@ void bus_sort_breadthfirst(struct bus_type *bus,
 }
 EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
 
+struct subsys_dev_iter {
+	struct klist_iter		ki;
+	const struct device_type	*type;
+};
+
 /**
  * subsys_dev_iter_init - initialize subsys device iterator
  * @iter: subsys iterator to initialize
diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
index ffa562f2d975..53e3cdf18bae 100644
--- a/include/linux/device/bus.h
+++ b/include/linux/device/bus.h
@@ -150,11 +150,6 @@ int device_match_acpi_handle(struct device *dev, const void *handle);
 int device_match_any(struct device *dev, const void *unused);
 
 /* iterator helpers for buses */
-struct subsys_dev_iter {
-	struct klist_iter		ki;
-	const struct device_type	*type;
-};
-
 int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
 		     int (*fn)(struct device *dev, void *data));
 struct device *bus_find_device(struct bus_type *bus, struct device *start,
-- 
2.39.0


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

* Re: [PATCH 1/6] driver core: make bus_get_device_klist() static
  2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2023-01-09 17:58 ` [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file Greg Kroah-Hartman
@ 2023-01-10 12:33 ` Rafael J. Wysocki
  2023-01-10 12:43   ` Greg Kroah-Hartman
  5 siblings, 1 reply; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> No one calls this function outside of drivers/base/bus.c so make it
> static so it does not need to be exported anymore.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 3 +--
>  include/linux/device/bus.h | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index e1bf741063e0..4e6fdb65a157 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -927,11 +927,10 @@ struct kset *bus_get_kset(struct bus_type *bus)
>  }
>  EXPORT_SYMBOL_GPL(bus_get_kset);
>
> -struct klist *bus_get_device_klist(struct bus_type *bus)
> +static struct klist *bus_get_device_klist(struct bus_type *bus)
>  {
>         return &bus->p->klist_devices;
>  }
> -EXPORT_SYMBOL_GPL(bus_get_device_klist);
>
>  /*
>   * Yes, this forcibly breaks the klist abstraction temporarily.  It
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index f2cf7c4ddd20..0699b3970344 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -287,6 +287,5 @@ extern int bus_unregister_notifier(struct bus_type *bus,
>  #define BUS_NOTIFY_DRIVER_NOT_BOUND    0x00000008 /* driver fails to be bound */
>
>  extern struct kset *bus_get_kset(struct bus_type *bus);
> -extern struct klist *bus_get_device_klist(struct bus_type *bus);
>
>  #endif
> --
> 2.39.0
>

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

* Re: [PATCH 2/6] driver core: remove subsys_find_device_by_id()
  2023-01-09 17:58 ` [PATCH 2/6] driver core: remove subsys_find_device_by_id() Greg Kroah-Hartman
@ 2023-01-10 12:34   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:34 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> This function has not been called by any code in the kernel tree in many
> many years so remove it as it is unused.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 41 --------------------------------------
>  include/linux/device/bus.h |  2 --
>  2 files changed, 43 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 4e6fdb65a157..45aa8d996f0a 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -363,47 +363,6 @@ struct device *bus_find_device(struct bus_type *bus,
>  }
>  EXPORT_SYMBOL_GPL(bus_find_device);
>
> -/**
> - * subsys_find_device_by_id - find a device with a specific enumeration number
> - * @subsys: subsystem
> - * @id: index 'id' in struct device
> - * @hint: device to check first
> - *
> - * Check the hint's next object and if it is a match return it directly,
> - * otherwise, fall back to a full list search. Either way a reference for
> - * the returned object is taken.
> - */
> -struct device *subsys_find_device_by_id(struct bus_type *subsys, unsigned int id,
> -                                       struct device *hint)
> -{
> -       struct klist_iter i;
> -       struct device *dev;
> -
> -       if (!subsys)
> -               return NULL;
> -
> -       if (hint) {
> -               klist_iter_init_node(&subsys->p->klist_devices, &i, &hint->p->knode_bus);
> -               dev = next_device(&i);
> -               if (dev && dev->id == id && get_device(dev)) {
> -                       klist_iter_exit(&i);
> -                       return dev;
> -               }
> -               klist_iter_exit(&i);
> -       }
> -
> -       klist_iter_init_node(&subsys->p->klist_devices, &i, NULL);
> -       while ((dev = next_device(&i))) {
> -               if (dev->id == id && get_device(dev)) {
> -                       klist_iter_exit(&i);
> -                       return dev;
> -               }
> -       }
> -       klist_iter_exit(&i);
> -       return NULL;
> -}
> -EXPORT_SYMBOL_GPL(subsys_find_device_by_id);
> -
>  static struct device_driver *next_driver(struct klist_iter *i)
>  {
>         struct klist_node *n = klist_next(i);
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index 0699b3970344..d865440d8c02 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -250,8 +250,6 @@ bus_find_device_by_acpi_dev(struct bus_type *bus, const void *adev)
>  }
>  #endif
>
> -struct device *subsys_find_device_by_id(struct bus_type *bus, unsigned int id,
> -                                       struct device *hint);
>  int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
>                      void *data, int (*fn)(struct device_driver *, void *));
>  void bus_sort_breadthfirst(struct bus_type *bus,
> --
> 2.39.0
>

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

* Re: [PATCH 3/6] driver core: make subsys_dev_iter_init() static
  2023-01-09 17:58 ` [PATCH 3/6] driver core: make subsys_dev_iter_init() static Greg Kroah-Hartman
@ 2023-01-10 12:35   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> No one outside of drivers/base/bus.c calls this function so make it
> static and remove the exported symbol.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 5 ++---
>  include/linux/device/bus.h | 4 ----
>  2 files changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 45aa8d996f0a..a375305a11dd 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -953,8 +953,8 @@ EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
>   * otherwise if it is NULL, the iteration starts at the beginning of
>   * the list.
>   */
> -void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
> -                         struct device *start, const struct device_type *type)
> +static void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
> +                                struct device *start, const struct device_type *type)
>  {
>         struct klist_node *start_knode = NULL;
>
> @@ -963,7 +963,6 @@ void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *subsys,
>         klist_iter_init_node(&subsys->p->klist_devices, &iter->ki, start_knode);
>         iter->type = type;
>  }
> -EXPORT_SYMBOL_GPL(subsys_dev_iter_init);
>
>  /**
>   * subsys_dev_iter_next - iterate to the next device
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index d865440d8c02..a1da2f8647af 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -154,10 +154,6 @@ struct subsys_dev_iter {
>         struct klist_iter               ki;
>         const struct device_type        *type;
>  };
> -void subsys_dev_iter_init(struct subsys_dev_iter *iter,
> -                        struct bus_type *subsys,
> -                        struct device *start,
> -                        const struct device_type *type);
>  struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
>  void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
>
> --
> 2.39.0
>

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

* Re: [PATCH 4/6] driver core: make subsys_dev_iter_next() static
  2023-01-09 17:58 ` [PATCH 4/6] driver core: make subsys_dev_iter_next() static Greg Kroah-Hartman
@ 2023-01-10 12:35   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> The function subsys_dev_iter_next() is only used in drivers/base/bus.c
> so make it static to that file and remove the global export.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 3 +--
>  include/linux/device/bus.h | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index a375305a11dd..4be73f58d0ad 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -976,7 +976,7 @@ static void subsys_dev_iter_init(struct subsys_dev_iter *iter, struct bus_type *
>   * free to do whatever it wants to do with the device including
>   * calling back into subsys code.
>   */
> -struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
> +static struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
>  {
>         struct klist_node *knode;
>         struct device *dev;
> @@ -990,7 +990,6 @@ struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
>                         return dev;
>         }
>  }
> -EXPORT_SYMBOL_GPL(subsys_dev_iter_next);
>
>  /**
>   * subsys_dev_iter_exit - finish iteration
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index a1da2f8647af..5a7590bc7913 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -154,7 +154,6 @@ struct subsys_dev_iter {
>         struct klist_iter               ki;
>         const struct device_type        *type;
>  };
> -struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter);
>  void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
>
>  int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
> --
> 2.39.0
>

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

* Re: [PATCH 5/6] driver core: make subsys_dev_iter_exit() static
  2023-01-09 17:58 ` [PATCH 5/6] driver core: make subsys_dev_iter_exit() static Greg Kroah-Hartman
@ 2023-01-10 12:36   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:36 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> The function subsys_dev_iter_exit() is not used outside of
> drivers/base/bus.c so make it static to that file and remove the global
> export.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 3 +--
>  include/linux/device/bus.h | 1 -
>  2 files changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index 4be73f58d0ad..e0fe07872a74 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -998,11 +998,10 @@ static struct device *subsys_dev_iter_next(struct subsys_dev_iter *iter)
>   * Finish an iteration.  Always call this function after iteration is
>   * complete whether the iteration ran till the end or not.
>   */
> -void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
> +static void subsys_dev_iter_exit(struct subsys_dev_iter *iter)
>  {
>         klist_iter_exit(&iter->ki);
>  }
> -EXPORT_SYMBOL_GPL(subsys_dev_iter_exit);
>
>  int subsys_interface_register(struct subsys_interface *sif)
>  {
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index 5a7590bc7913..ffa562f2d975 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -154,7 +154,6 @@ struct subsys_dev_iter {
>         struct klist_iter               ki;
>         const struct device_type        *type;
>  };
> -void subsys_dev_iter_exit(struct subsys_dev_iter *iter);
>
>  int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
>                      int (*fn)(struct device *dev, void *data));
> --
> 2.39.0
>

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

* Re: [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file
  2023-01-09 17:58 ` [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file Greg Kroah-Hartman
@ 2023-01-10 12:37   ` Rafael J. Wysocki
  0 siblings, 0 replies; 13+ messages in thread
From: Rafael J. Wysocki @ 2023-01-10 12:37 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rafael J. Wysocki

On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
>
> struct subsys_dev_iter is not used by any code outside of
> drivers/base/bus.c so move it into that file and out of the global bus.h
> file.
>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

> ---
>  drivers/base/bus.c         | 5 +++++
>  include/linux/device/bus.h | 5 -----
>  2 files changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/base/bus.c b/drivers/base/bus.c
> index e0fe07872a74..e0953656d5ac 100644
> --- a/drivers/base/bus.c
> +++ b/drivers/base/bus.c
> @@ -941,6 +941,11 @@ void bus_sort_breadthfirst(struct bus_type *bus,
>  }
>  EXPORT_SYMBOL_GPL(bus_sort_breadthfirst);
>
> +struct subsys_dev_iter {
> +       struct klist_iter               ki;
> +       const struct device_type        *type;
> +};
> +
>  /**
>   * subsys_dev_iter_init - initialize subsys device iterator
>   * @iter: subsys iterator to initialize
> diff --git a/include/linux/device/bus.h b/include/linux/device/bus.h
> index ffa562f2d975..53e3cdf18bae 100644
> --- a/include/linux/device/bus.h
> +++ b/include/linux/device/bus.h
> @@ -150,11 +150,6 @@ int device_match_acpi_handle(struct device *dev, const void *handle);
>  int device_match_any(struct device *dev, const void *unused);
>
>  /* iterator helpers for buses */
> -struct subsys_dev_iter {
> -       struct klist_iter               ki;
> -       const struct device_type        *type;
> -};
> -
>  int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
>                      int (*fn)(struct device *dev, void *data));
>  struct device *bus_find_device(struct bus_type *bus, struct device *start,
> --
> 2.39.0
>

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

* Re: [PATCH 1/6] driver core: make bus_get_device_klist() static
  2023-01-10 12:33 ` [PATCH 1/6] driver core: make bus_get_device_klist() static Rafael J. Wysocki
@ 2023-01-10 12:43   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 13+ messages in thread
From: Greg Kroah-Hartman @ 2023-01-10 12:43 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: linux-kernel

On Tue, Jan 10, 2023 at 01:33:48PM +0100, Rafael J. Wysocki wrote:
> On Mon, Jan 9, 2023 at 6:58 PM Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> >
> > No one calls this function outside of drivers/base/bus.c so make it
> > static so it does not need to be exported anymore.
> >
> > Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> Reviewed-by: Rafael J. Wysocki <rafael@kernel.org>

Thanks for the reviews!

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

end of thread, other threads:[~2023-01-10 12:44 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-09 17:58 [PATCH 1/6] driver core: make bus_get_device_klist() static Greg Kroah-Hartman
2023-01-09 17:58 ` [PATCH 2/6] driver core: remove subsys_find_device_by_id() Greg Kroah-Hartman
2023-01-10 12:34   ` Rafael J. Wysocki
2023-01-09 17:58 ` [PATCH 3/6] driver core: make subsys_dev_iter_init() static Greg Kroah-Hartman
2023-01-10 12:35   ` Rafael J. Wysocki
2023-01-09 17:58 ` [PATCH 4/6] driver core: make subsys_dev_iter_next() static Greg Kroah-Hartman
2023-01-10 12:35   ` Rafael J. Wysocki
2023-01-09 17:58 ` [PATCH 5/6] driver core: make subsys_dev_iter_exit() static Greg Kroah-Hartman
2023-01-10 12:36   ` Rafael J. Wysocki
2023-01-09 17:58 ` [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file Greg Kroah-Hartman
2023-01-10 12:37   ` Rafael J. Wysocki
2023-01-10 12:33 ` [PATCH 1/6] driver core: make bus_get_device_klist() static Rafael J. Wysocki
2023-01-10 12:43   ` Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).