Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp2352174rdb; Fri, 8 Dec 2023 05:57:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN586Kzi5vZE9lKiZjxg87SohVPNtclCAMjI0ngegXpGOB4jeQdjMujOh5XJgeYc7XxT0O X-Received: by 2002:a05:6a20:b904:b0:18f:d3d3:852 with SMTP id fe4-20020a056a20b90400b0018fd3d30852mr55373pzb.46.1702043825722; Fri, 08 Dec 2023 05:57:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702043825; cv=none; d=google.com; s=arc-20160816; b=SoEawO0lFw0APYsKm/MHNQowyLKU1aldh/EEC8tiQxcx62htl3wJMBXIh4R2UvJ1NQ RAgOrWQyoJSWOqObBy7MWEm7nrGL7uVjUmkC/fOo+FvO0S6an68JiKH5g4rE5dNo2ccz RQYBudy+Idw+0hX8r+7pAcY1jXLTfUpS5mRmrgIW9dTzBQZ4xCiTREViAan0xQjp/OD0 Da6tKHillPJrwjZNvBJyPTEYeA/ACm8GWhYUspvaHlv+Fa6384HRj2foMOZ/UBZ8hzrP x7kVpx//zp1ipU5I3OQ+gHvv0iB6Tsq3lSgX1IFEQ9f2PYmWDFfh2za5NYmjXif7NK4U ktng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=NbJEwsv5ol1HEeeG5Dh+3PF/1rK2sRXgVfzaAdYd7jg=; fh=7DwK3Cye5FXsgezqPYscaDdHLKuFDCdVZWFn2Q+BwaE=; b=nWH2ZWcDoG47i9dxUH+eCvccBKn8H2sLdJ8RAngnzU7uwoo4/J6eFxvzVyWn1dZc8R yUvzuVdyOk85L5lVLStzjnZ813Xz7hYa2RPTbzKSF2A40k1MSWrcP1bfMdzg6COu7DOa QCMNb2KFeOGzvjPx58yTW7ob7Pdik5y4gM1tHoOfwDrMdXKuIasT8u71qxYFYNhQSTMG /KwbO5/wj822cSwsBLRtyG4E82N/md8ubd+AIxehJBcV50+EluESsMH9YjCG+/sbrb0H lrEeRqEpQaX8PhrEbZBYgpuOL/zV4xgQjNDYWnKzVXDvay2P4Efg13NmDSIcKSVmhaum 26Hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QbPbZqnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 22-20020a630f56000000b005c65ed23b5bsi1607620pgp.149.2023.12.08.05.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 05:57:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=QbPbZqnx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 3C5638246336; Fri, 8 Dec 2023 05:57:02 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1573875AbjLHN4q (ORCPT + 99 others); Fri, 8 Dec 2023 08:56:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1573849AbjLHN4o (ORCPT ); Fri, 8 Dec 2023 08:56:44 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12F7B198C; Fri, 8 Dec 2023 05:56:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702043811; x=1733579811; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=55M1hh3vjcTT4qbO8ePl/PG9N+ftOAwqAUqgSIIaDag=; b=QbPbZqnx40/b5djRjENAAqQIPeMs8h/Z+0keaMOUm+ids76OeMO0xge2 L8JYANyrOZxgTszBakoF2oasQxCJR/f/4wQ3SMMfWuh9L1RBnZIRa6kyy Jt2dG3GgtFwUxk1rNHiHqSdZInwgEt8vSDOYa/YGAhgrDDBlG5x1b39PT xVVlWQ+nQRuT7A9aVYFOsN/sSip8VyQVlQWfl/MZjhGMoNU4a+uipoQHd oo3m2+OnzTQOsltOlWIjdAR7iGhev8B7pr5NbRPwcZvpC00AcS9idhf3f GXLgJLOHd/DW0Mi8lmm7cPJihoNLfkhB9hGFgn/WAecbaYRTBJJ9vQxm8 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="384811841" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="384811841" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2023 05:56:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10917"; a="721872348" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="721872348" Received: from kuha.fi.intel.com ([10.237.72.185]) by orsmga003.jf.intel.com with SMTP; 08 Dec 2023 05:56:47 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 08 Dec 2023 15:56:46 +0200 Date: Fri, 8 Dec 2023 15:56:46 +0200 From: Heikki Krogerus To: Johan Hovold Cc: Greg Kroah-Hartman , Neil Armstrong , Dmitry Baryshkov , Konrad Dybcio , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: typec: ucsi: fix gpio-based orientation detection Message-ID: References: <20231208123603.29957-1-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231208123603.29957-1-johan+linaro@kernel.org> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 08 Dec 2023 05:57:02 -0800 (PST) On Fri, Dec 08, 2023 at 01:36:02PM +0100, Johan Hovold wrote: > 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: 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/ucsi_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) > > con_num = UCSI_CCI_CONNECTOR(cci); > if (con_num) { > - if (con_num < PMIC_GLINK_MAX_PORTS && > + if (con_num <= PMIC_GLINK_MAX_PORTS && > ucsi->port_orientation[con_num - 1]) { > int orientation = gpiod_get_value(ucsi->port_orientation[con_num - 1]); > > -- > 2.41.0 -- heikki