Linux-S390 Archive mirror
 help / color / mirror / Atom feed
From: Heiko Carstens <hca@linux.ibm.com>
To: Li Zhijian <lizhijian@fujitsu.com>
Cc: linux-kernel@vger.kernel.org,
	Vineeth Vijayan <vneethv@linux.ibm.com>,
	Peter Oberparleiter <oberpar@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	linux-s390@vger.kernel.org
Subject: Re: [PATCH] s390/cio: Convert sprintf/snprintf to sysfs_emit
Date: Tue, 19 Mar 2024 12:16:56 +0100	[thread overview]
Message-ID: <20240319111656.23303-E-hca@linux.ibm.com> (raw)
In-Reply-To: <20240314095209.1325229-1-lizhijian@fujitsu.com>

On Thu, Mar 14, 2024 at 05:52:09PM +0800, Li Zhijian wrote:
> Per filesystems/sysfs.rst, show() should only use sysfs_emit()
> or sysfs_emit_at() when formatting the value to be returned to user space.
> 
> coccinelle complains that there are still a couple of functions that use
> snprintf(). Convert them to sysfs_emit().
> 
> sprintf() will be converted as weel if they have.
> 
> Generally, this patch is generated by
> make coccicheck M=<path/to/file> MODE=patch \
> COCCI=scripts/coccinelle/api/device_attr_show.cocci
> 
> No functional change intended
> 
> CC: Vineeth Vijayan <vneethv@linux.ibm.com>
> CC: Peter Oberparleiter <oberpar@linux.ibm.com>
> CC: Heiko Carstens <hca@linux.ibm.com>
> CC: Vasily Gorbik <gor@linux.ibm.com>
> CC: Alexander Gordeev <agordeev@linux.ibm.com>
> CC: Christian Borntraeger <borntraeger@linux.ibm.com>
> CC: Sven Schnelle <svens@linux.ibm.com>
> CC: linux-s390@vger.kernel.org
> Signed-off-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> This is a part of the work "Fix coccicheck device_attr_show warnings"[1]
> Split them per subsystem so that the maintainer can review it easily
> [1] https://lore.kernel.org/lkml/20240116041129.3937800-1-lizhijian@fujitsu.com/
> ---
>  drivers/s390/cio/css.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)

Applied, but...

> @@ -396,7 +396,7 @@ static ssize_t pimpampom_show(struct device *dev,
>  	struct subchannel *sch = to_subchannel(dev);
>  	struct pmcw *pmcw = &sch->schib.pmcw;
>  
> -	return sprintf(buf, "%02x %02x %02x\n",
> +	return sysfs_emit(buf, "%02x %02x %02x\n",
>  		       pmcw->pim, pmcw->pam, pmcw->pom);

...please make sure to fix such whitespace / indentation errors if you
plan to provide more patches. I fixed it this time.

Thanks!

      reply	other threads:[~2024-03-19 11:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-14  9:52 [PATCH] s390/cio: Convert sprintf/snprintf to sysfs_emit Li Zhijian
2024-03-19 11:16 ` Heiko Carstens [this message]

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=20240319111656.23303-E-hca@linux.ibm.com \
    --to=hca@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=lizhijian@fujitsu.com \
    --cc=oberpar@linux.ibm.com \
    --cc=svens@linux.ibm.com \
    --cc=vneethv@linux.ibm.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 read-only IMAP folder(s) and NNTP newsgroup(s).