[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240319111656.23303-E-hca@linux.ibm.com>
Date: Tue, 19 Mar 2024 12:16:56 +0100
From: Heiko Carstens <hca@...ux.ibm.com>
To: Li Zhijian <lizhijian@...itsu.com>
Cc: linux-kernel@...r.kernel.org, Vineeth Vijayan <vneethv@...ux.ibm.com>,
Peter Oberparleiter <oberpar@...ux.ibm.com>,
Vasily Gorbik <gor@...ux.ibm.com>,
Alexander Gordeev <agordeev@...ux.ibm.com>,
Christian Borntraeger <borntraeger@...ux.ibm.com>,
Sven Schnelle <svens@...ux.ibm.com>, linux-s390@...r.kernel.org
Subject: Re: [PATCH] s390/cio: Convert sprintf/snprintf to sysfs_emit
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@...ux.ibm.com>
> CC: Peter Oberparleiter <oberpar@...ux.ibm.com>
> CC: Heiko Carstens <hca@...ux.ibm.com>
> CC: Vasily Gorbik <gor@...ux.ibm.com>
> CC: Alexander Gordeev <agordeev@...ux.ibm.com>
> CC: Christian Borntraeger <borntraeger@...ux.ibm.com>
> CC: Sven Schnelle <svens@...ux.ibm.com>
> CC: linux-s390@...r.kernel.org
> Signed-off-by: Li Zhijian <lizhijian@...itsu.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!
Powered by blists - more mailing lists