git: b8276743e4bb - releng/14.2 - iichid(4): Do not power down opened device in attach handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 12 Nov 2024 23:28:51 UTC
The branch releng/14.2 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=b8276743e4bbff1c11e910eef1599cbdfd88bc38 commit b8276743e4bbff1c11e910eef1599cbdfd88bc38 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2024-11-08 19:23:38 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2024-11-12 23:27:30 +0000 iichid(4): Do not power down opened device in attach handler Some iichid(4) child devices, currently hkbd(4) only, opens parent device in their attach handlers. That breaks internal iichid(4) state leading to rejecting any incoming data on software and hardware levels. Fix it with adding of extra state check in iichid(4) attach handler. Approved by: re (cperciva) Reported by: many Submitted by: trasz (initial version) PR: 280290 MFC after: 3 days (cherry picked from commit 018cb11cb7d412b031e1be681a6a19e734473f99) (cherry picked from commit c53ec86f0ee97f07f80c0902b189c845bf448e7d) --- sys/dev/iicbus/iichid.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/iicbus/iichid.c b/sys/dev/iicbus/iichid.c index 1e0dac2ee5dd..e99facdb06bb 100644 --- a/sys/dev/iicbus/iichid.c +++ b/sys/dev/iicbus/iichid.c @@ -1205,8 +1205,12 @@ iichid_attach(device_t dev) iichid_detach(dev); } done: - (void)iichid_set_power(sc, I2C_HID_POWER_OFF); - sc->power_on = false; + iicbus_request_bus(device_get_parent(dev), dev, IIC_WAIT); + if (!sc->open) { + (void)iichid_set_power(sc, I2C_HID_POWER_OFF); + sc->power_on = false; + } + iicbus_release_bus(device_get_parent(dev), dev); return (error); }