driver core: platform: simplify __platform_driver_probe()
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 31 Jan 2023 08:24:59 +0000 (09:24 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Feb 2023 13:08:10 +0000 (14:08 +0100)
commit40b3880dc29b89c39139eba11eba2b3107dc2e38
tree2891fbe2e13c5dfe8a96894c46efbcb96c7954ae
parentb4ce0bf7ab02c46676276ca1e8d4c5789528b439
driver core: platform: simplify __platform_driver_probe()

__platform_driver_probe() pokes around in some bus and driver private
lists and locks in a way that is not needed at all.  The code only wants
to know if a device was bound to the driver that was registered, so walk
all devices on the bus to see if there was a match.  If there is not a
match, return an error.  This is the same logic as was originally
present, but just done in a simpler and more obvious way that is not a
layering violation.

Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Link: https://lore.kernel.org/r/20230131082459.301603-2-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/base/platform.c