FAILED: patch "[PATCH] usb: typec: ucsi: Don't update power_supply on power role" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe 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 <[email protected]>.
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 '<[email protected]>' --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 <[email protected]>
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.
drivers/usb/typec/ucsi/ucsi.c +6 -1
@@ -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))
Sasha Levin
maintainerPATCH 1/2 usb: typec: ucsi: Don't update power_supply on power role change if not connected
From: Myrrh Periwinkle <[email protected]>
[ 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.
[ 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" ]
--- drivers/usb/typec/ucsi/ucsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/typec/ucsi/ucsi.c +6 -1
@@ -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))
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/2 Documentation for d98d413ca65d0790a8f3695d0a5845538958ab84
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.
Quoted 1 line
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.
Signature · 1 line
2.53.0