linuxkpi: Acquire giant when adding/removing i2c adapters

We need Giant as we run in a taskqueue_thread via linux_work.
This fix detaching amdgpu and i915kms.

Reviewed by:	bz, hselasky, imp
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D35478
This commit is contained in:
Emmanuel Vadot 2022-06-14 13:23:26 +02:00
parent f53b5fe786
commit d87fad3633

View File

@ -221,7 +221,9 @@ lkpi_i2c_add_adapter(struct i2c_adapter *adapter)
return (ENXIO);
}
bus_topo_lock();
error = bus_generic_attach(adapter->dev.parent->bsddev);
bus_topo_unlock();
if (error) {
device_printf(adapter->dev.parent->bsddev,
"failed to attach child: error %d\n", error);
@ -249,7 +251,9 @@ lkpi_i2c_del_adapter(struct i2c_adapter *adapter)
while ((child = device_find_child(adapter->dev.parent->bsddev, "lkpi_iic", unit++)) != NULL) {
if (adapter == LKPI_IIC_GET_ADAPTER(child)) {
bus_topo_lock();
device_delete_child(adapter->dev.parent->bsddev, child);
bus_topo_unlock();
rv = 0;
goto out;
}
@ -259,7 +263,9 @@ lkpi_i2c_del_adapter(struct i2c_adapter *adapter)
while ((child = device_find_child(adapter->dev.parent->bsddev, "lkpi_iicbb", unit++)) != NULL) {
if (adapter == LKPI_IIC_GET_ADAPTER(child)) {
bus_topo_lock();
device_delete_child(adapter->dev.parent->bsddev, child);
bus_topo_unlock();
rv = 0;
goto out;
}