Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb Use pmf(9).



details:   https://anonhg.NetBSD.org/src/rev/8a542a1fb5af
branches:  trunk
changeset: 451774:8a542a1fb5af
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Mon Jun 03 09:56:08 2019 +0000

description:
Use pmf(9).

diffstat:

 sys/dev/usb/if_athn_usb.c |  9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 92ca1efa31f7 -r 8a542a1fb5af sys/dev/usb/if_athn_usb.c
--- a/sys/dev/usb/if_athn_usb.c Mon Jun 03 09:51:04 2019 +0000
+++ b/sys/dev/usb/if_athn_usb.c Mon Jun 03 09:56:08 2019 +0000
@@ -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 @@
        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 @@
 
        DPRINTFN(DBG_FN, usc, "\n");
 
+       pmf_device_deregister(self);
+
        mutex_enter(&usc->usc_lock);
        usc->usc_dying = 1;
        mutex_exit(&usc->usc_lock);



Home | Main Index | Thread Index | Old Index