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/acb3bcec87be
branches:  trunk
changeset: 449444:acb3bcec87be
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Thu Mar 07 14:00:25 2019 +0000

description:
Use pmf(9).

diffstat:

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

diffs (37 lines):

diff -r 8718eaabf198 -r acb3bcec87be sys/dev/usb/if_ure.c
--- a/sys/dev/usb/if_ure.c      Thu Mar 07 13:26:24 2019 +0000
+++ b/sys/dev/usb/if_ure.c      Thu Mar 07 14:00:25 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ure.c,v 1.3 2019/02/09 07:50:47 rin Exp $   */
+/*     $NetBSD: if_ure.c,v 1.4 2019/03/07 14:00:25 msaitoh Exp $       */
 /*     $OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $ */
 /*-
  * Copyright (c) 2015-2016 Kevin Lo <kevlo%FreeBSD.org@localhost>
@@ -29,7 +29,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.3 2019/02/09 07:50:47 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.4 2019/03/07 14:00:25 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1235,6 +1235,9 @@
        splx(s);
 
        usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->ure_udev, sc->ure_dev);
+
+       if (!pmf_device_register(self, NULL, NULL))
+               aprint_error_dev(self, "couldn't establish power handler\n");
 }
 
 static int
@@ -1244,6 +1247,8 @@
        struct ifnet *ifp = GET_IFP(sc);
        int s;
 
+       pmf_device_deregister(self);
+
        sc->ure_dying = true;
 
        callout_halt(&sc->ure_stat_ch, NULL);



Home | Main Index | Thread Index | Old Index