From nobody Tue Dec 16 16:35:43 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7A318C4167B for ; Fri, 8 Dec 2023 12:37:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573744AbjLHMhU (ORCPT ); Fri, 8 Dec 2023 07:37:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36824 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573740AbjLHMhQ (ORCPT ); Fri, 8 Dec 2023 07:37:16 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5D661E0 for ; Fri, 8 Dec 2023 04:37:22 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4FE1C433C7; Fri, 8 Dec 2023 12:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702039042; bh=gqQmFdVmCQcNd8eKCMxCHIDAeVXnQ1wKVZgIjb/cu7E=; h=From:To:Cc:Subject:Date:From; b=rGRLCeNzGWF3GpJdrEeFpcxOAAO3hSBToCupmGi0kWqtNUDaK5uGOOum3/+R1nCIG M21XLvFvzPQV0ZKl7Jptqcb67rDybpXqqQSgESiZjyKnhkEskWo8suGEWt6v3p6E5x n/X7wP1pd+75peLzsXgV0mPX/Qo1uyIl2c0yZYA30n4Rt57/0Qptu4Xf7jYFDLpp30 jT4cKNTdm5DP7S8ZneFs98UKXRVhnDCaowJZax3Uueqg57fL1MqwkWQoGp7rm4HKBs tKeWMP1ybW4TtBCJq7fcEG9t7g7zl/MfIXByv4Wva7GlYSk38LyyI0EbtdErq3rBml EIClylnvCZCjw== Received: from johan by xi.lan with local (Exim 4.96.2) (envelope-from ) id 1rBa7P-0007o9-1V; Fri, 08 Dec 2023 13:38:12 +0100 From: Johan Hovold To: Heikki Krogerus , Greg Kroah-Hartman Cc: Neil Armstrong , Dmitry Baryshkov , Konrad Dybcio , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Johan Hovold Subject: [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Date: Fri, 8 Dec 2023 13:36:02 +0100 Message-ID: <20231208123603.29957-1-johan+linaro@kernel.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Fix the recently added connector sanity check which was off by one and prevented orientation notifications from being handled correctly for the second port when using GPIOs to determine orientation. Fixes: c6165ed2f425 ("usb: ucsi: glink: use the connector orientation GPIO = to provide switch events") Cc: Neil Armstrong Signed-off-by: Johan Hovold Reviewed-by: Dmitry Baryshkov Reviewed-by: Heikki Krogerus --- I found this one through inspection when skimming the driver. Johan drivers/usb/typec/ucsi/ucsi_glink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/u= csi_glink.c index db6e248f8208..4853141cd10c 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -228,7 +228,7 @@ static void pmic_glink_ucsi_notify(struct work_struct *= work) =20 con_num =3D UCSI_CCI_CONNECTOR(cci); if (con_num) { - if (con_num < PMIC_GLINK_MAX_PORTS && + if (con_num <=3D PMIC_GLINK_MAX_PORTS && ucsi->port_orientation[con_num - 1]) { int orientation =3D gpiod_get_value(ucsi->port_orientation[con_num - 1]= ); =20 --=20 2.41.0