mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Robert Hancock <robert.hancock@calian.com>
To: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"sboyd@kernel.org" <sboyd@kernel.org>,
	"mturquette@baylibre.com" <mturquette@baylibre.com>,
	"wangqing@vivo.com" <wangqing@vivo.com>,
	"linux-clk@vger.kernel.org" <linux-clk@vger.kernel.org>
Cc: "mike.looijmans@topic.nl" <mike.looijmans@topic.nl>
Subject: Re: [PATCH RESEND] clk-si5341: replace snprintf in show functions with sysfs_emit
Date: Fri, 14 Jan 2022 05:06:07 +0000	[thread overview]
Message-ID: <293f7b407680eca0d2c1e14779bc24842537cdcc.camel@calian.com> (raw)
In-Reply-To: <20220114024453.D9F28C36AE3@smtp.kernel.org>

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

  reply	other threads:[~2022-01-14  5:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-15  6:45 Qing Wang
2022-01-14  2:44 ` Stephen Boyd
2022-01-14  5:06   ` Robert Hancock [this message]
2022-01-25  0:51 ` Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=293f7b407680eca0d2c1e14779bc24842537cdcc.camel@calian.com \
    --to=robert.hancock@calian.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.looijmans@topic.nl \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=wangqing@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®