RE: [PATCH v2] net:realtek:use sysfs_emit() instead of scnprintf() for sysfs consistency

From: Ping-Ke Shih
Date: Mon Jul 28 2025 - 21:33:59 EST


Mande Imran Ahmed <immu.ahmed1905@xxxxxxxxx> wrote:
> Update the Realtek rtw89 wireless driver to replace scnprintf() with
> sysfs_emit() for formatting sysfs attribute output, in line with the
> recommendations from Documentation/filesystems/sysfs.rst.

As mentioned in v1. This is debugfs, not sysfs. The assumption of PAGE_SIZE
buffer can't be guaranteed. More, this driver must not depend on sysfs.

NACK. Please do not try to respin patch by v3 I'll ignore it.

>
> This change enhances the safety and correctness of sysfs handling,
> promotes consistency throughout the kernel, and aids long-term
> maintainability.
>
> Functionality verified using ping, iperf, and connection tests to ensure
> stability after the changes.
>
> Changes since v1:
> - Replaced sysfs_emit() with sysfs_emit_at()
> - Removed unused function parameters.
>
> Signed-off-by: Mande Imran Ahmed <immu.ahmed1905@xxxxxxxxx>

[...]


>
> - p += sysfs_emit(p, "ChainA offset: %d dBm\n", offset_patha);
> - p += sysfs_emit(p, "ChainB offset: %d dBm\n", offset_pathb);

By the way, the original driver never uses sysfs_emit().

> + len = sysfs_emit(buf, "ChainA offset: %d dBm\n", offset_patha);
> + len += sysfs_emit_at(buf, len, "ChainB offset: %d dBm\n", offset_pathb);

[...]