I don't have any of these devices so I appreciate if people can test
this diff.  It's basically the same pattern that has been copy/past'd
in every driver.  The rule is simple: if you uhidev_open() you need to
uhidev_close() at some point.
 
Ok?

Index: ucycom.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/ucycom.c,v
retrieving revision 1.26
diff -u -p -r1.26 ucycom.c
--- ucycom.c    15 Apr 2014 09:14:27 -0000      1.26
+++ ucycom.c    6 May 2014 12:57:47 -0000
@@ -582,6 +582,10 @@ ucycom_detach(struct device *self, int f
                config_detach(sc->sc_subdev, flags);
                sc->sc_subdev = NULL;
        }
+
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        return (0);
 }
 
Index: uoaklux.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/uoaklux.c,v
retrieving revision 1.7
diff -u -p -r1.7 uoaklux.c
--- uoaklux.c   19 Mar 2014 08:59:37 -0000      1.7
+++ uoaklux.c   6 May 2014 12:57:47 -0000
@@ -208,6 +208,9 @@ uoaklux_detach(struct device *self, int 
        if (sc->sc_sensortask != NULL)
                sensor_task_unregister(sc->sc_sensortask);
 
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        if (scc->sc_ibuf != NULL) {
                free(scc->sc_ibuf, M_USBDEV);
                scc->sc_ibuf = NULL;
Index: uoakrh.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/uoakrh.c,v
retrieving revision 1.8
diff -u -p -r1.8 uoakrh.c
--- uoakrh.c    19 Mar 2014 08:59:37 -0000      1.8
+++ uoakrh.c    6 May 2014 12:57:47 -0000
@@ -224,6 +224,9 @@ uoakrh_detach(struct device *self, int f
        if (sc->sc_sensortask != NULL)
                sensor_task_unregister(sc->sc_sensortask);
 
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        if (scc->sc_ibuf != NULL) {
                free(scc->sc_ibuf, M_USBDEV);
                scc->sc_ibuf = NULL;
Index: uoakv.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/uoakv.c,v
retrieving revision 1.7
diff -u -p -r1.7 uoakv.c
--- uoakv.c     19 Mar 2014 08:59:37 -0000      1.7
+++ uoakv.c     6 May 2014 12:57:47 -0000
@@ -212,6 +212,9 @@ uoakv_detach(struct device *self, int fl
        if (sc->sc_sensortask != NULL)
                sensor_task_unregister(sc->sc_sensortask);
 
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        if (scc->sc_ibuf != NULL) {
                free(scc->sc_ibuf, M_USBDEV);
                scc->sc_ibuf = NULL;
Index: utrh.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/utrh.c,v
retrieving revision 1.14
diff -u -p -r1.14 utrh.c
--- utrh.c      15 Apr 2014 09:14:27 -0000      1.14
+++ utrh.c      6 May 2014 12:57:47 -0000
@@ -175,6 +175,9 @@ utrh_detach(struct device *self, int fla
                        sensor_task_unregister(sc->sc_sensortask);
        }
 
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        if (sc->sc_ibuf != NULL) {
                free(sc->sc_ibuf, M_USBDEV);
                sc->sc_ibuf = NULL;
Index: utwitch.c
===================================================================
RCS file: /home/ncvs/src/sys/dev/usb/utwitch.c,v
retrieving revision 1.11
diff -u -p -r1.11 utwitch.c
--- utwitch.c   15 Apr 2014 09:14:27 -0000      1.11
+++ utwitch.c   6 May 2014 12:57:47 -0000
@@ -189,6 +189,9 @@ utwitch_detach(struct device *self, int 
        if (sc->sc_sensortask != NULL)
                sensor_task_unregister(sc->sc_sensortask);
 
+       if (sc->sc_hdev.sc_state & UHIDEV_OPEN)
+               uhidev_close(&sc->sc_hdev);
+
        if (sc->sc_ibuf != NULL) {
                free(sc->sc_ibuf, M_USBDEV);
                sc->sc_ibuf = NULL;

Reply via email to