From nobody Tue Nov 12 04:10:55 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 4XnXym0snPz5d65K; Tue, 12 Nov 2024 04:10:56 +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 4XnXyl6Mlzz4FPX; Tue, 12 Nov 2024 04:10:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731384655; 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=W2QMJKwEQ/eDrhvQnZznPm0VRhJtKSc8G+ie6xBSUBg=; b=pdxbiRPRJ32rs5flwjPFXhyPokfhVF9JcMFCLvAHa6Nwe3OZV7cJy426Oja+0LkYftWR4j A870rRWWrDAn5nfxvQxBYOcDwvu9PEokhTRrym5jSRUGf4SYzHs2rs/+bWmfPFrK6lCtkd 1QJ5f6tIG1QyYy78PgTmqPbjnY+muTYR6nejyimRn+MnUevcq8s+7i/+4ETEKfdqB+4J8p 47ajVzuxTnDIy3ZRNeZtZ/+dr/VtFztgcc3DetnrBPP/mgSfIFEtUwVeZRq1eOF7OZ0zjK FTWPGqHXmKDRHfpljgcMlMe4jR90EBNEKco+ZhsJ3lhlh1IbcljcM860eH+Bqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731384655; 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=W2QMJKwEQ/eDrhvQnZznPm0VRhJtKSc8G+ie6xBSUBg=; b=NKGHbg0kItZQ2PIPH9M47fLUSKjIsMDiKYE4iDtHPo3MITDmcbuInuVOHlJKfb4yelziXx cMKjxaRJPtN4yg1r6VynZUNZSPZLN5OQcUXC7pOT4r4mO6lSEZhjltTWMxpmLuRQryJBWg NrDSc5/FTE+fTes52qxU+EMUt8OEwWR/ZCINdtt38dd2Vwz5/PyvP9nngb1QOzBG6n71D5 SlHIOX3yaQ1XvwqcQpDzVq1rJ2O1Un+YF3x60a9Q4T8Yli7sgJBSiK0McC1n1fDrXL0CYw uNYXiOTNuqhupHaqwkYFdtZTeXnKVtCnmOumDoGvnPWP80XoyENMslVrUwA8mA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731384655; a=rsa-sha256; cv=none; b=a044JCawWmDPZJU+qaTJl9jCYhJL1ABVqGA6K2zv/I0AffNHrzOW2sSaPKKoTquUMy6i6J i/LCudBtJb8Tbictze0b706WGrjvbOc0n003TpU8gmq3UJ+EY9FsrplkquGivVX3Z0fFJj xxf+PABdzeKlltVXE3OYDTw3JDXZikESawc6zawhNboPRD1f9Njia1zHk//yqoiPA6fnM0 T3jWQ28Z01uBVLbLHgf70dhQQnqA/vEHkWgfT3rrM3A0Rc05wFYYLXVVWp1+s9CNXCl3Du 7h7uaSY0mndNNZ2ZqULspUfaQI/FGGfLkVKKxyxVIguE8AupsbTP75ipSAVKrg== 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 4XnXyl5sVMzvs2; Tue, 12 Nov 2024 04:10:55 +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 4AC4Ated062495; Tue, 12 Nov 2024 04:10:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AC4At5G062492; Tue, 12 Nov 2024 04:10:55 GMT (envelope-from git) Date: Tue, 12 Nov 2024 04:10:55 GMT Message-Id: <202411120410.4AC4At5G062492@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Vladimir Kondratyev Subject: git: c53ec86f0ee9 - stable/14 - 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/stable/14 X-Git-Reftype: branch X-Git-Commit: c53ec86f0ee97f07f80c0902b189c845bf448e7d Auto-Submitted: auto-generated The branch stable/14 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=c53ec86f0ee97f07f80c0902b189c845bf448e7d commit c53ec86f0ee97f07f80c0902b189c845bf448e7d Author: Vladimir Kondratyev AuthorDate: 2024-11-08 19:23:38 +0000 Commit: Vladimir Kondratyev CommitDate: 2024-11-12 04:08:33 +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 (cherry picked from commit 018cb11cb7d412b031e1be681a6a19e734473f99) --- 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); }