public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix sdev_rw_attr macro for scsi device sysfs entries
@ 2010-04-14  6:15 Tomohiro Kusumi
  2010-04-14  7:50 ` Amerigo Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Tomohiro Kusumi @ 2010-04-14  6:15 UTC (permalink / raw)
  To: linux-scsi@vger.kernel.org, linux-kernel

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



Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>
---

diff -aNur linux-2.6.34-rc4.org/drivers/scsi/scsi_sysfs.c linux-2.6.34-rc4/drivers/scsi/scsi_sysfs.c
--- linux-2.6.34-rc4.org/drivers/scsi/scsi_sysfs.c	2010-04-13 10:41:35.000000000 +0900
+++ linux-2.6.34-rc4/drivers/scsi/scsi_sysfs.c	2010-04-14 15:05:50.000000000 +0900
@@ -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);



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] fix sdev_rw_attr macro for scsi device sysfs entries
  2010-04-14  6:15 [PATCH] fix sdev_rw_attr macro for scsi device sysfs entries Tomohiro Kusumi
@ 2010-04-14  7:50 ` Amerigo Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Amerigo Wang @ 2010-04-14  7:50 UTC (permalink / raw)
  To: Tomohiro Kusumi; +Cc: linux-scsi@vger.kernel.org, linux-kernel

On Wed, Apr 14, 2010 at 03:15:14PM +0900, Tomohiro Kusumi wrote:
>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!


>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.


># grep snscanf . -rn
>./drivers/scsi/scsi_sysfs.c:489:        snscanf (buf, 20, format_string, &sdev->field);                 \
>
>Thanks,
>Tomohiro Kusumi
>
>
>
>Signed-off-by: Tomohiro Kusumi <kusumi.tomohiro@jp.fujitsu.com>

Acked-by: WANG Cong <xiyou.wangcong@gmail.com>

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-14  7:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-14  6:15 [PATCH] fix sdev_rw_attr macro for scsi device sysfs entries Tomohiro Kusumi
2010-04-14  7:50 ` Amerigo Wang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox