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,