gpio: lock device when calling device_is_bound()
Subsystems (2)
cover gpio: lock device when calling device_is_bound()
The kerneldoc for device_is_bound() says it must be called with the device lock taken. Add missing synchronization to GPIO modules using it.
---
Bartosz Golaszewski (3):
gpio: sim: lock device when calling device_is_bound()
gpio: aggregator: lock device when calling device_is_bound()
gpio: virtuser: lock device when calling device_is_bound()
drivers/gpio/gpio-aggregator.c | 9 ++++++--- drivers/gpio/gpio-sim.c | 11 +++++++---- drivers/gpio/gpio-virtuser.c | 9 ++++++--- 3 files changed, 19 insertions(+), 10 deletions(-)
---
base-commit: 5200f5f493f79f14bbdc349e402a40dfb32f23c8
change-id: 20260518-gpio-dev-lock-827253e58535
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>
PATCH 1/3 gpio: sim: lock device when calling device_is_bound()
The kerneldoc for device_is_bound() says it must be called with the device lock taken. Add missing synchronization to this driver.
--- drivers/gpio/gpio-sim.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/gpio/gpio-sim.c +7 -4
@@ -901,7 +901,7 @@ static int gpio_sim_device_activate(struct gpio_sim_device *dev)struct platform_device *pdev;struct fwnode_handle *swnode;struct gpio_sim_bank *bank; -int ret; +int ret =0 ;lockdep_assert_held (&dev->lock);
@@ -945,9 +945,12 @@ static int gpio_sim_device_activate(struct gpio_sim_device *dev) }wait_for_device_probe (); -if (!device_is_bound (&pdev->dev)) { - ret = -ENXIO ; - goto err_unregister_pdev; + + scoped_guard(device, &pdev->dev) { +if (!device_is_bound (&pdev->dev)) { + ret = -ENXIO ; + goto err_unregister_pdev; + } } dev->pdev = pdev;
Signature · 1 line
2.47.3
PATCH 2/3 gpio: aggregator: lock device when calling device_is_bound()
In reply to Bartosz GolaszewskiThe kerneldoc for device_is_bound() says it must be called with the device lock taken. Add missing synchronization to this driver.
--- drivers/gpio/gpio-aggregator.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpio-aggregator.c +6 -3
@@ -968,9 +968,12 @@ static int gpio_aggregator_activate(struct gpio_aggregator *aggr) }wait_for_device_probe (); -if (!device_is_bound (&pdev->dev)) { - ret = -ENXIO ; - goto err_unregister_pdev; + + scoped_guard(device, &pdev->dev) { +if (!device_is_bound (&pdev->dev)) { + ret = -ENXIO ; + goto err_unregister_pdev; + } } aggr->pdev = pdev;
Signature · 1 line
2.47.3
PATCH 3/3 gpio: virtuser: lock device when calling device_is_bound()
In reply to Bartosz GolaszewskiThe kerneldoc for device_is_bound() says it must be called with the device lock taken. Add missing synchronization to this driver.
--- drivers/gpio/gpio-virtuser.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/gpio/gpio-virtuser.c +6 -3
@@ -1477,9 +1477,12 @@ gpio_virtuser_device_activate(struct gpio_virtuser_device *dev) }wait_for_device_probe (); -if (!device_is_bound (&pdev->dev)) { - ret = -ENXIO ; - goto err_unregister_pdev; + + scoped_guard(device, &pdev->dev) { +if (!device_is_bound (&pdev->dev)) { + ret = -ENXIO ; + goto err_unregister_pdev; + } } dev->pdev = pdev;
Signature · 1 line
2.47.3
Bartosz Golaszewski
AppliedQuoted 4 lines · Bartosz Golaszewski
The kerneldoc for
device_is_bound()says it must be called with the device lock taken. Add missing synchronization to GPIO modules using it.
Applied, thanks!
[1/3] gpio: sim: lock device when calling device_is_bound()
https://git.kernel.org/brgl/c/e70ae40d6660c5428c790c329318c570b4d038ab [2/3] gpio: aggregator: lock device when calling device_is_bound() https://git.kernel.org/brgl/c/598a2b3e2e0e6aa2e9f7843c96c45b5ea11e0411 [3/3] gpio: virtuser: lock device when calling device_is_bound() https://git.kernel.org/brgl/c/a4fa45c1d980bc2b9837f469119af24a9304a1fc
Best regards,
Signature · 1 line
Bartosz Golaszewski <[email protected]>