linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix sector_div use in scsicam.c
@ 2002-10-27 16:02 Christoph Hellwig
  2002-10-27 16:21 ` James Bottomley
  0 siblings, 1 reply; 11+ messages in thread
From: Christoph Hellwig @ 2002-10-27 16:02 UTC (permalink / raw)
  To: James Bottomley, Patrick Mansfield; +Cc: linux-scsi

sector_div has the same slightly strange calling convention do_div has:
it's return value is the modulo of the two operators, the division
result is in the first parameter.  Also optimize one of the expensive
64bit division away (okay, okay - it's not exactly an fast-path :))


--- 1.11/drivers/scsi/scsicam.c	Fri Oct 25 13:31:53 2002
+++ edited/drivers/scsi/scsicam.c	Sun Oct 27 15:18:13 2002
@@ -80,11 +80,12 @@
 	if (ret || ip[0] > 255 || ip[1] > 63) {
 		ip[0] = 64;
 		ip[1] = 32;
-		if (sector_div(capacity, ip[0] * ip[1]) > 65534) {
+		sector_div(capacity, ip[0] * ip[1]);
+		if (capacity > 65534) {
 			ip[0] = 255;
 			ip[1] = 63;
 		}
-		ip[2] = sector_div(capacity, ip[0] * ip[1]);
+		ip[2] = capacity;
 	}
 
 	return 0;

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

end of thread, other threads:[~2002-10-28  1:45 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-10-27 16:02 [PATCH] fix sector_div use in scsicam.c Christoph Hellwig
2002-10-27 16:21 ` James Bottomley
2002-10-27 16:23   ` Christoph Hellwig
2002-10-27 16:34     ` James Bottomley
2002-10-27 16:37       ` Christoph Hellwig
2002-10-27 19:22         ` Andries Brouwer
2002-10-27 20:53           ` James Bottomley
2002-10-27 22:10             ` Andries Brouwer
2002-10-28  0:05               ` James Bottomley
2002-10-28  0:50                 ` Andries Brouwer
2002-10-28  1:45                   ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).