From nobody Sat Nov 09 05:12:07 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XlkSl4Vctz5dKlg; Sat, 09 Nov 2024 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XlkSl3p6Cz4GxY; Sat, 9 Nov 2024 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731129127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xtJIhZX8YtLztye5mDagqeHKkzLkwfmLuDPyYwJTzIc=; b=QWYB0TVXXwtLyN6zQXRxDHG9BsJODFd5tRYA+ASgZRQNcdY60WTspPb6ewN2HWY7aTHp4y rs+0MMdJznNhxmV1IDEctap/8aBiFnZp7VP1s9Fe14V4rIp5yWoKDgKbpb8Q/VnellHgwX BdrHhZ3pmqlPh+daF8k8cqYmsRhH5m64coaVIO3fcN+Z5tSceKgRWUGo7C/wvh4fMAaE0e aI6fCIufJQMEpwRaMEeOclvQil9zvmQwiugUMUEMAjbh28f8FBCRVs2Ttgo3AtJ9JFhs/D NK1JtmwIGrQRJ73gJikanIeaznyA9qwpmyQz+sb8R9Uip5n7K1hk59mIWY8IKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731129127; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xtJIhZX8YtLztye5mDagqeHKkzLkwfmLuDPyYwJTzIc=; b=YOYeSz3+jkL8SnENsDFAaaLBH2F/mUdKxiMKqkcGmZavmscjDtGZYJliPvzETY1ERTs3pN QgTuwJU8TmcVEYTLbg+bYcMXHjsze3NeynE9kve6An9dMStt9gOBmDsJIubYAjrXUYLkCb 3jvi4+SrTUsV+maemOZ5PuD++Q8VqPvQ/tuRLvamVkL49MnZuaPMGCQlt+ZMaZoIUiD+CW rSWeCtsv/czH6lAtmUBV6673d+kaH/agc9laQYr7le6vGtqx9eWbHrLu/0y5Gn2BpSduBN TcO0RchdxN6AE10eE8/DW9kB0Wn3a7GZxfV648/PjtV24joCLK70H7W5f2eakA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731129127; a=rsa-sha256; cv=none; b=QMUZGqLn9bg/espXnxwDG9mtwHiHI4rJ/z3VFAt/r1YEPfTQpBMWNuVq3FW8YVpk3PUj3O MLYZ9/e9fbywS25Mb61MlChYOLD3fAEtv2fY1s7xmyjDXHENntWj5w4ihl9aGM91nbuZrN 1Z9TcdNl2oDE0U+rSmIIC6TrjZaNbvTsiJ1X/3/WAC1TDT416EsxqeNcW7YDvxtCYFe6gB xiGJFGoO4kA3jqSZKMFVoxcEofUyJk2Rx8zdrOZOHU7v3UZ+aLzf2tpHrb0T3LyVszmmEg qOkslOO0SL2FwgpR3kIpBrwy2+1iew1LbtnFmk4hOoydsvVkBsNxE9e5/66PzQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XlkSl3P8Tz11RR; Sat, 9 Nov 2024 05:12:07 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4A95C7CG063415; Sat, 9 Nov 2024 05:12:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4A95C7J2063412; Sat, 9 Nov 2024 05:12:07 GMT (envelope-from git) Date: Sat, 9 Nov 2024 05:12:07 GMT Message-Id: <202411090512.4A95C7J2063412@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 018cb11cb7d4 - main - iichid(4): Do not power down opened device in attach handler List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 018cb11cb7d412b031e1be681a6a19e734473f99 Auto-Submitted: auto-generated The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=018cb11cb7d412b031e1be681a6a19e734473f99 commit 018cb11cb7d412b031e1be681a6a19e734473f99 Author: Vladimir Kondratyev AuthorDate: 2024-11-08 19:23:38 +0000 Commit: Vladimir Kondratyev 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); }