remove "#if 0" from find_bus function, export it.
PATCH 1/8 remove "#if 0" from find_bus function, export it.
This function were placed in "#if 0" because nobody was using it. We using it now.
See http://lwn.net/Articles/210610/
--- drivers/base/bus.c | 5 ++--- include/linux/device.h | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/base/bus.c +2 -3
@@ -667,14 +667,13 @@ void put_bus(struct bus_type * bus)* * Note that kset_find_obj increments bus' reference count. */ -#if 0 +struct bus_type *find_bus (char * name) {struct kobject * k =kset_find_obj (&bus_subsys.kset, name);return k ?to_bus (k) :NULL ; } -#endif /* 0 */ - +EXPORT_SYMBOL_GPL (find_bus);/** * bus_add_attrs - Add default attributes for this bus.
include/linux/device.h +2 -0
@@ -68,6 +68,8 @@ extern void bus_unregister(struct bus_type * bus);extern int __must_check bus_rescan_devices (struct bus_type * bus); +extern struct bus_type *find_bus (char *name); +/* iterator helpers for buses */ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data,
Signature · 1 line
1.5.1.1-dirty
Quoted 2 lines · Anton Vorontsov
This function were placed in "#if 0" because nobody was using it. We using it now.
Why? Shouldn't you just export the pointer you need instead?
Quoted 1 line
I don't understand the need for this link, it talks about how the api changes all the time, something we all know :)
And if you really want it, and you convince me you really need it, can you change it to be "bus_find" to play nicer in the namespace?
thanks,
greg k-h
Quoted 5 lines · Greg KH
Quoted 2 lines · Anton Vorontsov
This function were placed in "#if 0" because nobody was using it. We using it now.
Why? Shouldn't you just export the pointer you need instead?
We can do one way or another. We can ask W1 bus maintainer to export bus type. Or we can un-"if 0" generic find_bus/bus_find function.
Quoted 1 line
And if you really want it, and you convince me you really need it,
No, I don't want it at all. But ds2760_battery driver need to find w1 bus type.
A long time ago in a Galaxy far far away we're used to find_bus function, then it was removed, and somewhere in the thread I gave link to, someone suggested to show real user of that function and post that patch. I've just done that.
So, if you're unwilling to revert that function, please say it explicitly, and I'll ping w1 folks to export bus type.
I really-really don't care how exactly we should find that bus stuff.
Quoted 3 lines
thanks,
greg k-h
Good luck,
Signature · 4 lines
Anton Vorontsov email: [email protected] backup email: [email protected] irc://irc.freenode.org/bd2
Hello Greg,
Quoted 10 lines · you
Quoted 2 lines · Anton Vorontsov
This function were placed in "#if 0" because nobody was using it. We using it now.
Why? Shouldn't you just export the pointer you need instead?
Quoted 1 line
I don't understand the need for this link, it talks about how the api changes all the time, something we all know :)
No, it talked about how complete APIs regress into random
set of functions, lacking complete coverage of target domain. The response was that when users for the specific function in question will be in mainline, it will be resurrected. So, here it comes ;-)
Quoted 6 lines
And if you really want it, and you convince me you really need it, can you change it to be "
bus_find" to play nicer in the namespace?thanks,
greg k-h
Signature · 2 lines
Best regards, Paul mailto:[email protected]