drivers/scsi/eata.c : Use of the time_before() macro
Subsystems (2)
PATCH 1/1 drivers/scsi/eata.c : Use of the time_before() macro
Use of the time_before() macro, defined at linux/jiffies.h, which deal with wrapping correctly and are nicer to read.
drivers/scsi/eata.c +3 -2
@@ -1939,7 +1939,8 @@static int eata2x_eh_host_reset (struct scsi_cmnd *SCarg) { -unsigned int i, time, k, c, limit =0 ; +unsigned int i, k, c, limit =0 ; +unsigned long time;int arg_done =0 ;struct scsi_cmnd *SCpnt;struct Scsi_Host *shost = SCarg->device->host;
@@ -2033,7 +2034,7 @@/* FIXME: use a sleep instead */ time = jiffies; -while ((jiffies - time) < (10 *HZ ) && limit++ <200000 ) +while (time_before (jiffies, time + (10 *HZ )) && limit++ <200000 )udelay (100L );spin_lock_irq (shost->host_lock);
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors
Quoted 20 lines · Marcelo Feitoza Parisi
Use of the
time_before()macro, defined atlinux/jiffies.h, which deal with wrapping correctly and are nicer to read.Signed-off-by Marcelo Feitoza Parisi <[email protected]>drivers/scsi/eata.c +2
-1@@ -1939,7 +1939,8 @@static int eata2x_eh_host_reset (struct scsi_cmnd *SCarg) { -unsigned int i, time, k, c, limit =0 ; +unsigned int i, k, c, limit =0 ; +unsigned long time;int arg_done =0 ;struct scsi_cmnd *SCpnt;struct Scsi_Host *shost = SCarg->device->host;
drivers/scsi/eata.c line 2038
Quoted 6 lines
drivers/scsi/eata.c +1
-1@@ -2033,7 +2034,7 @@/* FIXME: use a sleep instead */ time = jiffies; -while ((jiffies - time) < (10 *HZ ) && limit++ <200000 ) +while (time_before (jiffies, time + (10 *HZ )) && limit++ <200000 )udelay (100L );
ssleep(10); like the comment suggests?
Is there a higher meaning for limit? First we check we're under 10 seconds (real time) and then check we haven't slept more than 20 seconds, just to make sure? Interrupts can't be disabled, spin_unlock_irq() takes care of that.
Am I confuzed or the author of code? ;-)
[Marcelo:
drivers/net/hamradio/dmascc.c and drivers/net/e1000/e1000_ethtool.c also assume some value for HZ.
And could you make bigger patches (per subsystem, like hamradio, tokenring...) in the future, please? ]
Domen
_______________________________________________
Kernel-janitors mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/kernel-janitors