netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Bo Liu <liubo03@inspur.com>
Cc: johannes@sipsolutions.net, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	linux-wireless@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rfkill: Use sysfs_emit() to instead of sprintf()
Date: Fri, 3 Feb 2023 20:07:31 +0100	[thread overview]
Message-ID: <Y91bc2LWMl+DsjcW@corigine.com> (raw)
In-Reply-To: <20230201081718.3289-1-liubo03@inspur.com>

Hi Bo Liu,

On Wed, Feb 01, 2023 at 03:17:18AM -0500, Bo Liu wrote:
> Follow the advice of the Documentation/filesystems/sysfs.rst and show()
> should only use sysfs_emit() or sysfs_emit_at() when formatting the
> value to be returned to user space.

Thanks for your patch. As it is not a bug fix it should be targeted at
'net-next' (as opposed to 'net'). This should be specified in the patch
subject something like this:

[PATCH net-next v2] rfkill: Use sysfs_emit() to instead of sprintf()

> Signed-off-by: Bo Liu <liubo03@inspur.com>
> ---
>  net/rfkill/core.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/net/rfkill/core.c b/net/rfkill/core.c
> index b390ff245d5e..a103b2da4ed2 100644
> --- a/net/rfkill/core.c
> +++ b/net/rfkill/core.c

...

> @@ -721,7 +721,7 @@ static ssize_t hard_show(struct device *dev, struct device_attribute *attr,
>  {
>  	struct rfkill *rfkill = to_rfkill(dev);
>  
> -	return sprintf(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 );
> +	return sysfs_emit(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0 );
	return sysfs_emit(buf, "%d\n", (rfkill->state & RFKILL_BLOCK_HW) ? 1 : 0);

./scripts/checkpatch.pl complains that there should not be a space before
the last ')'.

  reply	other threads:[~2023-02-03 19:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01  8:17 [PATCH] rfkill: Use sysfs_emit() to instead of sprintf() Bo Liu
2023-02-03 19:07 ` Simon Horman [this message]
2023-02-07 15:09   ` Kalle Valo
2023-02-07 16:07     ` Simon Horman

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=Y91bc2LWMl+DsjcW@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=liubo03@inspur.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).