Skip to contentSkip to conversation

drivers/scsi/scsi_sysfs.c: fix sdev_rw_attr macro for scsi device sysfs entries

PATCH New [email protected] 1 participant 1 message Apr 27, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 27/28 drivers/scsi/scsi_sysfs.c: fix sdev_rw_attr macro for scsi device sysfs entries

From: Tomohiro Kusumi <[email protected]>

Fix the sdev_rw_attr() macro for scsi device sysfs entries. It seems there is no such function snscanf in the current linux kernel, so it fails to compile scsi driver when someone try to add a new rw entry. This has been unfixed for a long time probably because current scsi device has no rw entries.

# grep snscanf . -rn
./drivers/scsi/scsi_sysfs.c:489:        snscanf (buf, 20, format_string, &sdev->field);                 \

---

 drivers/scsi/scsi_sysfs.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/scsi_sysfs.c renamed from drivers/scsi/scsi_sysfs.c~drivers-scsi-scsi_sysfsc-fix-sdev_rw_attr-macro-for-scsi-device-sysfs-entries +2 -2
diff -puN drivers/scsi/scsi_sysfs.c~drivers-scsi-scsi_sysfsc-fix-sdev_rw_attr-macro-for-scsi-device-sysfs-entries drivers/scsi/scsi_sysfs.c
@@ -474,7 +474,7 @@ static DEVICE_ATTR(field, S_IRUGO, sdev_
 
 
 /*
- * sdev_rd_attr: create a function and attribute variable for a
+ * sdev_rw_attr: create a function and attribute variable for a
  * read/write field.
  */
 #define sdev_rw_attr(field, format_string)				\
@@ -486,7 +486,7 @@ sdev_store_##field (struct device *dev, 
 {									\
 	struct scsi_device *sdev;					\
 	sdev = to_scsi_device(dev);					\
-	snscanf (buf, 20, format_string, &sdev->field);			\
+	sscanf(buf, format_string, &sdev->field);			\
 	return count;							\
 }									\
 static DEVICE_ATTR(field, S_IRUGO | S_IWUSR, sdev_show_##field, sdev_store_##field);

_