driver core: bus: implement bus_get/put() without the private pointer
In the quest to make 'struct bus_type' constant and in read-only memory, we need to stop using the private pointer to the subsys_private structure. First step in doing this is to create a helper function that turns a 'struct bus_type' into 'struct subsys_private' called bus_to_subsys(). bus_to_subsys() walks the list of registered busses in the system and finds the matching one based on the pointer to the bus_type itself. As this is a short list, and this function is not on any fast path, it should not be noticable. Implement bus_get() and bus_put() using this new helper function. Cc: "Rafael J. Wysocki" <rafael@kernel.org> Link: https://lore.kernel.org/r/20230208111330.439504-3-gregkh@linuxfoundation.orgSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
Please register or sign in to comment