* [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit
@ 2021-10-13 3:27 Qing Wang
2021-10-13 12:36 ` Luis Chamberlain
2021-10-18 12:34 ` Kalle Valo
0 siblings, 2 replies; 3+ messages in thread
From: Qing Wang @ 2021-10-13 3:27 UTC (permalink / raw)
To: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, Kalle Valo,
David S. Miller, Jakub Kicinski, linux-wireless, netdev,
linux-kernel
Cc: Qing Wang
coccicheck complains about the use of snprintf() in sysfs show functions.
Fix the coccicheck warning:
WARNING: use scnprintf or sprintf.
Use sysfs_emit instead of scnprintf or sprintf makes more sense.
Signed-off-by: Qing Wang <wangqing@vivo.com>
---
drivers/net/wireless/ath/ath5k/sysfs.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/ath5k/sysfs.c b/drivers/net/wireless/ath/ath5k/sysfs.c
index 8113bad..37bf641 100644
--- a/drivers/net/wireless/ath/ath5k/sysfs.c
+++ b/drivers/net/wireless/ath/ath5k/sysfs.c
@@ -14,7 +14,7 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
{ \
struct ieee80211_hw *hw = dev_get_drvdata(dev); \
struct ath5k_hw *ah = hw->priv; \
- return snprintf(buf, PAGE_SIZE, "%d\n", get); \
+ return sysfs_emit(buf, "%d\n", get); \
} \
\
static ssize_t ath5k_attr_store_##name(struct device *dev, \
@@ -41,7 +41,7 @@ static ssize_t ath5k_attr_show_##name(struct device *dev, \
{ \
struct ieee80211_hw *hw = dev_get_drvdata(dev); \
struct ath5k_hw *ah = hw->priv; \
- return snprintf(buf, PAGE_SIZE, "%d\n", get); \
+ return sysfs_emit(buf, "%d\n", get); \
} \
static DEVICE_ATTR(name, 0444, ath5k_attr_show_##name, NULL)
@@ -64,7 +64,7 @@ static ssize_t ath5k_attr_show_noise_immunity_level_max(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", ATH5K_ANI_MAX_NOISE_IMM_LVL);
+ return sysfs_emit(buf, "%d\n", ATH5K_ANI_MAX_NOISE_IMM_LVL);
}
static DEVICE_ATTR(noise_immunity_level_max, 0444,
ath5k_attr_show_noise_immunity_level_max, NULL);
@@ -73,7 +73,7 @@ static ssize_t ath5k_attr_show_firstep_level_max(struct device *dev,
struct device_attribute *attr,
char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d\n", ATH5K_ANI_MAX_FIRSTEP_LVL);
+ return sysfs_emit(buf, "%d\n", ATH5K_ANI_MAX_FIRSTEP_LVL);
}
static DEVICE_ATTR(firstep_level_max, 0444,
ath5k_attr_show_firstep_level_max, NULL);
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit
2021-10-13 3:27 [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit Qing Wang
@ 2021-10-13 12:36 ` Luis Chamberlain
2021-10-18 12:34 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Luis Chamberlain @ 2021-10-13 12:36 UTC (permalink / raw)
To: Qing Wang
Cc: Jiri Slaby, Nick Kossifidis, Kalle Valo, David S. Miller,
Jakub Kicinski, linux-wireless, netdev, linux-kernel
On Tue, Oct 12, 2021 at 08:27:31PM -0700, Qing Wang wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the coccicheck warning:
> WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Luis
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit
2021-10-13 3:27 [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-13 12:36 ` Luis Chamberlain
@ 2021-10-18 12:34 ` Kalle Valo
1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2021-10-18 12:34 UTC (permalink / raw)
To: Qing Wang
Cc: Jiri Slaby, Nick Kossifidis, Luis Chamberlain, David S. Miller,
Jakub Kicinski, linux-wireless, netdev, linux-kernel, Qing Wang
Qing Wang <wangqing@vivo.com> wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the coccicheck warning:
> WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Patch applied to ath-next branch of ath.git, thanks.
65b4b8aa0f59 ath5k: replace snprintf in show functions with sysfs_emit
--
https://patchwork.kernel.org/project/linux-wireless/patch/1634095651-4273-1-git-send-email-wangqing@vivo.com/
https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-10-18 12:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 3:27 [PATCH] wireless: ath5k: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-13 12:36 ` Luis Chamberlain
2021-10-18 12:34 ` Kalle Valo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).