mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
Driver core fixes for 7.0-rc3
- Revert "driver core: enforce device_lock for driver_match_device()": When a device is already present in the system and a driver is registered on the same bus, we iterate over all devices registered on this bus to see if one of them matches. If we come across an already bound one where the corresponding driver crashed while holding the device lock (e.g. in probe()) we can't make any progress anymore. Thus, revert and clarify that an implementer of struct bus_type must not expect match() to be called with the device lock held. -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaawGIAAKCRBFlHeO1qrK LmYsAP0XzV/dZVrEqU5AvchbcuZ7kfAKotj4wPUIAkoT3gzMcQEAqNm7Vaf2ulDs CS8XvRi0PX6inD1Oo3dqwb0rKjKfFwY= =GT+5 -----END PGP SIGNATURE----- Merge tag 'driver-core-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core Pull driver core fix from Danilo Krummrich: - Revert "driver core: enforce device_lock for driver_match_device()": When a device is already present in the system and a driver is registered on the same bus, we iterate over all devices registered on this bus to see if one of them matches. If we come across an already bound one where the corresponding driver crashed while holding the device lock (e.g. in probe()) we can't make any progress anymore. Thus, revert and clarify that an implementer of struct bus_type must not expect match() to be called with the device lock held. * tag 'driver-core-7.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: Revert "driver core: enforce device_lock for driver_match_device()"
This commit is contained in:
commit
e33aafac04
3 changed files with 4 additions and 11 deletions
|
|
@ -179,19 +179,10 @@ void device_release_driver_internal(struct device *dev, const struct device_driv
|
|||
void driver_detach(const struct device_driver *drv);
|
||||
void driver_deferred_probe_del(struct device *dev);
|
||||
void device_set_deferred_probe_reason(const struct device *dev, struct va_format *vaf);
|
||||
static inline int driver_match_device_locked(const struct device_driver *drv,
|
||||
struct device *dev)
|
||||
{
|
||||
device_lock_assert(dev);
|
||||
|
||||
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
|
||||
}
|
||||
|
||||
static inline int driver_match_device(const struct device_driver *drv,
|
||||
struct device *dev)
|
||||
{
|
||||
guard(device)(dev);
|
||||
return driver_match_device_locked(drv, dev);
|
||||
return drv->bus->match ? drv->bus->match(dev, drv) : 1;
|
||||
}
|
||||
|
||||
static inline void dev_sync_state(struct device *dev)
|
||||
|
|
|
|||
|
|
@ -928,7 +928,7 @@ static int __device_attach_driver(struct device_driver *drv, void *_data)
|
|||
bool async_allowed;
|
||||
int ret;
|
||||
|
||||
ret = driver_match_device_locked(drv, dev);
|
||||
ret = driver_match_device(drv, dev);
|
||||
if (ret == 0) {
|
||||
/* no match */
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,8 @@ struct fwnode_handle;
|
|||
* otherwise. It may also return error code if determining that
|
||||
* the driver supports the device is not possible. In case of
|
||||
* -EPROBE_DEFER it will queue the device for deferred probing.
|
||||
* Note: This callback may be invoked with or without the device
|
||||
* lock held.
|
||||
* @uevent: Called when a device is added, removed, or a few other things
|
||||
* that generate uevents to add the environment variables.
|
||||
* @probe: Called when a new device or driver add to this bus, and callback
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue