Re: [PATCH v2] hwmon: add driver for ARCTIC Fan Controller
From: Guenter Roeck
Date: Tue Mar 17 2026 - 12:07:25 EST
Hi,
On Fri, Mar 13, 2026 at 07:19:55PM +0800, Aureo Serrano de Souza wrote:
> Add hwmon driver for the ARCTIC Fan Controller (USB HID VID 0x3904,
> PID 0xF001) with 10 fan channels. Exposes fan RPM and PWM via sysfs.
> Device pushes IN reports at ~1 Hz; PWM is set via interrupt OUT reports.
>
> Fan speed control is manual-only: the device does not change PWM
> autonomously. After applying an OUT report, the device sends back a
> 2-byte ACK (Report ID 0x02); the driver waits up to 1 s for this ACK
> using a completion.
>
> The report buffer is kmalloc'd per write for two reasons:
>
> 1. Stack placement (suggested by reviewers with __aligned()) was tested
> but hard-rejected by usb_hcd_map_urb_for_dma(), which calls
> object_is_on_stack() and returns -EAGAIN regardless of alignment
> attributes. Confirmed on AMD X670E with AMD-Vi (IOMMU) enabled.
>
> 2. Struct-embedded placement (suggested as an alternative) would create
> a shared resource between concurrent arctic_fan_write() calls, causing
> a race if two users write different PWM channels simultaneously.
>
> kmalloc per write avoids both problems: the buffer is heap-allocated
> (passes DMA checks) and private to each write call (no sharing).
>
> Signed-off-by: Aureo Serrano de Souza <aureo.serrano@xxxxxxxxx>
> ---
Please also see AI review feedback at
https://sashiko.dev/#/patchset/20260313111955.36811-1-aureo.serrano%40arctic.de.
Thanks,
Guenter