Skip to content

Commit

Permalink
scsi: isci: Convert snprintf() to sysfs_emit()
Browse files Browse the repository at this point in the history
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().

> ./drivers/scsi/isci/init.c:140:8-16: WARNING: please use sysfs_emit

No functional change intended

CC: Artur Paszkiewicz <[email protected]>
CC: James E.J. Bottomley <[email protected]>
CC: Martin K. Petersen <[email protected]>
CC: [email protected]
Signed-off-by: Li Zhijian <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Artur Paszkiewicz <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
zhijianli88 authored and martinkpetersen committed Jan 30, 2024
1 parent 01105c2 commit 5fbf37e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/scsi/isci/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, c
struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost);
struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha);

return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id);
return sysfs_emit(buf, "%d\n", ihost->id);
}

static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
Expand Down

0 comments on commit 5fbf37e

Please sign in to comment.