Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

driver core: fix inverted "locked" suffix of driver_match_device()

In the current implementation driver_match_device() expects the device
lock to be held, while driver_match_device_locked() acquires the device
lock.

By convention it should be the other way around, hence swap the name of
both functions.

Fixes: dc23806a7c47 ("driver core: enforce device_lock for driver_match_device()")
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: Gui-Dong Han <hanguidong02@gmail.com>
Link: https://patch.msgid.link/20260131014211.12841-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>

+8 -8
+5 -5
drivers/base/base.h
··· 179 179 void driver_detach(const struct device_driver *drv); 180 180 void driver_deferred_probe_del(struct device *dev); 181 181 void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf); 182 - static inline int driver_match_device(const struct device_driver *drv, 183 - struct device *dev) 182 + static inline int driver_match_device_locked(const struct device_driver *drv, 183 + struct device *dev) 184 184 { 185 185 device_lock_assert(dev); 186 186 187 187 return drv->bus->match ? drv->bus->match(dev, drv) : 1; 188 188 } 189 189 190 - static inline int driver_match_device_locked(const struct device_driver *drv, 191 - struct device *dev) 190 + static inline int driver_match_device(const struct device_driver *drv, 191 + struct device *dev) 192 192 { 193 193 guard(device)(dev); 194 - return driver_match_device(drv, dev); 194 + return driver_match_device_locked(drv, dev); 195 195 } 196 196 197 197 static inline void dev_sync_state(struct device *dev)
+1 -1
drivers/base/bus.c
··· 263 263 int err = -ENODEV; 264 264 265 265 dev = bus_find_device_by_name(bus, NULL, buf); 266 - if (dev && driver_match_device_locked(drv, dev)) { 266 + if (dev && driver_match_device(drv, dev)) { 267 267 err = device_driver_attach(drv, dev); 268 268 if (!err) { 269 269 /* success */
+2 -2
drivers/base/dd.c
··· 928 928 bool async_allowed; 929 929 int ret; 930 930 931 - ret = driver_match_device(drv, dev); 931 + ret = driver_match_device_locked(drv, dev); 932 932 if (ret == 0) { 933 933 /* no match */ 934 934 return 0; ··· 1180 1180 * is an error. 1181 1181 */ 1182 1182 1183 - ret = driver_match_device_locked(drv, dev); 1183 + ret = driver_match_device(drv, dev); 1184 1184 if (ret == 0) { 1185 1185 /* no match */ 1186 1186 return 0;