Subject: the twa driver
To: None <tech-kern@netbsd.org>
From: Lord Isildur <mrfusion@vaxpower.org>
List: tech-kern
Date: 07/07/2006 16:44:34
hello,
I just tried to build -current (as of yesterday midday) with the latest
version of the twa driver I got from cvs.
It wouldnt compile, complaining about some struct timevals in two functions, 
both named time. Looking at the code, they seem to be leftovers
from a cleanup in progress, and many other functions in twa.c use a
timeval named t1 to take the current time and compute timeouts from it.
This looks like the use of the one referred to as 'time' in twaioctl() and
twa_enqueue_aen() as well. The diff below will give a version that compiled 
without complaint and seems to be working so far with a 3w 9550. i've been 
hammering the disk to see if it fails, but it looks like it's
behaving properly (and with expected performance), so i assume that this
is what those timevals were intended to do. If someone more familiar with
the twa driver wants to look it over and check in this fix, that would be
cool.

isildur

--- twa.c	2006-07-07 10:43:03.000000000 -0400
+++ orig-twa.c	2006-07-06 16:48:20.000000000 -0400
@@ -2049,13 +2049,11 @@
  	struct twa_ioctl_9k	*user_buf = (struct twa_ioctl_9k *)data;
  	struct tw_cl_event_packet event_buf;
  	struct twa_request 	*tr = 0;
-	struct timeval time;
  	int32_t			event_index = 0;
  	int32_t			start_index;
  	int			s, error = 0;

  	sc = device_lookup(&twa_cd, minor(dev));
-	microtime(&time);

  	switch (cmd) {
  	case TW_OSL_IOCTL_FIRMWARE_PASS_THROUGH:
@@ -2844,12 +2842,9 @@
  	struct tw_cl_event_packet *event;
  	uint16_t		aen_code;
  	unsigned long		sync_time;
-	struct timeval	time;
-

  	s = splbio();
  	aen_code = cmd_hdr->status_block.error;
-	microtime(&time);

  	switch (aen_code) {
  	case TWA_AEN_SYNC_TIME_WITH_HOST: