wd: use timeout_add_msec(9)

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

wd: use timeout_add_msec(9)

Klemens Nanni-2
In case of errors, wd(4) generally retries transfers after
hz / 2 [ticks] = 500 [ms].

Builds and boots, but (sadly) my PowerBook G4's disk is working fine so
this code has not been triggered.

OK?

Index: dev/ata/wd.c
===================================================================
RCS file: /cvs/src/sys/dev/ata/wd.c,v
retrieving revision 1.125
diff -u -p -r1.125 wd.c
--- dev/ata/wd.c 30 Dec 2017 23:08:29 -0000 1.125
+++ dev/ata/wd.c 6 Jul 2019 21:42:39 -0000
@@ -94,7 +94,7 @@
 
 #define WDIORETRIES_SINGLE 4 /* number of retries before single-sector */
 #define WDIORETRIES 5 /* number of retries before giving up */
-#define RECOVERYTIME hz/2 /* time to wait before retrying a cmd */
+#define RECOVERYTIME_MSEC 500 /* time to wait before retrying a cmd */
 
 #define DEBUG_INTR   0x01
 #define DEBUG_XFERS  0x02
@@ -555,7 +555,8 @@ retry:
     wd->sc_wdc_bio.blkdone, wd->sc_dk.dk_label);
  if (wd->retries++ < WDIORETRIES) {
  printf(", retrying\n");
- timeout_add(&wd->sc_restart_timeout, RECOVERYTIME);
+ timeout_add_msec(&wd->sc_restart_timeout,
+    RECOVERYTIME_MSEC);
  return;
  }
  printf("\n");