git: 018cb11cb7d4 - main - iichid(4): Do not power down opened device in attach handler
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 09 Nov 2024 05:12:07 UTC
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=018cb11cb7d412b031e1be681a6a19e734473f99 commit 018cb11cb7d412b031e1be681a6a19e734473f99 Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2024-11-08 19:23:38 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2024-11-09 05:11:09 +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. Reported by: many Submitted by: trasz (initial version) PR: 280290 MFC after: 3 days --- 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 fc9f5c2a68b3..86b02250d5d3 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); }