[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220428154138.257250-1-zhangxuezhi1@coolpad.com>
Date: Thu, 28 Apr 2022 15:41:37 +0000
From: Xuezhi Zhang <zhangxuezhi1@...lpad.com>
To: jejb@...ux.ibm.com, martin.petersen@...cle.com
Cc: linux-scsi@...r.kernel.org, linux-kernel@...r.kernel.org,
Xuezhi Zhang <zhangxuezhi1@...lpad.com>
Subject: [PATCH v2] scsi: pmcraid: convert sysfs snprintf to sysfs_emit
Fix the following coccicheck warnings:
drivers/scsi/pmcraid.c:3591:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/pmcraid.c:3557:8-16:
WARNING: use scnprintf or sprintf
drivers/scsi/pmcraid.c:3496:8-16:
WARNING: use scnprintf or sprintf
Signed-off-by: Xuezhi Zhang <zhangxuezhi1@...lpad.com>
---
v2: fix the sysfs_emt error.
---
arch/arm64/configs/defconfig | 4 ++++
drivers/scsi/pmcraid.c | 8 +++-----
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/arch/arm64/configs/defconfig b/arch/arm64/configs/defconfig
index 476c5a9488d0..8688ed761cfd 100644
--- a/arch/arm64/configs/defconfig
+++ b/arch/arm64/configs/defconfig
@@ -1295,3 +1295,7 @@ CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_PREEMPT is not set
# CONFIG_FTRACE is not set
CONFIG_MEMTEST=y
+CONFIG_UEVENT_HELPER=y
+CONFIG_UEVENT_HELPER_PATH="/sbin/mdev"
+CONFIG_INITRAMFS_SOURCE="_install_arm64"
+
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c
index 3d5cd337a2a6..57a6fe8aaf70 100644
--- a/drivers/scsi/pmcraid.c
+++ b/drivers/scsi/pmcraid.c
@@ -3493,7 +3493,7 @@ static ssize_t pmcraid_show_log_level(
struct Scsi_Host *shost = class_to_shost(dev);
struct pmcraid_instance *pinstance =
(struct pmcraid_instance *)shost->hostdata;
- return snprintf(buf, PAGE_SIZE, "%d\n", pinstance->current_log_level);
+ return sysfs_emit(buf, "%d\n", pinstance->current_log_level);
}
/**
@@ -3554,8 +3554,7 @@ static ssize_t pmcraid_show_drv_version(
char *buf
)
{
- return snprintf(buf, PAGE_SIZE, "version: %s\n",
- PMCRAID_DRIVER_VERSION);
+ return sysfs_emit(buf, "version: %s\n", PMCRAID_DRIVER_VERSION);
}
static struct device_attribute pmcraid_driver_version_attr = {
@@ -3588,8 +3587,7 @@ static ssize_t pmcraid_show_adapter_id(
pinstance->pdev->devfn;
u32 aen_group = pmcraid_event_family.id;
- return snprintf(buf, PAGE_SIZE,
- "adapter id: %d\nminor: %d\naen group: %d\n",
+ return sysfs_emit(buf, "adapter id: %d\nminor: %d\naen group: %d\n",
adapter_id, MINOR(pinstance->cdev.dev), aen_group);
}
--
2.25.1
Powered by blists - more mailing lists