All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] scsi-sysfs bug fix
@ 2003-03-19 23:56 Douglas Gilbert
  0 siblings, 0 replies; 2+ messages in thread
From: Douglas Gilbert @ 2003-03-19 23:56 UTC (permalink / raw)
  To: Linux Kernel Mailing List, rml

Robert Love wrote:
 > drivers/scsi/scsi_sysfs.c :: store_rescan_field() calls
 > scsi_rescan_device() without a prototype, and thus results
 > in a compiler warning.
 >
 > Fix that up by adding the prototype to scsi.h, where it belongs.

 > But then we see we are storing the return value of a void function
 > (so that is why ANSI C is good)... so fix that up, too, by setting
 > the return value to zero if a valid device was found.  Otherwise,
 > return ENODEV as before.
 >
 > Patch is against 2.5.65.

Christoph Hellwig sent a patch for this to the linux-scsi
list. Both patches have the same minor problem. Sysfs
store() callbacks are supposed to return the count of
bytes consumed. It's a moot point in this case since there
is no sscanf() processing. To use this code I can get
to the appropriate sysfs directory and write:
   # echo "anything_I_like" > rescan

So are all bytes in that string consumed? If so the "ret = 0;"
line in your patch should be "ret = count;".

Doug Gilbert


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

* [patch] scsi-sysfs bug fix
@ 2003-03-19 20:51 Robert Love
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Love @ 2003-03-19 20:51 UTC (permalink / raw)
  To: hch, axboe, mochel; +Cc: linux-kernel

[ Apologies for sending this to all the usual suspects here ... ]

drivers/scsi/scsi_sysfs.c :: store_rescan_field() calls
scsi_rescan_device() without a prototype, and thus results in a compiler
warning.

Fix that up by adding the prototype to scsi.h, where it belongs.

But then we see we are storing the return value of a void function (so
that is why ANSI C is good)... so fix that up, too, by setting the
return value to zero if a valid device was found.  Otherwise, return
ENODEV as before.

Patch is against 2.5.65.

	Robert Love


 drivers/scsi/scsi.h       |    1 +
 drivers/scsi/scsi_sysfs.c |    6 ++++--
 2 files changed, 5 insertions(+), 2 deletions(-)


diff -urN linux-2.5.65/drivers/scsi/scsi.h linux/drivers/scsi/scsi.h
--- linux-2.5.65/drivers/scsi/scsi.h	2003-03-19 15:44:06.279618904 -0500
+++ linux/drivers/scsi/scsi.h	2003-03-19 15:39:47.355981280 -0500
@@ -443,6 +443,7 @@
 extern int scsi_attach_device(struct scsi_device *);
 extern void scsi_detach_device(struct scsi_device *);
 extern int scsi_get_device_flags(unsigned char *vendor, unsigned char *model);
+extern void scsi_rescan_device(struct scsi_device *sdev);
 
 /*
  * Newer request-based interfaces.
diff -urN linux-2.5.65/drivers/scsi/scsi_sysfs.c linux/drivers/scsi/scsi_sysfs.c
--- linux-2.5.65/drivers/scsi/scsi_sysfs.c	2003-03-19 15:44:06.196631520 -0500
+++ linux/drivers/scsi/scsi_sysfs.c	2003-03-19 15:42:45.249937288 -0500
@@ -278,8 +278,10 @@
 	int ret = ENODEV;
 	struct scsi_device *sdev;
 	sdev = to_scsi_device(dev);
-	if (sdev)
-		ret = scsi_rescan_device(sdev);
+	if (sdev) {
+		ret = 0;
+		scsi_rescan_device(sdev);
+	}
 	return ret;
 }
 




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

end of thread, other threads:[~2003-03-19 23:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-19 23:56 [patch] scsi-sysfs bug fix Douglas Gilbert
  -- strict thread matches above, loose matches on Subject: below --
2003-03-19 20:51 Robert Love

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.