Skip to contentSkip to conversation

drivers/scsi: Use DIV_ROUND_UP

PATCH NAK [email protected] 1 participant 1 message Oct 29, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

PATCH 7/17 drivers/scsi: Use DIV_ROUND_UP

From: Julia Lawall <[email protected]>

Use the macro DIV_ROUND_UP and eliminate the variable rounded_up, as suggested by Matthew Wilcox.

---

 drivers/scsi/esp_scsi.c |    6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/scsi/esp_scsi.c renamed from drivers/scsi/esp_scsi.c~drivers-scsi-use-div_round_up +2 -4
diff -puN drivers/scsi/esp_scsi.c~drivers-scsi-use-div_round_up drivers/scsi/esp_scsi.c
@@ -1453,7 +1453,7 @@ static void esp_msgin_sdtr(struct esp *e
 		offset = 0;
 
 	if (offset) {
-		int rounded_up, one_clock;
+		int one_clock;
 
 		if (period > esp->max_period) {
 			period = offset = 0;
@@ -1463,9 +1463,7 @@ static void esp_msgin_sdtr(struct esp *e
 			goto do_reject;
 
 		one_clock = esp->ccycle / 1000;
-		rounded_up = (period << 2);
-		rounded_up = (rounded_up + one_clock - 1) / one_clock;
-		stp = rounded_up;
+		stp = DIV_ROUND_UP(period << 2, one_clock);
 		if (stp && esp->rev >= FAS236) {
 			if (stp >= 50)
 				stp--;

_