public inbox for chrome-platform@lists.linux.dev
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: patches@lists.linux.dev, stable@vger.kernel.org
Cc: Jameson Thies <jthies@google.com>,
	Benson Leung <bleung@chromium.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Sasha Levin <sashal@kernel.org>,
	abhishekpandit@chromium.org, ukaszb@chromium.org,
	akuchynski@chromium.org, chrome-platform@lists.linux.dev
Subject: [PATCH AUTOSEL 6.16 20/85] usb: typec: ucsi: Add poll_cci operation to cros_ec_ucsi
Date: Sun,  3 Aug 2025 20:22:29 -0400	[thread overview]
Message-ID: <20250804002335.3613254-20-sashal@kernel.org> (raw)
In-Reply-To: <20250804002335.3613254-1-sashal@kernel.org>

From: Jameson Thies <jthies@google.com>

[ Upstream commit 300386d117a98961fc1d612d1f1a61997d731b8a ]

cros_ec_ucsi fails to allocate a UCSI instance in it's probe function
because it does not define all operations checked by ucsi_create.
Update cros_ec_ucsi operations to use the same function for read_cci
and poll_cci.

Signed-off-by: Jameson Thies <jthies@google.com>
Reviewed-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20250711202033.2201305-1-jthies@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---

LLM Generated explanations, may be completely bogus:

Now I understand the timeline:
1. The cros_ec_ucsi driver was added on 2024-12-31
2. The poll_cci requirement was added on 2025-02-17 (after the
   cros_ec_ucsi driver was already in the kernel)
3. This broke the cros_ec_ucsi driver because it didn't have the
   poll_cci operation defined

**Backport Status: YES**

This commit fixes a regression where the cros_ec_ucsi driver fails to
allocate a UCSI instance during probe because it lacks the poll_cci
operation that became mandatory in commit 976e7e9bdc77 ("acpi: typec:
ucsi: Introduce a ->poll_cci method").

The commit meets all criteria for stable backporting:

1. **Fixes a real bug**: The driver completely fails to probe without
   this fix, preventing ChromeOS EC-based UCSI devices from working at
   all. The error occurs in ucsi_create() at
   drivers/usb/typec/ucsi/ucsi.c:1933 where it checks for the presence
   of all required operations including poll_cci.

2. **Small and contained change**: The fix is minimal - it only adds one
   line to the operations structure (`.poll_cci = cros_ucsi_read_cci,`),
   reusing the existing read_cci implementation which is appropriate for
   this driver.

3. **No side effects**: The change simply allows the driver to pass the
   operations validation check. Using the same function for both
   read_cci and poll_cci is the correct approach for drivers that don't
   have the ACPI-specific sync issues that prompted the poll_cci split.

4. **Fixes a regression**: This is fixing a regression introduced by
   commit 976e7e9bdc77, which itself was marked for stable. Any stable
   kernel that includes 976e7e9bdc77 but not this fix will have a broken
   cros_ec_ucsi driver.

5. **Clear fix relationship**: The commit message clearly identifies the
   problem (ucsi_create fails due to missing operation) and the solution
   is straightforward.

This should be backported to any stable kernel that includes both:
- commit f1a2241778d9 ("usb: typec: ucsi: Implement ChromeOS UCSI
  driver")
- commit 976e7e9bdc77 ("acpi: typec: ucsi: Introduce a ->poll_cci
  method")

 drivers/usb/typec/ucsi/cros_ec_ucsi.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/typec/ucsi/cros_ec_ucsi.c b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
index 4ec1c6d22310..eed2a7d0ebc6 100644
--- a/drivers/usb/typec/ucsi/cros_ec_ucsi.c
+++ b/drivers/usb/typec/ucsi/cros_ec_ucsi.c
@@ -137,6 +137,7 @@ static int cros_ucsi_sync_control(struct ucsi *ucsi, u64 cmd, u32 *cci,
 static const struct ucsi_operations cros_ucsi_ops = {
 	.read_version = cros_ucsi_read_version,
 	.read_cci = cros_ucsi_read_cci,
+	.poll_cci = cros_ucsi_read_cci,
 	.read_message_in = cros_ucsi_read_message_in,
 	.async_control = cros_ucsi_async_control,
 	.sync_control = cros_ucsi_sync_control,
-- 
2.39.5


       reply	other threads:[~2025-08-04  0:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20250804002335.3613254-1-sashal@kernel.org>
2025-08-04  0:22 ` Sasha Levin [this message]
2025-08-04  0:23 ` [PATCH AUTOSEL 6.16 59/85] platform/chrome: cros_ec_sensorhub: Retries when a sensor is not ready Sasha Levin
2025-08-04  0:23 ` [PATCH AUTOSEL 6.16 79/85] platform/chrome: cros_ec_typec: Defer probe on missing EC parent Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250804002335.3613254-20-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=abhishekpandit@chromium.org \
    --cc=akuchynski@chromium.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=gregkh@linuxfoundation.org \
    --cc=jthies@google.com \
    --cc=patches@lists.linux.dev \
    --cc=stable@vger.kernel.org \
    --cc=ukaszb@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox