From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C46FF1ADFE3; Mon, 6 Jan 2025 15:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736177145; cv=none; b=Xjdi8PkNvD4x9Hr/zHf9NHHrgGV6CuDssr3+DziTDyYWMwQpWZrwAjQisJQlITlHsdMyw2MMr+Dbb17Z9qhcTwVIyQC/S65lPATwtt2a70/FCeKp+3v+HfHm0XBnbWwEisfapi0tmAm5mA7btewgQJCYu5M726wQXFiZ/1fSW5g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736177145; c=relaxed/simple; bh=L+r9SSjrix5tx2N4a1HKVrE5kdsLgULA3UCT0ekXHW4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uxeMubJS8bkSIYICPoRXO8FjG9xHHvTgrZj0ZeBrZqBbr3Olb95FmQohkgwtbh/Yjql3JWwD8mPvBj9qh0pLjIl/LmDAxHmVDDS1oApkRtyIqzSsQbMpYLcIxd4TMenukL6FCMzYZTKH3YnqjRUj4T9CA5MsMhkBqVCDK2xVyA4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=gb3f7oOr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="gb3f7oOr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4D3ADC4CED2; Mon, 6 Jan 2025 15:25:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1736177145; bh=L+r9SSjrix5tx2N4a1HKVrE5kdsLgULA3UCT0ekXHW4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gb3f7oOrs4M9M4oqhrpqDg/fINcULT0gmsjLbCgwZ1LQFnp9c1QQr8736vZ2SLGDb /UUTLMM5Hn7EA20+Q/tvqP/vUMS5bqTfWCG62s9Kh4b7MXhYi/kUODH/bDVMLHXF8q x+IiDYNwFbYHdN//lCwPVyCWTdjlt7IrHm0jckeA= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Abel Vesa , Neil Armstrong , Johan Hovold , Dmitry Baryshkov , Sasha Levin Subject: [PATCH 6.6 067/222] usb: typec: ucsi: glink: be more precise on orientation-aware ports Date: Mon, 6 Jan 2025 16:14:31 +0100 Message-ID: <20250106151153.142247225@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250106151150.585603565@linuxfoundation.org> References: <20250106151150.585603565@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Baryshkov [ Upstream commit de9df030ccb5d3e31ee0c715d74cd77c619748f8 ] Instead of checking if any of the USB-C ports have orientation GPIO and thus is orientation-aware, check for the GPIO for the port being registered. There are no boards that are affected by this change at this moment, so the patch is not marked as a fix, but it might affect other boards in future. Reviewed-by: Abel Vesa Reviewed-by: Neil Armstrong Reviewed-by: Johan Hovold Tested-by: Johan Hovold Signed-off-by: Dmitry Baryshkov Link: https://lore.kernel.org/r/20241109-ucsi-glue-fixes-v2-2-8b21ff4f9fbe@linaro.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/typec/ucsi/ucsi_glink.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/ucsi/ucsi_glink.c b/drivers/usb/typec/ucsi/ucsi_glink.c index f6c3af5846e6..f0b4d0a4bb19 100644 --- a/drivers/usb/typec/ucsi/ucsi_glink.c +++ b/drivers/usb/typec/ucsi/ucsi_glink.c @@ -189,12 +189,12 @@ static int pmic_glink_ucsi_sync_write(struct ucsi *__ucsi, unsigned int offset, static void pmic_glink_ucsi_update_connector(struct ucsi_connector *con) { struct pmic_glink_ucsi *ucsi = ucsi_get_drvdata(con->ucsi); - int i; - for (i = 0; i < PMIC_GLINK_MAX_PORTS; i++) { - if (ucsi->port_orientation[i]) - con->typec_cap.orientation_aware = true; - } + if (con->num > PMIC_GLINK_MAX_PORTS || + !ucsi->port_orientation[con->num - 1]) + return; + + con->typec_cap.orientation_aware = true; } static void pmic_glink_ucsi_connector_status(struct ucsi_connector *con) -- 2.39.5