mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
wifi: ti: Convert sprintf/snprintf to sysfs_emit
Per filesystems/sysfs.rst, show() should only use sysfs_emit() or sysfs_emit_at() when formatting the value to be returned to user space. coccinelle complains that there are still a couple of functions that use snprintf(). Convert them to sysfs_emit(). sprintf() will be converted as weel if they have. Generally, this patch is generated by make coccicheck M=<path/to/file> MODE=patch \ COCCI=scripts/coccinelle/api/device_attr_show.cocci No functional change intended CC: Kalle Valo <kvalo@kernel.org> CC: linux-wireless@vger.kernel.org Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Signed-off-by: Kalle Valo <kvalo@kernel.org> Link: https://msgid.link/20240315055211.1347548-3-lizhijian@fujitsu.com
This commit is contained in:
parent
6db5c15c8b
commit
48be5774b2
|
|
@ -19,11 +19,8 @@ static ssize_t bt_coex_state_show(struct device *dev,
|
|||
struct wl1271 *wl = dev_get_drvdata(dev);
|
||||
ssize_t len;
|
||||
|
||||
len = PAGE_SIZE;
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
len = snprintf(buf, len, "%d\n\n0 - off\n1 - on\n",
|
||||
wl->sg_enabled);
|
||||
len = sysfs_emit(buf, "%d\n\n0 - off\n1 - on\n", wl->sg_enabled);
|
||||
mutex_unlock(&wl->mutex);
|
||||
|
||||
return len;
|
||||
|
|
@ -78,13 +75,11 @@ static ssize_t hw_pg_ver_show(struct device *dev,
|
|||
struct wl1271 *wl = dev_get_drvdata(dev);
|
||||
ssize_t len;
|
||||
|
||||
len = PAGE_SIZE;
|
||||
|
||||
mutex_lock(&wl->mutex);
|
||||
if (wl->hw_pg_ver >= 0)
|
||||
len = snprintf(buf, len, "%d\n", wl->hw_pg_ver);
|
||||
len = sysfs_emit(buf, "%d\n", wl->hw_pg_ver);
|
||||
else
|
||||
len = snprintf(buf, len, "n/a\n");
|
||||
len = sysfs_emit(buf, "n/a\n");
|
||||
mutex_unlock(&wl->mutex);
|
||||
|
||||
return len;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user