usb: add missing autoconf activate functions

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jacob Meuser
Date: Saturday, December 18, 2010 - 4:11 pm

this adds activate functions for drivers that don't have them.  also
add usbd_deactivate() in DVACT_DEACTIVATE for drivers that do have
activate functions but don't have any dying flag.

ok?

-- 
jakemsr@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: if_cdcef.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_cdcef.c,v
retrieving revision 1.25
diff -u -p if_cdcef.c
--- if_cdcef.c	29 Jun 2010 07:12:31 -0000	1.25
+++ if_cdcef.c	18 Dec 2010 22:57:04 -0000
@@ -87,6 +87,7 @@ struct cdcef_softc {
 
 int		cdcef_match(struct device *, void *, void *);
 void		cdcef_attach(struct device *, struct device *, void *);
+int		cdcef_activate(struct device *, int);
 
 usbf_status	cdcef_do_request(usbf_function_handle,
 				 usb_device_request_t *, void **);
@@ -106,7 +107,8 @@ struct mbuf *	cdcef_newbuf(void);
 void		cdcef_start_timeout (void *);
 
 struct cfattach cdcef_ca = {
-	sizeof(struct cdcef_softc), cdcef_match, cdcef_attach
+	sizeof(struct cdcef_softc), cdcef_match, cdcef_attach, NULL,
+	    cdcef_activate
 };
 
 struct cfdriver cdcef_cd = {
@@ -264,6 +266,23 @@ cdcef_attach(struct device *parent, struct device *sel
 
 	sc->sc_attached = 1;
 	splx(s);
+}
+
+int
+cdcef_activate(struct device *self, int act)
+{
+	struct cdcef_softc *sc = (struct cdcef_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
+
+	return 0;
 }
 
 usbf_status
Index: if_otus.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_otus.c,v
retrieving revision 1.24
diff -u -p if_otus.c
--- if_otus.c	30 Oct 2010 18:03:43 -0000	1.24
+++ if_otus.c	18 Dec 2010 22:57:05 -0000
@@ -105,6 +105,7 @@ static const struct usb_devno otus_devs[] = {
 int		otus_match(struct device *, void *, void *);
 void		otus_attach(struct device *, struct device *, void *);
 int		otus_detach(struct device *, int);
+int		otus_activate(struct device *, int);
 void		otus_attachhook(void *);
 void		otus_get_chanlist(struct otus_softc *);
 int		otus_load_firmware(struct otus_softc *, const char *,
@@ -179,7 +180,8 @@ struct cfdriver otus_cd = {
 };
 
 const struct cfattach otus_ca = {
-	sizeof (struct otus_softc), otus_match, otus_attach, otus_detach
+	sizeof (struct otus_softc), otus_match, otus_attach, otus_detach,
+	    otus_activate
 };
 
 int
@@ -266,6 +268,23 @@ otus_detach(struct device *self, int flags)
 	splx(s);
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, &sc->sc_dev);
+
+	return 0;
+}
+
+int
+otus_activate(struct device *self, int act)
+{
+	struct otus_softc *sc = (struct otus_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
 
 	return 0;
 }
Index: if_rsu.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_rsu.c,v
retrieving revision 1.6
diff -u -p if_rsu.c
--- if_rsu.c	15 Dec 2010 16:51:39 -0000	1.6
+++ if_rsu.c	18 Dec 2010 22:57:05 -0000
@@ -129,6 +129,7 @@ static const struct usb_devno rsu_devs_noht[] = {
 int		rsu_match(struct device *, void *, void *);
 void		rsu_attach(struct device *, struct device *, void *);
 int		rsu_detach(struct device *, int);
+int		rsu_activate(struct device *, int);
 int		rsu_open_pipes(struct rsu_softc *);
 void		rsu_close_pipes(struct rsu_softc *);
 int		rsu_alloc_rx_list(struct rsu_softc *);
@@ -199,7 +200,8 @@ const struct cfattach rsu_ca = {
 	sizeof(struct rsu_softc),
 	rsu_match,
 	rsu_attach,
-	rsu_detach
+	rsu_detach,
+	rsu_activate
 };
 
 int
@@ -361,6 +363,23 @@ rsu_detach(struct device *self, int flags)
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, &sc->sc_dev);
 	return (0);
+}
+
+int
+rsu_activate(struct device *self, int act)
+{
+	struct rsu_softc *sc = (struct rsu_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
+
+	return 0;
 }
 
 int
Index: if_urtwn.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/if_urtwn.c,v
retrieving revision 1.10
diff -u -p if_urtwn.c
--- if_urtwn.c	11 Dec 2010 21:07:38 -0000	1.10
+++ if_urtwn.c	18 Dec 2010 22:57:06 -0000
@@ -113,6 +113,7 @@ static const struct usb_devno urtwn_devs[] = {
 int		urtwn_match(struct device *, void *, void *);
 void		urtwn_attach(struct device *, struct device *, void *);
 int		urtwn_detach(struct device *, int);
+int		urtwn_activate(struct device *, int);
 int		urtwn_open_pipes(struct urtwn_softc *);
 void		urtwn_close_pipes(struct urtwn_softc *);
 int		urtwn_alloc_rx_list(struct urtwn_softc *);
@@ -213,7 +214,8 @@ const struct cfattach urtwn_ca = {
 	sizeof(struct urtwn_softc),
 	urtwn_match,
 	urtwn_attach,
-	urtwn_detach
+	urtwn_detach,
+	urtwn_activate
 };
 
 int
@@ -392,6 +394,23 @@ urtwn_detach(struct device *self, int flags)
 
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev, &sc->sc_dev);
 	return (0);
+}
+
+int
+urtwn_activate(struct device *self, int act)
+{
+	struct urtwn_softc *sc = (struct urtwn_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
+
+	return 0;
 }
 
 int
Index: uberry.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uberry.c,v
retrieving revision 1.17
diff -u -p uberry.c
--- uberry.c	20 Apr 2010 22:05:43 -0000	1.17
+++ uberry.c	18 Dec 2010 22:57:06 -0000
@@ -158,11 +158,14 @@ uberry_detach(struct device *self, int flags)
 int
 uberry_activate(struct device *self, int act)
 {
+	struct uberry_softc *sc = (struct uberry_softc *)self;
+
 	switch (act) {
 	case DVACT_ACTIVATE:
 		break;
 
 	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
 		break;
 	}
 	return 0;
Index: udfu.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/udfu.c,v
retrieving revision 1.1
diff -u -p udfu.c
--- udfu.c	25 Jan 2009 02:00:25 -0000	1.1
+++ udfu.c	18 Dec 2010 22:57:06 -0000
@@ -72,6 +72,7 @@ struct udfu_softc {
 int	udfu_match(struct device *, void *, void *);
 void	udfu_attach(struct device *, struct device *, void *);
 int	udfu_detach(struct device *, int);
+int	udfu_activate(struct device *, int);
 
 void	udfu_parse_desc(struct udfu_softc *);
 int	udfu_request(struct udfu_softc *, int, int, int, void *, size_t);
@@ -84,7 +85,8 @@ const struct cfattach udfu_ca = {
 	sizeof(struct udfu_softc),
 	udfu_match,
 	udfu_attach,
-	udfu_detach
+	udfu_detach,
+	udfu_activate
 };
 
 int
@@ -165,6 +167,23 @@ udfu_detach(struct device *self, int flags)
 	usbd_add_drv_event(USB_EVENT_DRIVER_DETACH, sc->sc_udev,
 	    &sc->sc_dev);
 	return (0);
+}
+
+int
+udfu_activate(struct device *self, int act)
+{
+	struct udfu_softc *sc = (struct udfu_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
+
+	return 0;
 }
 
 void
Index: udl.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/udl.c,v
retrieving revision 1.64
diff -u -p udl.c
--- udl.c	16 Oct 2010 07:06:20 -0000	1.64
+++ udl.c	18 Dec 2010 22:57:06 -0000
@@ -487,11 +487,13 @@ udl_detach(struct device *self, int flags)
 int
 udl_activate(struct device *self, int act)
 {
+	struct udl_softc *sc = (struct udl_softc *)self;
+
 	switch (act) {
 	case DVACT_ACTIVATE:
 		break;
 	case DVACT_DEACTIVATE:
-		/* XXX sc->sc_dying = 1; */
+		usbd_deactivate(sc->sc_udev);
 		break;
 	}
 
? ugen-bulk-read.diff
Index: uow.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uow.c,v
retrieving revision 1.27
diff -u -p uow.c
--- uow.c	7 Mar 2010 08:59:32 -0000	1.27
+++ uow.c	18 Dec 2010 22:57:06 -0000
@@ -278,6 +278,7 @@ uow_activate(struct device *self, int act)
 	case DVACT_DEACTIVATE:
 		if (sc->sc_ow_dev != NULL)
 			rv = config_deactivate(sc->sc_ow_dev);
+		usbd_deactivate(sc->sc_udev);
 		break;
 	}
 
? usb-drivers.txt
? usb-n.diff
Index: uyap.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uyap.c,v
retrieving revision 1.17
diff -u -p uyap.c
--- uyap.c	13 Oct 2009 19:33:19 -0000	1.17
+++ uyap.c	18 Dec 2010 22:57:06 -0000
@@ -125,5 +125,16 @@ uyap_detach(struct device *self, int flags)
 int
 uyap_activate(struct device *self, int act)
 {
+	struct uyap_softc *sc = (struct uyap_softc *)self;
+
+	switch (act) {
+	case DVACT_ACTIVATE:
+		break;
+
+	case DVACT_DEACTIVATE:
+		usbd_deactivate(sc->sc_udev);
+		break;
+	}
+
 	return 0;
 }
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
usb: add missing autoconf activate functions, Jacob Meuser, (Sat Dec 18, 4:11 pm)
Re: usb: add missing autoconf activate functions, Paul Irofti, (Sat Dec 18, 8:02 pm)
Re: usb: add missing autoconf activate functions, Paul Irofti, (Sat Dec 18, 8:06 pm)
Re: usb: add missing autoconf activate functions, Jacob Meuser, (Sat Dec 18, 10:11 pm)