Skip to content
Commit 273afac6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman
Browse files

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.org


Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 789be03a
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment