LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH linux-next] fsi:(fsi-master-gpio)Convert sysfs sprintf/snprintf family to sysfs_emit
@ 2021-08-21 3:42 CGEL
2021-08-23 1:12 ` Jeremy Kerr
0 siblings, 1 reply; 2+ messages in thread
From: CGEL @ 2021-08-21 3:42 UTC (permalink / raw)
To: Jeremy Kerr
Cc: Joel Stanley, Alistar Popple, Eddie James, linux-fsi,
linux-kernel, jing yangyang, Zeal Robot
From: jing yangyang <jing.yangyang@zte.com.cn>
Fix the following coccicheck warning:
./drivers/fsi/fsi-master-gpio.c:721:8-16:WARNING:use scnprintf or sprintf
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: jing yangyang <jing.yangyang@zte.com.cn>
---
drivers/fsi/fsi-master-gpio.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/fsi/fsi-master-gpio.c b/drivers/fsi/fsi-master-gpio.c
index 7d5f29b..865acb3 100644
--- a/drivers/fsi/fsi-master-gpio.c
+++ b/drivers/fsi/fsi-master-gpio.c
@@ -718,8 +718,7 @@ static ssize_t external_mode_show(struct device *dev,
{
struct fsi_master_gpio *master = dev_get_drvdata(dev);
- return snprintf(buf, PAGE_SIZE - 1, "%u\n",
- master->external_mode ? 1 : 0);
+ return sysfs_emit(buf, "%u\n", master->external_mode ? 1 : 0);
}
static ssize_t external_mode_store(struct device *dev,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH linux-next] fsi:(fsi-master-gpio)Convert sysfs sprintf/snprintf family to sysfs_emit
2021-08-21 3:42 [PATCH linux-next] fsi:(fsi-master-gpio)Convert sysfs sprintf/snprintf family to sysfs_emit CGEL
@ 2021-08-23 1:12 ` Jeremy Kerr
0 siblings, 0 replies; 2+ messages in thread
From: Jeremy Kerr @ 2021-08-23 1:12 UTC (permalink / raw)
To: CGEL
Cc: Joel Stanley, Alistar Popple, Eddie James, linux-fsi,
linux-kernel, jing yangyang, Zeal Robot
Hi,
> Fix the following coccicheck warning:
> ./drivers/fsi/fsi-master-gpio.c:721:8-16:WARNING:use scnprintf or
> sprintf
Looks good, but we may as well do the other cases (in fsi-core) at the
same time.
There's a cocci script in the initial sysfs_emit series:
https://lore.kernel.org/lkml/c22b7006813b1776467a72e716a5970e9277b4b7.camel@perches.com/
Which gives me these additional changes:
diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
index 59ddc9fd5bca..159db87a043d 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -818,7 +818,7 @@ static ssize_t slave_send_echo_show(struct device *dev,
{
struct fsi_slave *slave = to_fsi_slave(dev);
- return sprintf(buf, "%u\n", slave->t_send_delay);
+ return sysfs_emit(buf, "%u\n", slave->t_send_delay);
}
static ssize_t slave_send_echo_store(struct device *dev,
@@ -862,7 +862,7 @@ static ssize_t chip_id_show(struct device *dev,
{
struct fsi_slave *slave = to_fsi_slave(dev);
- return sprintf(buf, "%d\n", slave->chip_id);
+ return sysfs_emit(buf, "%d\n", slave->chip_id);
}
static DEVICE_ATTR_RO(chip_id);
@@ -873,7 +873,7 @@ static ssize_t cfam_id_show(struct device *dev,
{
struct fsi_slave *slave = to_fsi_slave(dev);
- return sprintf(buf, "0x%x\n", slave->cfam_id);
+ return sysfs_emit(buf, "0x%x\n", slave->cfam_id);
}
static DEVICE_ATTR_RO(cfam_id);
Do you want to include these in your patch too?
Cheers,
Jeremy
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-23 1:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-21 3:42 [PATCH linux-next] fsi:(fsi-master-gpio)Convert sysfs sprintf/snprintf family to sysfs_emit CGEL
2021-08-23 1:12 ` Jeremy Kerr
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).