Commit Graph
2 Commits
Author SHA1 Message Date
Lucas Kawatoko 9cf132d9b5 fix: avoid spurious WARN in rwnx_close during USB teardown
Unplugging the adapter while the interface is connecting or disconnecting
prints a spurious kernel warning:

  rwnx_close connecting or disconnecting, not finish
  WARNING: CPU: ... rwnx_close+0x96/0x3f0 [aic8800_fdrv]

rwnx_close() waits up to 4 seconds for drv_conn_state to leave
CONNECTING/DISCONNECTING, but that state only changes when the firmware
answers the pending request. During USB teardown the bus is already down
by the time rwnx_close() runs, and rwnx_send_msg() drops the message and
returns 0, so the confirmation never arrives. The wait therefore always
runs its full timeout and fires WARN_ON(1) for a condition that cannot be
satisfied.

Skip both waits when the bus is down, using the same condition already
used a few lines below in the vif_started path. This removes the wait
itself, not just the warning: previously teardown blocked for up to 4 (and
2) seconds waiting on a dead bus.

Reproduced on 6.12.107+deb13 with an AIC8800D80: unplug while connected
fires the warning on main and produces none with this change, while the
replug path still re-enumerates and restores Wi-Fi and Bluetooth. Builds
on 5.15.0-191, 6.1.0-53, 6.8.0-139, 6.11.0-8 and 6.12.107+deb13 with no
new warnings.
2026-09-24 09:07:55 -03:00
Lucas Kawatoko 264f29db21 fix: handle set_monitor_channel dev parameter on 6.12 stable
cfg80211_ops.set_monitor_channel() gained a "struct net_device *dev"
parameter in mainline 6.13, and the change was backported to the 6.12
stable series starting with 6.12.101. Debian 13 ships 6.12.107, so the
existing ">= 6.13.0" guards select the old prototype there and the build
fails with -Wincompatible-pointer-types:

  rwnx_main.c: error: initialization of
    'int (*)(struct wiphy *, struct net_device *, struct cfg80211_chan_def *)'
    from incompatible pointer type
    'int (*)(struct wiphy *, struct cfg80211_chan_def *)'
    [-Wincompatible-pointer-types]

This is the failure reported in #96 for Debian 13 trixie.

Introduce AICWF_CFG80211_SET_MONITOR_CHANNEL_HAS_DEV in rwnx_compat.h,
defined at AICWF_CFG80211_VERSION_CODE >= 6.12.101, and gate the nine
set_monitor_channel call sites on it instead of comparing against 6.13.0.
The threshold covers both the 6.12 backport and mainline 6.13, while
kernels 6.11 and earlier 6.12.x keep the old prototype. The check now
lives in one place and follows the existing AICWF_CFG80211_VERSION_CODE
convention, so OpenWrt builds can override it with CFG80211_VERSION.

The MODULE_IMPORT_NS guard at rwnx_main.c that also checks 6.13.0 is
unrelated and is left untouched.

Verified with clean builds against linux-headers 5.15.0-191,
6.1.0-53, 6.8.0-139, 6.11.0-8 and 6.12.107+deb13.
2026-09-21 23:06:15 -03:00