brintos

brintos / linux public Read only

0
0

synaptics_init_smbus published HWJS_SUSPENDS unconditionally but has a no-suspend stub -> coroutinize refuse when CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=n #1

Closed sasha opened this issue · 1 comment
S sasha commented

drivers/input/mouse/synaptics.h (line 210) annotates synaptics_init_smbus() with HWJS_SUSPENDS unconditionally, but drivers/input/mouse/synaptics.c compiles it to a return -ENOSYS; stub when CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS is unset (the #else at ~line 1842). A published definition with no recognizable suspend point is hard-refused by the coroutinize pass:

[hwjs-coro] REFUSE fn=synaptics_init_smbus reason=published-def-no-suspend-point (hwjs-suspends on the definition asserts suspend-reachability but no suspend point is recognizable in the body ...)
cc-wasm.sh: FATAL (HWJS-2): the coroutinize pass REFUSED function(s) in this TU

So any config with CONFIG_MOUSE_PS2_SYNAPTICS=y and CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS=n fails to compile drivers/input/mouse/synaptics.o.

The current wasm32_defconfig sets SMBUS=y, so the default build is unaffected — the real body has 4 suspend points and coroutinizes fine. This is a latent fragility on a valid upstream Kconfig combination (SYNAPTICS without SMBUS), not a default-build blocker.

Reproduction (A/B, exact kernel build flags)

  • SMBUS=y (default): synaptics_init_smbus -> COROUTINIZE ... suspends=4 (OK).
  • SMBUS=n (force the #else stub): same compile -> REFUSE ... published-def-no-suspend-point.

Environment: super-repo ea2c034, linux pin 3bb77e2e, hwjs-cc b0ef2a1, clang 31e14b7, Ubuntu 20.04.6.

Proposed fix

Branch: brintos/linux@fix/synaptics-smbus-suspends-guard (commit c94acdc3) — the reviewable/mergeable fix (forge PRs are disabled).

Guard the annotation under the same #ifdef as the real definition, so the stub is not published; the SMBUS=y path (real body, 4 suspend points) is unchanged. One hunk:

--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -207,7 +207,11 @@ void synaptics_module_init(void);
 int synaptics_detect(struct psmouse *psmouse, bool set_properties) HWJS_SUSPENDS;
 int synaptics_init_absolute(struct psmouse *psmouse) HWJS_SUSPENDS;
 int synaptics_init_relative(struct psmouse *psmouse) HWJS_SUSPENDS;
-int synaptics_init_smbus(struct psmouse *psmouse) HWJS_SUSPENDS;
+int synaptics_init_smbus(struct psmouse *psmouse)
+#ifdef CONFIG_MOUSE_PS2_SYNAPTICS_SMBUS
+	HWJS_SUSPENDS
+#endif
+	;
 int synaptics_init(struct psmouse *psmouse) HWJS_SUSPENDS;
 void synaptics_reset(struct psmouse *psmouse) HWJS_SUSPENDS;

Verified against the exact kernel build flags: SMBUS=n no longer refuses (the stub is a plain native function), and SMBUS=y still COROUTINIZE ... suspends=4.

Proposed fix targets brintos/linux only — no distro submodule pins moved. All distros share one lineage, so pin bumps are coordinated on merge, not per-engineer.

jdbrinton assigned jdbrinton
jdbrinton jdbrinton commented

Reviewed and merged: your c94acdc3 from fix/synaptics-smbus-suspends-guard is cherry-picked verbatim (authorship preserved) onto joel-dev as 441123ee, on top of the HWJS-C-3 kernel work. The guard is exactly right — the annotation follows the same #ifdef as the real definition, so the SMBUS=n stub is a plain native function and the SMBUS=y real body (4 suspend points) is untouched; your A/B verification against the exact kernel build flags covers both arms.

joel-devwasm32 (the head branch) push happens later tonight with the rest of this batch; all distros come forward together on the next pin advance per the one-lineage rule. Thanks for the clean, reviewable fix. Closing.

jdbrinton closed this as completed