]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Restore the ability for i2c slave devices to do IO from their probe method.
authorian <ian@FreeBSD.org>
Mon, 8 Jul 2019 20:26:56 +0000 (20:26 +0000)
committerian <ian@FreeBSD.org>
Mon, 8 Jul 2019 20:26:56 +0000 (20:26 +0000)
commit28262d704c3ffbed8b04830b6b123cbc280ec31d
treeaaa0e814d2eb5c1f9c033e6b47a0751caeec675d
parenta5b13b0b5d2b2cbae2fe391d8ccc58e5b5c79027
Restore the ability for i2c slave devices to do IO from their probe method.

r348164 added code to iicbus_request_bus/iicbus_release_bus to automatically
call device_busy()/device_unbusy() as part of aquiring exclusive use of the
bus (so modules can't be unloaded while the bus is exclusively owned and/or
IO is in progress).  That broke the ability to do i2c IO from a slave device
probe method, because the slave isn't attached yet, so calling device_busy()
triggers a sanity-check panic for trying to busy a non-attached device.

Now we check whether the device status is < DS_ATTACHING, and if so we busy
the iicbus rather than the slave device.  I think this leaves a small window
where a module could be unloaded while probing is in progress.  But I think
that's true of all devices, and probably should be fixed by introducing a
DS_PROBING state for devices, and handling that at various points in the
newbus code.
sys/dev/iicbus/iicbus.h
sys/dev/iicbus/iiconf.c