Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scsi: csiostor: Convert sysfs snprintf() to sysfs_emit()

Follow the advice of the Documentation/filesystems/sysfs.rst and show()
should only use sysfs_emit() or sysfs_emit_at() when formatting the value
to be returned to user space.

Link: https://lore.kernel.org/r/20220901015130.419307-1-zhangxuezhi3@gmail.com
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Xuezhi Zhang <zhangxuezhi1@coolpad.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>

authored by

Xuezhi Zhang and committed by
Martin K. Petersen
9acb9f0e 68a97feb

+5 -5
+5 -5
drivers/scsi/csiostor/csio_scsi.c
··· 1366 1366 struct csio_hw *hw = csio_lnode_to_hw(ln); 1367 1367 1368 1368 if (csio_is_hw_ready(hw)) 1369 - return snprintf(buf, PAGE_SIZE, "ready\n"); 1370 - else 1371 - return snprintf(buf, PAGE_SIZE, "not ready\n"); 1369 + return sysfs_emit(buf, "ready\n"); 1370 + 1371 + return sysfs_emit(buf, "not ready\n"); 1372 1372 } 1373 1373 1374 1374 /* Device reset */ ··· 1430 1430 { 1431 1431 struct csio_lnode *ln = shost_priv(class_to_shost(dev)); 1432 1432 1433 - return snprintf(buf, PAGE_SIZE, "%x\n", ln->params.log_level); 1433 + return sysfs_emit(buf, "%x\n", ln->params.log_level); 1434 1434 } 1435 1435 1436 1436 /* Store debug level */ ··· 1476 1476 { 1477 1477 struct csio_lnode *ln = shost_priv(class_to_shost(dev)); 1478 1478 1479 - return snprintf(buf, PAGE_SIZE, "%d\n", ln->num_reg_rnodes); 1479 + return sysfs_emit(buf, "%d\n", ln->num_reg_rnodes); 1480 1480 } 1481 1481 1482 1482 static DEVICE_ATTR(num_reg_rnodes, S_IRUGO, csio_show_num_reg_rnodes, NULL);