* FAILED: patch "[PATCH] usb: typec: ucsi: Don't update power_supply on power role" failed to apply to 6.12-stable tree
@ 2026-06-05 6:17 gregkh
2026-06-06 12:18 ` [PATCH 6.12.y 1/2] usb: typec: ucsi: Don't update power_supply on power role change if not connected Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2026-06-05 6:17 UTC (permalink / raw)
To: myrrhperiwinkle, gregkh, senozhatsky, stable; +Cc: stable
The patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x d98d413ca65d0790a8f3695d0a5845538958ab84
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2026060551-crazily-gatherer-b40f@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From d98d413ca65d0790a8f3695d0a5845538958ab84 Mon Sep 17 00:00:00 2001
From: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Date: Tue, 19 May 2026 18:41:40 +0700
Subject: [PATCH] usb: typec: ucsi: Don't update power_supply on power role
change if not connected
We only need to update the power_supply on power role change if the port
is connected, because otherwise the online status should be the same for
both cases.
Cc: stable <stable@kernel.org>
Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change")
Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Reported-and-tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-2-6f1239535187@qtmlabs.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 53c101bd48e2..61cb24ed820f 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1308,7 +1308,12 @@ static void ucsi_handle_connector_change(struct work_struct *work)
if ((change & UCSI_CONSTAT_POWER_DIR_CHANGE) && role != prev_role) {
typec_set_pwr_role(con->port, role);
- ucsi_port_psy_changed(con);
+
+ /* Some power_supply properties vary depending on the power direction when
+ * connected
+ */
+ if (UCSI_CONSTAT(con, CONNECTED))
+ ucsi_port_psy_changed(con);
/* Complete pending power role swap */
if (!completion_done(&con->complete))
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.12.y 1/2] usb: typec: ucsi: Don't update power_supply on power role change if not connected
2026-06-05 6:17 FAILED: patch "[PATCH] usb: typec: ucsi: Don't update power_supply on power role" failed to apply to 6.12-stable tree gregkh
@ 2026-06-06 12:18 ` Sasha Levin
2026-06-06 12:19 ` [PATCH 6.12.y 2/2] [AUTOMATED CONFLICT RESOLUTION] Documentation for d98d413ca65d0790a8f3695d0a5845538958ab84 Sasha Levin
0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2026-06-06 12:18 UTC (permalink / raw)
To: stable
Cc: Myrrh Periwinkle, stable, Sergey Senozhatsky, Greg Kroah-Hartman,
Sasha Levin
From: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
[ Upstream commit d98d413ca65d0790a8f3695d0a5845538958ab84 ]
We only need to update the power_supply on power role change if the port
is connected, because otherwise the online status should be the same for
both cases.
Cc: stable <stable@kernel.org>
Fixes: 7616f006db07 ("usb: typec: ucsi: Update power_supply on power role change")
Signed-off-by: Myrrh Periwinkle <myrrhperiwinkle@qtmlabs.xyz>
Reported-and-tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Link: https://patch.msgid.link/20260519-ucsi-fix-2-v1-2-6f1239535187@qtmlabs.xyz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[ This is documentation for an already-completed backport. The change is described clearly.
"translated upstream `UCSI_CONSTAT(con, CONNECTED)` accessor macro to in-tree idiom `con->status.flags & UCSI_CONSTAT_CONNECTED`" ]
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/usb/typec/ucsi/ucsi.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index efe45ce943747d..1ae12a47f75564 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -1231,7 +1231,12 @@ static void ucsi_handle_connector_change(struct work_struct *work)
if (con->status.change & UCSI_CONSTAT_POWER_DIR_CHANGE) {
typec_set_pwr_role(con->port, role);
- ucsi_port_psy_changed(con);
+
+ /* Some power_supply properties vary depending on the power direction when
+ * connected
+ */
+ if (con->status.flags & UCSI_CONSTAT_CONNECTED)
+ ucsi_port_psy_changed(con);
/* Complete pending power role swap */
if (!completion_done(&con->complete))
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 6.12.y 2/2] [AUTOMATED CONFLICT RESOLUTION] Documentation for d98d413ca65d0790a8f3695d0a5845538958ab84
2026-06-06 12:18 ` [PATCH 6.12.y 1/2] usb: typec: ucsi: Don't update power_supply on power role change if not connected Sasha Levin
@ 2026-06-06 12:19 ` Sasha Levin
0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2026-06-06 12:19 UTC (permalink / raw)
To: stable; +Cc: Sasha Levin
This commit documents the automated conflict resolution performed by claude
for upstream commit d98d413ca65d0790a8f3695d0a5845538958ab84.
claude's resolution process:
================================================================================
Done. Here's the detailed breakdown.
## The problem
Commit `d98d413ca65d` ("usb: typec: ucsi: Don't update power_supply on power role change if not connected") **cherry-picked without conflict markers** — git fuzzy-matched the unchanged anchor lines (`typec_set_pwr_role(con->port, role);` and `ucsi_port_psy_changed(con);`) and silently applied the body change. So it *looked* clean, but it failed to **build**.
The reason: upstream's hunk wraps the psy update in
```c
if (UCSI_CONSTAT(con, CONNECTED))
ucsi_port_psy_changed(con);
```
`UCSI_CONSTAT(con, FIELD)` is a **function-like accessor macro** introduced by a later UCSI refactor that is **not present in 6.12**. The 6.12 `ucsi.h` only defines the raw BIT-flag macros (`UCSI_CONSTAT_CONNECTED` = BIT(7), etc.), and every connected-check in this tree uses the old idiom `con->status.flags & UCSI_CONSTAT_CONNECTED`.
## The resolution
Single minimal change — translate the macro to the in-tree idiom:
```c
- if (UCSI_CONSTAT(con, CONNECTED))
+ if (con->status.flags & UCSI_CONSTAT_CONNECTED)
ucsi_port_psy_changed(con);
```
This matches exactly how connected status is read at ucsi.c:1108, 1149, 1251, 1663, 1937. The upstream comment was kept verbatim, and the actual fix logic (gate `ucsi_port_psy_changed()` on the port being connected) is byte-faithful. Result is +6/-1, identical line count to upstream.
**One subtlety I verified:** upstream's context line reads `if ((change & UCSI_CONSTAT_POWER_DIR_CHANGE) && role != prev_role)`. The `role != prev_role` comes from a *separate predecessor patch* (`b80e7d34`, the v1-1 of this series) that isn't in 6.12.92. But that text is **context, not payload** — this patch only changes the block body — so its absence is irrelevant to this backport and required no action.
## Verification
- Author preserved: **Myrrh Periwinkle** ✓
- Commit message unchanged ✓
- No functions added, no divergence beyond the one-line macro translation ✓
- **`stable build log`: 0 warnings / 0 errors on both x86_64 and aarch64** ✓
Committed as `782ea4e61bbf`.
================================================================================
Backport verification analysis (via claude):
================================================================================
Analysis complete. Here is my detailed verification.
## Backport Verification: `d98d413ca65d` → `b25f1e36558347` (6.12.92)
### 1. Intent preservation — ✅ Correct
The upstream fix gates `ucsi_port_psy_changed(con)` (a power_supply notification) behind a connection check inside the `POWER_DIR_CHANGE` handler. Rationale: when the port is disconnected, the `online` status is identical regardless of power-direction, so notifying power_supply is unnecessary/incorrect.
The backport reproduces this exactly:
```c
if (con->status.flags & UCSI_CONSTAT_CONNECTED)
ucsi_port_psy_changed(con);
```
preceded by the verbatim upstream comment. The gate logic is byte-faithful to upstream's intent.
### 2. Differences and justification
There are exactly **two** differences from the upstream diff, both fully justified:
**(a) Payload — the one real change (justified, required for build):**
Upstream uses `if (UCSI_CONSTAT(con, CONNECTED))`, a function-like accessor macro introduced by a later UCSI refactor that **does not exist in 6.12**. I confirmed `grep "define UCSI_CONSTAT("` returns nothing; 6.12's `ucsi.h` only has the raw bit macro `UCSI_CONSTAT_CONNECTED` (BIT(3), at ucsi.h:340). The resolution translates it to `con->status.flags & UCSI_CONSTAT_CONNECTED`, which is the established in-tree idiom — used identically at lines 1108, 1149, 1251, 1663, 1937 of the same file. Semantically equivalent and compiles. This is the correct and minimal resolution.
> Minor note: the resolution writeup claimed `UCSI_CONSTAT_CONNECTED = BIT(7)` — it's actually BIT(3). Harmless, since the named macro was used, not a literal.
**(b) Context-only difference (no action correctly taken):**
Upstream's block header is `if ((change & UCSI_CONSTAT_POWER_DIR_CHANGE) && role != prev_role)`; the backport's is `if (con->status.change & UCSI_CONSTAT_POWER_DIR_CHANGE)`. The `&& role != prev_role` and the local `change` variable come from the sibling predecessor `b80e7d34` (the v1-1 patch). I verified `prev_role` is **absent** from this tree — that predecessor isn't applied here. Since this patch only edits the *body* of the block, the differing header is pure context and does not affect the build or the fix. Correctly left untouched.
### 3. Potential issues — none material
- **Build:** The macro translation matches 5 existing call sites; no undefined symbols. Resolution reports 0W/0E on x86_64 + aarch64. Consistent with my static checks.
- **Dependency ordering:** `b80e7d34` (v1-1) ideally lands before this (v1-2) in the series, and per my prior records it was backported separately as `e405a0183c94`. Its absence here is benign — the two patches touch disjoint payloads (one edits the header condition, this one edits the block body), so neither build nor correctness depends on ordering. No risk introduced.
- **Metadata:** Author (Myrrh Periwinkle), message, Fixes/Link tags all preserved correctly.
### 4. Overall assessment — ✅ High quality, correct
A textbook clean amend. The cherry-pick fuzzy-matched the stable anchor lines and applied without conflict markers but would not have built due to the missing `UCSI_CONSTAT()` accessor macro. The single one-line translation to the native `con->status.flags & UCSI_CONSTAT_CONNECTED` idiom is the right fix, is faithful to upstream intent, matches local convention, and is line-count-identical to upstream (+6/−1). No concerns. Backport is correct.
(Recorded to memory for future reference under the `backport-review` tag, cross-linked to the `b80e7d34` 6.12 sibling.)
================================================================================
This is an empty commit for documentation purposes only.
--
2.53.0
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-06 12:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-05 6:17 FAILED: patch "[PATCH] usb: typec: ucsi: Don't update power_supply on power role" failed to apply to 6.12-stable tree gregkh
2026-06-06 12:18 ` [PATCH 6.12.y 1/2] usb: typec: ucsi: Don't update power_supply on power role change if not connected Sasha Levin
2026-06-06 12:19 ` [PATCH 6.12.y 2/2] [AUTOMATED CONFLICT RESOLUTION] Documentation for d98d413ca65d0790a8f3695d0a5845538958ab84 Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.