* [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks
@ 2022-12-23 17:50 Deepak R Varma
2023-01-07 20:13 ` Deepak R Varma
0 siblings, 1 reply; 2+ messages in thread
From: Deepak R Varma @ 2022-12-23 17:50 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi, linux-kernel
Cc: Saurabh Singh Sengar, Praveen Kumar, drv
According to Documentation/filesystems/sysfs.rst, the show() callback
function of kobject attributes should strictly use sysfs_emit instead
of sprintf family functions.
Issue identified using the coccinelle device_attr_show.cocci script.
Signed-off-by: Deepak R Varma <drv@mailo.com>
---
drivers/scsi/aic94xx/aic94xx_init.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/drivers/scsi/aic94xx/aic94xx_init.c b/drivers/scsi/aic94xx/aic94xx_init.c
index 954d0c5ae2e2..35ac5b91cb1c 100644
--- a/drivers/scsi/aic94xx/aic94xx_init.c
+++ b/drivers/scsi/aic94xx/aic94xx_init.c
@@ -264,8 +264,7 @@ static ssize_t asd_show_dev_rev(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev);
- return snprintf(buf, PAGE_SIZE, "%s\n",
- asd_dev_rev[asd_ha->revision_id]);
+ return sysfs_emit(buf, "%s\n", asd_dev_rev[asd_ha->revision_id]);
}
static DEVICE_ATTR(aic_revision, S_IRUGO, asd_show_dev_rev, NULL);
@@ -273,7 +272,7 @@ static ssize_t asd_show_dev_bios_build(struct device *dev,
struct device_attribute *attr,char *buf)
{
struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev);
- return snprintf(buf, PAGE_SIZE, "%d\n", asd_ha->hw_prof.bios.bld);
+ return sysfs_emit(buf, "%d\n", asd_ha->hw_prof.bios.bld);
}
static DEVICE_ATTR(bios_build, S_IRUGO, asd_show_dev_bios_build, NULL);
@@ -281,7 +280,7 @@ static ssize_t asd_show_dev_pcba_sn(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct asd_ha_struct *asd_ha = dev_to_asd_ha(dev);
- return snprintf(buf, PAGE_SIZE, "%s\n", asd_ha->hw_prof.pcba_sn);
+ return sysfs_emit(buf, "%s\n", asd_ha->hw_prof.pcba_sn);
}
static DEVICE_ATTR(pcba_sn, S_IRUGO, asd_show_dev_pcba_sn, NULL);
@@ -452,7 +451,7 @@ static ssize_t asd_show_update_bios(struct device *dev,
if (asd_ha->bios_status != FLASH_IN_PROGRESS)
asd_ha->bios_status = FLASH_OK;
- return snprintf(buf, PAGE_SIZE, "status=%x %s\n",
+ return sysfs_emit(buf, "status=%x %s\n",
flash_error_table[i].err_code,
flash_error_table[i].reason);
}
--
2.34.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks
2022-12-23 17:50 [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks Deepak R Varma
@ 2023-01-07 20:13 ` Deepak R Varma
0 siblings, 0 replies; 2+ messages in thread
From: Deepak R Varma @ 2023-01-07 20:13 UTC (permalink / raw)
To: James E.J. Bottomley, Martin K. Petersen, linux-scsi, linux-kernel
Cc: Saurabh Singh Sengar, Praveen Kumar, Deepak R Varma
On Fri, Dec 23, 2022 at 11:20:02PM +0530, Deepak R Varma wrote:
> According to Documentation/filesystems/sysfs.rst, the show() callback
> function of kobject attributes should strictly use sysfs_emit instead
> of sprintf family functions.
> Issue identified using the coccinelle device_attr_show.cocci script.
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
Hello,
Requesting a review and feedback on this patch proposal. There are a few other
similar patches for other scsi drivers that also need your comments. Request to
also review those.
Thank you,
./drv
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-01-07 20:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-23 17:50 [PATCH] scsi: aic94xx: Use sysfs_emit in show function callsbacks Deepak R Varma
2023-01-07 20:13 ` Deepak R Varma
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®