Skip to contentSkip to conversation

fix sdev_rw_attr macro for scsi device sysfs entries

PATCH In review Tomohiro Kusumi 2 participants 2 messages Apr 14, 2010 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix sdev_rw_attr macro for scsi device sysfs entries

Hi

This patch fixes 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);                 \

Thanks,
Tomohiro Kusumi

---

drivers/scsi/scsi_sysfs.c +2 -2
diff -aNur linux-2.6.34-rc4.org/drivers/scsi/scsi_sysfs.c linux-2.6.34-rc4/drivers/scsi/scsi_sysfs.c
@@ -474,7 +474,7 @@
 
 
 /*
- * 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 @@
 {									\
 	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);
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Tomohiro Kusumi

Hi

This patch fixes sdev_rw_attr() macro for scsi device sysfs entries. It seems there is no such function snscanf in the current linux kernel,

Yes! Good catch!

Quoted 4 lines

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.

Really? I compiled it in my configuration, but i don't see any compile error. Hmm, i think we are lucky, no one is using the macro sdev_rw_attr() currently.

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

Thanks,
Tomohiro Kusumi

Thanks!