driver core: make bus_get_device_klist() static
Greg Kroah-Hartman
maintainerPATCH 2/6 driver core: remove subsys_find_device_by_id()
In reply to Greg Kroah-HartmanThis function has not been called by any code in the kernel tree in many many years so remove it as it is unused.
--- drivers/base/bus.c | 41 -------------------------------------- include/linux/device/bus.h | 2 -- 2 files changed, 43 deletions(-)
drivers/base/bus.c +0 -41
@@ -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);
include/linux/device/bus.h +0 -2
@@ -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,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 1/6 driver core: make bus_get_device_klist() static
No one calls this function outside of drivers/base/bus.c so make it static so it does not need to be exported anymore.
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/base/bus.c +1 -2
@@ -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
include/linux/device/bus.h +0 -1
@@ -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
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 5/6 driver core: make subsys_dev_iter_exit() static
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.
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/base/bus.c +1 -2
@@ -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) {
include/linux/device/bus.h +0 -1
@@ -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));
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 6/6 driver core: move struct subsys_dev_iter to a local file
In reply to Greg Kroah-Hartmanstruct 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.
--- drivers/base/bus.c | 5 +++++ include/linux/device/bus.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/base/bus.c +5 -0
@@ -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
include/linux/device/bus.h +0 -5
@@ -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,
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 3/6 driver core: make subsys_dev_iter_init() static
In reply to Greg Kroah-HartmanNo one outside of drivers/base/bus.c calls this function so make it static and remove the exported symbol.
--- drivers/base/bus.c | 5 ++--- include/linux/device/bus.h | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-)
drivers/base/bus.c +2 -3
@@ -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
include/linux/device/bus.h +0 -4
@@ -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);
Signature · 1 line
2.39.0
Greg Kroah-Hartman
maintainerPATCH 4/6 driver core: make subsys_dev_iter_next() static
In reply to Greg Kroah-HartmanThe 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.
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/base/bus.c +1 -2
@@ -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
include/linux/device/bus.h +0 -1
@@ -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,
Signature · 1 line
2.39.0
Quoted 6 lines · Greg Kroah-Hartman
No one calls this function outside of
drivers/base/bus.cso make it static so it does not need to be exported anymore.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 36 lines
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)drivers/base/bus.c +1
-2@@ -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 include/linux/device/bus.h +0
-2@@ -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
Re: [PATCH 2/6] driver core: remove subsys_find_device_by_id()
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
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" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 73 lines
--- drivers/base/bus.c | 41 -------------------------------------- include/linux/device/bus.h | 2 -- 2 files changed, 43 deletions(-)drivers/base/bus.c +0
-41@@ -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);include/linux/device/bus.h +0
-3@@ -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
Re: [PATCH 3/6] driver core: make subsys_dev_iter_init() static
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
No one outside of
drivers/base/bus.ccalls this function so make it static and remove the exported symbol.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 46 lines
--- drivers/base/bus.c | 5 ++--- include/linux/device/bus.h | 4 ---- 2 files changed, 2 insertions(+), 7 deletions(-)drivers/base/bus.c +2
-3@@ -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 include/linux/device/bus.h +0
-5@@ -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
Re: [PATCH 4/6] driver core: make subsys_dev_iter_next() static
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
The function
subsys_dev_iter_next()is only used indrivers/base/bus.cso make it static to that file and remove the global export.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 41 lines
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)drivers/base/bus.c +1
-2@@ -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 include/linux/device/bus.h +0
-2@@ -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
Re: [PATCH 5/6] driver core: make subsys_dev_iter_exit() static
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
The function
subsys_dev_iter_exit()is not used outside ofdrivers/base/bus.cso make it static to that file and remove the global export.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 37 lines
--- drivers/base/bus.c | 3 +-- include/linux/device/bus.h | 1 - 2 files changed, 1 insertion(+), 3 deletions(-)drivers/base/bus.c +1
-2@@ -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) {include/linux/device/bus.h +0
-2@@ -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
Re: [PATCH 6/6] driver core: move struct subsys_dev_iter to a local file
In reply to Greg Kroah-HartmanQuoted 7 lines · Greg Kroah-Hartman
struct
subsys_dev_iteris not used by any code outside ofdrivers/base/bus.cso move it into that file and out of the globalbus.hfile.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 40 lines
--- drivers/base/bus.c | 5 +++++ include/linux/device/bus.h | 5 ----- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/base/bus.c +5
-0@@ -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 include/linux/device/bus.h +0
-6@@ -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
Greg Kroah-Hartman
maintainerQuoted 10 lines · Rafael J. Wysocki
Quoted 6 lines · Greg Kroah-Hartman
No one calls this function outside of
drivers/base/bus.cso make it static so it does not need to be exported anymore.Cc "Rafael J. Wysocki" <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Reviewed-by Rafael J. Wysocki <[email protected]>
Thanks for the reviews!