* [PATCH] counter: replace snprintf in show functions with sysfs_emit
@ 2021-10-13 3:26 ` Qing Wang
0 siblings, 0 replies; 4+ messages in thread
From: Qing Wang @ 2021-10-13 3:26 UTC (permalink / raw)
To: Fabrice Gasnier, William Breathitt Gray, Maxime Coquelin,
Alexandre Torgue, linux-iio, linux-stm32, linux-arm-kernel,
linux-kernel
Cc: Qing Wang
coccicheck complains about the use of snprintf() in sysfs show functions.
Fix the following coccicheck warning:
drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf.
drivers/counter/stm32-lptimer-cnt.c:176:8-16: 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/counter/stm32-lptimer-cnt.c | 2 +-
drivers/counter/stm32-timer-cnt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
index c19d998..6f1113a 100644
--- a/drivers/counter/stm32-lptimer-cnt.c
+++ b/drivers/counter/stm32-lptimer-cnt.c
@@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
{
struct stm32_lptim_cnt *const priv = counter->priv;
- return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling);
+ return sysfs_emit(buf, "%u\n", priv->ceiling);
}
static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 603b30a..e772586 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter,
regmap_read(priv->regmap, TIM_ARR, &arr);
- return snprintf(buf, PAGE_SIZE, "%u\n", arr);
+ return sysfs_emit(buf, "%u\n", arr);
}
static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] counter: replace snprintf in show functions with sysfs_emit
@ 2021-10-13 3:26 ` Qing Wang
0 siblings, 0 replies; 4+ messages in thread
From: Qing Wang @ 2021-10-13 3:26 UTC (permalink / raw)
To: Fabrice Gasnier, William Breathitt Gray, Maxime Coquelin,
Alexandre Torgue, linux-iio, linux-stm32, linux-arm-kernel,
linux-kernel
Cc: Qing Wang
coccicheck complains about the use of snprintf() in sysfs show functions.
Fix the following coccicheck warning:
drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf.
drivers/counter/stm32-lptimer-cnt.c:176:8-16: 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/counter/stm32-lptimer-cnt.c | 2 +-
drivers/counter/stm32-timer-cnt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
index c19d998..6f1113a 100644
--- a/drivers/counter/stm32-lptimer-cnt.c
+++ b/drivers/counter/stm32-lptimer-cnt.c
@@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
{
struct stm32_lptim_cnt *const priv = counter->priv;
- return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling);
+ return sysfs_emit(buf, "%u\n", priv->ceiling);
}
static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 603b30a..e772586 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter,
regmap_read(priv->regmap, TIM_ARR, &arr);
- return snprintf(buf, PAGE_SIZE, "%u\n", arr);
+ return sysfs_emit(buf, "%u\n", arr);
}
static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] counter: replace snprintf in show functions with sysfs_emit
2021-10-13 3:26 ` Qing Wang
@ 2021-10-14 6:38 ` William Breathitt Gray
-1 siblings, 0 replies; 4+ messages in thread
From: William Breathitt Gray @ 2021-10-14 6:38 UTC (permalink / raw)
To: Qing Wang
Cc: Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, linux-iio,
linux-stm32, linux-arm-kernel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 2088 bytes --]
On Tue, Oct 12, 2021 at 08:26:59PM -0700, Qing Wang wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the following coccicheck warning:
> drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf.
> drivers/counter/stm32-lptimer-cnt.c:176:8-16: WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
Hello Qing Wang,
Thank you for your submission. I believe these warnings are already
resolved by commit d70e46af7531 ("counter: Internalize sysfs interface
code") in the linux-next tree. Would you verify whether that is the case
or if we still need to fix this?
Sincerely,
William Breathitt Gray
> ---
> drivers/counter/stm32-lptimer-cnt.c | 2 +-
> drivers/counter/stm32-timer-cnt.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
> index c19d998..6f1113a 100644
> --- a/drivers/counter/stm32-lptimer-cnt.c
> +++ b/drivers/counter/stm32-lptimer-cnt.c
> @@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
> {
> struct stm32_lptim_cnt *const priv = counter->priv;
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling);
> + return sysfs_emit(buf, "%u\n", priv->ceiling);
> }
>
> static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 603b30a..e772586 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter,
>
> regmap_read(priv->regmap, TIM_ARR, &arr);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", arr);
> + return sysfs_emit(buf, "%u\n", arr);
> }
>
> static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
> --
> 2.7.4
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] counter: replace snprintf in show functions with sysfs_emit
@ 2021-10-14 6:38 ` William Breathitt Gray
0 siblings, 0 replies; 4+ messages in thread
From: William Breathitt Gray @ 2021-10-14 6:38 UTC (permalink / raw)
To: Qing Wang
Cc: Fabrice Gasnier, Maxime Coquelin, Alexandre Torgue, linux-iio,
linux-stm32, linux-arm-kernel, linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 2088 bytes --]
On Tue, Oct 12, 2021 at 08:26:59PM -0700, Qing Wang wrote:
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the following coccicheck warning:
> drivers/counter/stm32-lptimer-cnt.c:265:8-16: WARNING: use scnprintf or sprintf.
> drivers/counter/stm32-lptimer-cnt.c:176:8-16: WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
Hello Qing Wang,
Thank you for your submission. I believe these warnings are already
resolved by commit d70e46af7531 ("counter: Internalize sysfs interface
code") in the linux-next tree. Would you verify whether that is the case
or if we still need to fix this?
Sincerely,
William Breathitt Gray
> ---
> drivers/counter/stm32-lptimer-cnt.c | 2 +-
> drivers/counter/stm32-timer-cnt.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/counter/stm32-lptimer-cnt.c b/drivers/counter/stm32-lptimer-cnt.c
> index c19d998..6f1113a 100644
> --- a/drivers/counter/stm32-lptimer-cnt.c
> +++ b/drivers/counter/stm32-lptimer-cnt.c
> @@ -262,7 +262,7 @@ static ssize_t stm32_lptim_cnt_ceiling_read(struct counter_device *counter,
> {
> struct stm32_lptim_cnt *const priv = counter->priv;
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", priv->ceiling);
> + return sysfs_emit(buf, "%u\n", priv->ceiling);
> }
>
> static ssize_t stm32_lptim_cnt_ceiling_write(struct counter_device *counter,
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 603b30a..e772586 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -173,7 +173,7 @@ static ssize_t stm32_count_ceiling_read(struct counter_device *counter,
>
> regmap_read(priv->regmap, TIM_ARR, &arr);
>
> - return snprintf(buf, PAGE_SIZE, "%u\n", arr);
> + return sysfs_emit(buf, "%u\n", arr);
> }
>
> static ssize_t stm32_count_ceiling_write(struct counter_device *counter,
> --
> 2.7.4
>
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-10-14 6:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-13 3:26 [PATCH] counter: replace snprintf in show functions with sysfs_emit Qing Wang
2021-10-13 3:26 ` Qing Wang
2021-10-14 6:38 ` William Breathitt Gray
2021-10-14 6:38 ` William Breathitt Gray
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.