Module Name:    src
Committed By:   msaitoh
Date:           Mon Jun  3 09:56:08 UTC 2019

Modified Files:
        src/sys/dev/usb: if_athn_usb.c

Log Message:
 Use pmf(9).


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/if_athn_usb.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/usb/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.32 src/sys/dev/usb/if_athn_usb.c:1.33
--- src/sys/dev/usb/if_athn_usb.c:1.32	Sat Apr 27 01:55:05 2019
+++ src/sys/dev/usb/if_athn_usb.c	Mon Jun  3 09:56:08 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.32 2019/04/27 01:55:05 sevan Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.33 2019/06/03 09:56:08 msaitoh Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.32 2019/04/27 01:55:05 sevan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.33 2019/06/03 09:56:08 msaitoh Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -325,6 +325,9 @@ athn_usb_attach(device_t parent, device_
 	config_mountroot(self, athn_usb_attachhook);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, usc->usc_udev, sc->sc_dev);
+	if (!pmf_device_register(self, NULL, NULL))
+		aprint_error_dev(self, "couldn't establish power handler\n");
+
 	return;
 
  fail:
@@ -475,6 +478,8 @@ athn_usb_detach(device_t self, int flags
 
 	DPRINTFN(DBG_FN, usc, "\n");
 
+	pmf_device_deregister(self);
+
 	mutex_enter(&usc->usc_lock);
 	usc->usc_dying = 1;
 	mutex_exit(&usc->usc_lock);

Reply via email to