Module Name:    src
Committed By:   pgoyette
Date:           Tue Feb 20 01:53:39 UTC 2018

Modified Files:
        src/sys/dev/isa: wbsio.c

Log Message:
Handle watchdog attachment in the wbsio_rescan() function, where we
take care of other children.

ok knakahara@ and yamaguchi@


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/isa/wbsio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/isa/wbsio.c
diff -u src/sys/dev/isa/wbsio.c:1.21 src/sys/dev/isa/wbsio.c:1.22
--- src/sys/dev/isa/wbsio.c:1.21	Tue Jan  2 00:47:14 2018
+++ src/sys/dev/isa/wbsio.c	Tue Feb 20 01:53:39 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: wbsio.c,v 1.21 2018/01/02 00:47:14 pgoyette Exp $	*/
+/*	$NetBSD: wbsio.c,v 1.22 2018/02/20 01:53:39 pgoyette Exp $	*/
 /*	$OpenBSD: wbsio.c,v 1.10 2015/03/14 03:38:47 jsg Exp $	*/
 /*
  * Copyright (c) 2008 Mark Kettenis <kette...@openbsd.org>
@@ -284,8 +284,7 @@ wbsio_attach(device_t parent, device_t s
 	if (!pmf_device_register(self, wbsio_suspend, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 
-	wbsio_wdog_attach(self);
-
+	sc->sc_smw_valid = false;
 	wbsio_rescan(self, "wbsio", NULL);
 
 #if NGPIO > 0
@@ -336,6 +335,8 @@ wbsio_rescan(device_t self, const char *
 #endif
 	config_search_loc(wbsio_search, self, ifattr, locators, NULL);
 
+	wbsio_wdog_attach(self);
+
 	return 0;
 }
 
@@ -799,7 +800,8 @@ wbsio_wdog_attach(device_t self)
 	uint16_t devid;
 	uint8_t rev;
 
-	sc->sc_smw_valid = false;
+	if (sc->sc_smw_valid)
+		return;		/* watchdog already attached */
 
 	wbsio_conf_enable(&sc->sc_conf_lock, sc->sc_iot, sc->sc_ioh);
 	devid = wbsio_conf_read(sc->sc_iot, sc->sc_ioh, WBSIO_ID);

Reply via email to