* [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit
@ 2021-10-15 6:45 Qing Wang
2022-01-14 2:44 ` Stephen Boyd
2022-01-25 0:51 ` Stephen Boyd
0 siblings, 2 replies; 4+ messages in thread
From: Qing Wang @ 2021-10-15 6:45 UTC (permalink / raw)
To: Michael Turquette, Stephen Boyd, linux-clk, linux-kernel
Cc: mike.looijmans, Qing Wang
coccicheck complains about the use of snprintf() in sysfs show functions.
Fix the following coccicheck warning:
drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf.
drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf.
drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf.
drivers/clk/clk-si5341.c:1516: 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/clk/clk-si5341.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
index 57ae183..5d62ddb 100644
--- a/drivers/clk/clk-si5341.c
+++ b/drivers/clk/clk-si5341.c
@@ -1468,7 +1468,7 @@ static ssize_t input_present_show(struct device *dev,
if (res < 0)
return res;
res = !(status & SI5341_STATUS_LOSREF);
- return snprintf(buf, PAGE_SIZE, "%d\n", res);
+ return sysfs_emit(buf, "%d\n", res);
}
static DEVICE_ATTR_RO(input_present);
@@ -1483,7 +1483,7 @@ static ssize_t input_present_sticky_show(struct device *dev,
if (res < 0)
return res;
res = !(status & SI5341_STATUS_LOSREF);
- return snprintf(buf, PAGE_SIZE, "%d\n", res);
+ return sysfs_emit(buf, "%d\n", res);
}
static DEVICE_ATTR_RO(input_present_sticky);
@@ -1498,7 +1498,7 @@ static ssize_t pll_locked_show(struct device *dev,
if (res < 0)
return res;
res = !(status & SI5341_STATUS_LOL);
- return snprintf(buf, PAGE_SIZE, "%d\n", res);
+ return sysfs_emit(buf, "%d\n", res);
}
static DEVICE_ATTR_RO(pll_locked);
@@ -1513,7 +1513,7 @@ static ssize_t pll_locked_sticky_show(struct device *dev,
if (res < 0)
return res;
res = !(status & SI5341_STATUS_LOL);
- return snprintf(buf, PAGE_SIZE, "%d\n", res);
+ return sysfs_emit(buf, "%d\n", res);
}
static DEVICE_ATTR_RO(pll_locked_sticky);
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit
2021-10-15 6:45 [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit Qing Wang
@ 2022-01-14 2:44 ` Stephen Boyd
2022-01-14 5:06 ` Robert Hancock
2022-01-25 0:51 ` Stephen Boyd
1 sibling, 1 reply; 4+ messages in thread
From: Stephen Boyd @ 2022-01-14 2:44 UTC (permalink / raw)
To: Michael Turquette, Qing Wang, linux-clk, linux-kernel, Robert Hancock
Cc: mike.looijmans, Qing Wang
+Robert
Quoting Qing Wang (2021-10-14 23:45:28)
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the following coccicheck warning:
> drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1516: 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/clk/clk-si5341.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
> index 57ae183..5d62ddb 100644
> --- a/drivers/clk/clk-si5341.c
> +++ b/drivers/clk/clk-si5341.c
> @@ -1468,7 +1468,7 @@ static ssize_t input_present_show(struct device *dev,
> if (res < 0)
> return res;
> res = !(status & SI5341_STATUS_LOSREF);
> - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> + return sysfs_emit(buf, "%d\n", res);
> }
> static DEVICE_ATTR_RO(input_present);
>
> @@ -1483,7 +1483,7 @@ static ssize_t input_present_sticky_show(struct device *dev,
> if (res < 0)
> return res;
> res = !(status & SI5341_STATUS_LOSREF);
> - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> + return sysfs_emit(buf, "%d\n", res);
> }
> static DEVICE_ATTR_RO(input_present_sticky);
>
> @@ -1498,7 +1498,7 @@ static ssize_t pll_locked_show(struct device *dev,
> if (res < 0)
> return res;
> res = !(status & SI5341_STATUS_LOL);
> - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> + return sysfs_emit(buf, "%d\n", res);
> }
> static DEVICE_ATTR_RO(pll_locked);
>
> @@ -1513,7 +1513,7 @@ static ssize_t pll_locked_sticky_show(struct device *dev,
> if (res < 0)
> return res;
> res = !(status & SI5341_STATUS_LOL);
> - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> + return sysfs_emit(buf, "%d\n", res);
> }
> static DEVICE_ATTR_RO(pll_locked_sticky);
>
> --
> 2.7.4
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit
2022-01-14 2:44 ` Stephen Boyd
@ 2022-01-14 5:06 ` Robert Hancock
0 siblings, 0 replies; 4+ messages in thread
From: Robert Hancock @ 2022-01-14 5:06 UTC (permalink / raw)
To: linux-kernel, sboyd, mturquette, wangqing, linux-clk; +Cc: mike.looijmans
On Thu, 2022-01-13 at 18:44 -0800, Stephen Boyd wrote:
> +Robert
>
> Quoting Qing Wang (2021-10-14 23:45:28)
> > coccicheck complains about the use of snprintf() in sysfs show functions.
> >
> > Fix the following coccicheck warning:
> > drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf.
> > drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf.
> > drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf.
> > drivers/clk/clk-si5341.c:1516: 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/clk/clk-si5341.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/clk/clk-si5341.c b/drivers/clk/clk-si5341.c
> > index 57ae183..5d62ddb 100644
> > --- a/drivers/clk/clk-si5341.c
> > +++ b/drivers/clk/clk-si5341.c
> > @@ -1468,7 +1468,7 @@ static ssize_t input_present_show(struct device *dev,
> > if (res < 0)
> > return res;
> > res = !(status & SI5341_STATUS_LOSREF);
> > - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> > + return sysfs_emit(buf, "%d\n", res);
> > }
> > static DEVICE_ATTR_RO(input_present);
> >
> > @@ -1483,7 +1483,7 @@ static ssize_t input_present_sticky_show(struct
> > device *dev,
> > if (res < 0)
> > return res;
> > res = !(status & SI5341_STATUS_LOSREF);
> > - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> > + return sysfs_emit(buf, "%d\n", res);
> > }
> > static DEVICE_ATTR_RO(input_present_sticky);
> >
> > @@ -1498,7 +1498,7 @@ static ssize_t pll_locked_show(struct device *dev,
> > if (res < 0)
> > return res;
> > res = !(status & SI5341_STATUS_LOL);
> > - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> > + return sysfs_emit(buf, "%d\n", res);
> > }
> > static DEVICE_ATTR_RO(pll_locked);
> >
> > @@ -1513,7 +1513,7 @@ static ssize_t pll_locked_sticky_show(struct device
> > *dev,
> > if (res < 0)
> > return res;
> > res = !(status & SI5341_STATUS_LOL);
> > - return snprintf(buf, PAGE_SIZE, "%d\n", res);
> > + return sysfs_emit(buf, "%d\n", res);
> > }
> > static DEVICE_ATTR_RO(pll_locked_sticky);
Looks good to me.
Reviewed-by: Robert Hancock <robert.hancock@calian.com>
> >
> > --
> > 2.7.4
> >
--
Robert Hancock
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit
2021-10-15 6:45 [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit Qing Wang
2022-01-14 2:44 ` Stephen Boyd
@ 2022-01-25 0:51 ` Stephen Boyd
1 sibling, 0 replies; 4+ messages in thread
From: Stephen Boyd @ 2022-01-25 0:51 UTC (permalink / raw)
To: Michael Turquette, Qing Wang, linux-clk, linux-kernel
Cc: mike.looijmans, Qing Wang
Quoting Qing Wang (2021-10-14 23:45:28)
> coccicheck complains about the use of snprintf() in sysfs show functions.
>
> Fix the following coccicheck warning:
> drivers/clk/clk-si5341.c:1471: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1486: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1501: WARNING: use scnprintf or sprintf.
> drivers/clk/clk-si5341.c:1516: WARNING: use scnprintf or sprintf.
>
> Use sysfs_emit instead of scnprintf or sprintf makes more sense.
>
> Signed-off-by: Qing Wang <wangqing@vivo.com>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-01-25 3:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-15 6:45 [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit Qing Wang
2022-01-14 2:44 ` Stephen Boyd
2022-01-14 5:06 ` Robert Hancock
2022-01-25 0:51 ` Stephen Boyd
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.