Message ID | 20240315055211.1347548-3-lizhijian@fujitsu.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 48be5774b21bd23b426d981b740b053b6c7ea278 |
Delegated to: | Kalle Valo |
Headers | show |
Series | [v2,1/3] wifi: ath: Convert sprintf/snprintf to sysfs_emit | expand |
Li Zhijian <lizhijian@fujitsu.com> writes: > 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> > --- > V2: subject updated > > This is a part of the work "Fix coccicheck device_attr_show warnings"[1] > Split them per subsystem so that the maintainer can review it easily > [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ > Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> Please resubmit the whole patchset as v3. https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#resubmit_the_whole_patchset
Kalle, On 18/03/2024 17:16, Kalle Valo wrote: > Li Zhijian <lizhijian@fujitsu.com> writes: > >> 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> >> --- >> V2: subject updated >> >> This is a part of the work "Fix coccicheck device_attr_show warnings"[1] >> Split them per subsystem so that the maintainer can review it easily >> [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ >> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> > > Please resubmit the whole patchset as v3. May I know what's wrong with this V2? or what update should I do in V3 > Even if just one patch has changed in a patch series resubmit the whole patchset (and remember to increase the version number), do not just resubmit that one changed patch. The reason is that it's difficult to apply patches in correct order when some of them are submitted separately. I thought I had followed this rule. Feel free to let me know if I missed something Thanks Zhijian > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches#resubmit_the_whole_patchset > >
"Zhijian Li (Fujitsu)" <lizhijian@fujitsu.com> writes: > Kalle, > > > On 18/03/2024 17:16, Kalle Valo wrote: >> Li Zhijian <lizhijian@fujitsu.com> writes: >> >>> 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> >>> --- >>> V2: subject updated >>> >>> This is a part of the work "Fix coccicheck device_attr_show warnings"[1] >>> Split them per subsystem so that the maintainer can review it easily >>> [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/ >>> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com> >> >> Please resubmit the whole patchset as v3. > > > May I know what's wrong with this V2? or what update should I do in V3 Sorry, my mistake. I didn't see patch 1 and I assumed it was not sent. But I checked patchwork now and I do see all three patches: https://patchwork.kernel.org/project/linux-wireless/list/?series=835497 So no need to resend anything because of this.
diff --git a/drivers/net/wireless/ti/wlcore/sysfs.c b/drivers/net/wireless/ti/wlcore/sysfs.c index f0c7e09b314d..c07acfcbbd9c 100644 --- a/drivers/net/wireless/ti/wlcore/sysfs.c +++ b/drivers/net/wireless/ti/wlcore/sysfs.c @@ -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;