Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 5 May 2009 15:39:29 +0000 (UTC)
From:      Andrew Thompson <thompsa@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r191825 - in head/sys/dev/usb: . net storage
Message-ID:  <200905051539.n45FdTPb085609@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: thompsa
Date: Tue May  5 15:39:29 2009
New Revision: 191825
URL: http://svn.freebsd.org/changeset/base/191825

Log:
  Remove USB shutdown methods from device drivers as its the host controllers
  responsibility to detach the bus.
  
  PR:		usb/133896
  Submitted by:	Hans Petter Selasky

Modified:
  head/sys/dev/usb/net/if_aue.c
  head/sys/dev/usb/net/if_axe.c
  head/sys/dev/usb/net/if_cdce.c
  head/sys/dev/usb/net/if_cue.c
  head/sys/dev/usb/net/if_kue.c
  head/sys/dev/usb/net/if_rue.c
  head/sys/dev/usb/net/if_udav.c
  head/sys/dev/usb/net/usb_ethernet.c
  head/sys/dev/usb/net/usb_ethernet.h
  head/sys/dev/usb/storage/ustorage_fs.c
  head/sys/dev/usb/usb_compat_linux.c
  head/sys/dev/usb/usb_hub.c

Modified: head/sys/dev/usb/net/if_aue.c
==============================================================================
--- head/sys/dev/usb/net/if_aue.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_aue.c	Tue May  5 15:39:29 2009	(r191825)
@@ -173,7 +173,6 @@ static const struct usb2_device_id aue_d
 static device_probe_t aue_probe;
 static device_attach_t aue_attach;
 static device_detach_t aue_detach;
-static device_shutdown_t aue_shutdown;
 static miibus_readreg_t aue_miibus_readreg;
 static miibus_writereg_t aue_miibus_writereg;
 static miibus_statchg_t aue_miibus_statchg;
@@ -239,7 +238,6 @@ static device_method_t aue_methods[] = {
 	DEVMETHOD(device_probe, aue_probe),
 	DEVMETHOD(device_attach, aue_attach),
 	DEVMETHOD(device_detach, aue_detach),
-	DEVMETHOD(device_shutdown, aue_shutdown),
 
 	/* bus interface */
 	DEVMETHOD(bus_print_child, bus_generic_print_child),
@@ -1038,17 +1036,3 @@ aue_stop(struct usb2_ether *ue)
 	aue_csr_write_1(sc, AUE_CTL1, 0);
 	aue_reset(sc);
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-aue_shutdown(device_t dev)
-{
-	struct aue_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/if_axe.c
==============================================================================
--- head/sys/dev/usb/net/if_axe.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_axe.c	Tue May  5 15:39:29 2009	(r191825)
@@ -151,7 +151,6 @@ static const struct usb2_device_id axe_d
 static device_probe_t axe_probe;
 static device_attach_t axe_attach;
 static device_detach_t axe_detach;
-static device_shutdown_t axe_shutdown;
 
 static usb2_callback_t axe_intr_callback;
 static usb2_callback_t axe_bulk_read_callback;
@@ -216,7 +215,6 @@ static device_method_t axe_methods[] = {
 	DEVMETHOD(device_probe, axe_probe),
 	DEVMETHOD(device_attach, axe_attach),
 	DEVMETHOD(device_detach, axe_detach),
-	DEVMETHOD(device_shutdown, axe_shutdown),
 
 	/* bus interface */
 	DEVMETHOD(bus_print_child, bus_generic_print_child),
@@ -1060,17 +1058,3 @@ axe_stop(struct usb2_ether *ue)
 
 	axe_reset(sc);
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-axe_shutdown(device_t dev)
-{
-	struct axe_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/if_cdce.c
==============================================================================
--- head/sys/dev/usb/net/if_cdce.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_cdce.c	Tue May  5 15:39:29 2009	(r191825)
@@ -67,7 +67,6 @@ __FBSDID("$FreeBSD$");
 static device_probe_t cdce_probe;
 static device_attach_t cdce_attach;
 static device_detach_t cdce_detach;
-static device_shutdown_t cdce_shutdown;
 static device_suspend_t cdce_suspend;
 static device_resume_t cdce_resume;
 static usb_handle_request_t cdce_handle_request;
@@ -157,7 +156,6 @@ static device_method_t cdce_methods[] = 
 	DEVMETHOD(device_detach, cdce_detach),
 	DEVMETHOD(device_suspend, cdce_suspend),
 	DEVMETHOD(device_resume, cdce_resume),
-	DEVMETHOD(device_shutdown, cdce_shutdown),
 
 	{0, 0}
 };
@@ -596,16 +594,6 @@ cdce_setpromisc(struct usb2_ether *ue)
 }
 
 static int
-cdce_shutdown(device_t dev)
-{
-	struct cdce_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}
-
-static int
 cdce_suspend(device_t dev)
 {
 	device_printf(dev, "Suspending\n");

Modified: head/sys/dev/usb/net/if_cue.c
==============================================================================
--- head/sys/dev/usb/net/if_cue.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_cue.c	Tue May  5 15:39:29 2009	(r191825)
@@ -86,7 +86,6 @@ static const struct usb2_device_id cue_d
 static device_probe_t cue_probe;
 static device_attach_t cue_attach;
 static device_detach_t cue_detach;
-static device_shutdown_t cue_shutdown;
 
 static usb2_callback_t cue_bulk_read_callback;
 static usb2_callback_t cue_bulk_write_callback;
@@ -142,7 +141,6 @@ static device_method_t cue_methods[] = {
 	DEVMETHOD(device_probe, cue_probe),
 	DEVMETHOD(device_attach, cue_attach),
 	DEVMETHOD(device_detach, cue_detach),
-	DEVMETHOD(device_shutdown, cue_shutdown),
 
 	{0, 0}
 };
@@ -629,17 +627,3 @@ cue_stop(struct usb2_ether *ue)
 	cue_csr_write_1(sc, CUE_ETHCTL, 0);
 	cue_reset(sc);
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-cue_shutdown(device_t dev)
-{
-	struct cue_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/if_kue.c
==============================================================================
--- head/sys/dev/usb/net/if_kue.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_kue.c	Tue May  5 15:39:29 2009	(r191825)
@@ -129,7 +129,6 @@ static const struct usb2_device_id kue_d
 static device_probe_t kue_probe;
 static device_attach_t kue_attach;
 static device_detach_t kue_detach;
-static device_shutdown_t kue_shutdown;
 
 static usb2_callback_t kue_bulk_read_callback;
 static usb2_callback_t kue_bulk_write_callback;
@@ -185,7 +184,6 @@ static device_method_t kue_methods[] = {
 	DEVMETHOD(device_probe, kue_probe),
 	DEVMETHOD(device_attach, kue_attach),
 	DEVMETHOD(device_detach, kue_detach),
-	DEVMETHOD(device_shutdown, kue_shutdown),
 
 	{0, 0}
 };
@@ -688,17 +686,3 @@ kue_stop(struct usb2_ether *ue)
 	usb2_transfer_stop(sc->sc_xfer[KUE_BULK_DT_WR]);
 	usb2_transfer_stop(sc->sc_xfer[KUE_BULK_DT_RD]);
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-kue_shutdown(device_t dev)
-{
-	struct kue_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/if_rue.c
==============================================================================
--- head/sys/dev/usb/net/if_rue.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_rue.c	Tue May  5 15:39:29 2009	(r191825)
@@ -105,7 +105,6 @@ static const struct usb2_device_id rue_d
 static device_probe_t rue_probe;
 static device_attach_t rue_attach;
 static device_detach_t rue_detach;
-static device_shutdown_t rue_shutdown;
 
 static miibus_readreg_t rue_miibus_readreg;
 static miibus_writereg_t rue_miibus_writereg;
@@ -172,7 +171,6 @@ static device_method_t rue_methods[] = {
 	DEVMETHOD(device_probe, rue_probe),
 	DEVMETHOD(device_attach, rue_attach),
 	DEVMETHOD(device_detach, rue_detach),
-	DEVMETHOD(device_shutdown, rue_shutdown),
 
 	/* Bus interface */
 	DEVMETHOD(bus_print_child, bus_generic_print_child),
@@ -897,17 +895,3 @@ rue_stop(struct usb2_ether *ue)
 
 	rue_reset(sc);
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-rue_shutdown(device_t dev)
-{
-	struct rue_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/if_udav.c
==============================================================================
--- head/sys/dev/usb/net/if_udav.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/if_udav.c	Tue May  5 15:39:29 2009	(r191825)
@@ -69,7 +69,6 @@ __FBSDID("$FreeBSD$");
 static device_probe_t udav_probe;
 static device_attach_t udav_attach;
 static device_detach_t udav_detach;
-static device_shutdown_t udav_shutdown;
 
 static usb2_callback_t udav_bulk_write_callback;
 static usb2_callback_t udav_bulk_read_callback;
@@ -132,7 +131,6 @@ static device_method_t udav_methods[] = 
 	DEVMETHOD(device_probe, udav_probe),
 	DEVMETHOD(device_attach, udav_attach),
 	DEVMETHOD(device_detach, udav_detach),
-	DEVMETHOD(device_shutdown, udav_shutdown),
 
 	/* bus interface */
 	DEVMETHOD(bus_print_child, bus_generic_print_child),
@@ -840,17 +838,3 @@ udav_miibus_statchg(device_t dev)
 {
 	/* nothing to do */
 }
-
-/*
- * Stop all chip I/O so that the kernel's probe routines don't
- * get confused by errant DMAs when rebooting.
- */
-static int
-udav_shutdown(device_t dev)
-{
-	struct udav_softc *sc = device_get_softc(dev);
-
-	usb2_ether_ifshutdown(&sc->sc_ue);
-
-	return (0);
-}

Modified: head/sys/dev/usb/net/usb_ethernet.c
==============================================================================
--- head/sys/dev/usb/net/usb_ethernet.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/usb_ethernet.c	Tue May  5 15:39:29 2009	(r191825)
@@ -288,19 +288,6 @@ usb2_ether_ifdetach(struct usb2_ether *u
 	usb2_proc_free(&ue->ue_tq);
 }
 
-void
-usb2_ether_ifshutdown(struct usb2_ether *ue)
-{
-	struct ifnet *ifp = ue->ue_ifp;
-
-	UE_LOCK(ue);
-	if (ifp->if_drv_flags & IFF_DRV_RUNNING)
-		ue_queue_command(ue, ue_stop_task,
-		    &ue->ue_sync_task[0].hdr,
-		    &ue->ue_sync_task[1].hdr);
-	UE_UNLOCK(ue);
-}
-
 uint8_t
 usb2_ether_is_gone(struct usb2_ether *ue)
 {

Modified: head/sys/dev/usb/net/usb_ethernet.h
==============================================================================
--- head/sys/dev/usb/net/usb_ethernet.h	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/net/usb_ethernet.h	Tue May  5 15:39:29 2009	(r191825)
@@ -118,6 +118,5 @@ int		usb2_ether_rxbuf(struct usb2_ether 
 		    struct usb2_page_cache *, 
 		    unsigned int, unsigned int);
 void		usb2_ether_rxflush(struct usb2_ether *);
-void		usb2_ether_ifshutdown(struct usb2_ether *);
 uint8_t		usb2_ether_is_gone(struct usb2_ether *);
 #endif					/* _USB2_ETHERNET_H_ */

Modified: head/sys/dev/usb/storage/ustorage_fs.c
==============================================================================
--- head/sys/dev/usb/storage/ustorage_fs.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/storage/ustorage_fs.c	Tue May  5 15:39:29 2009	(r191825)
@@ -202,7 +202,6 @@ static device_attach_t ustorage_fs_attac
 static device_detach_t ustorage_fs_detach;
 static device_suspend_t ustorage_fs_suspend;
 static device_resume_t ustorage_fs_resume;
-static device_shutdown_t ustorage_fs_shutdown;
 static usb_handle_request_t ustorage_fs_handle_request;
 
 static usb2_callback_t ustorage_fs_t_bbb_command_callback;
@@ -239,7 +238,6 @@ static device_method_t ustorage_fs_metho
 	DEVMETHOD(device_detach, ustorage_fs_detach),
 	DEVMETHOD(device_suspend, ustorage_fs_suspend),
 	DEVMETHOD(device_resume, ustorage_fs_resume),
-	DEVMETHOD(device_shutdown, ustorage_fs_shutdown),
 
 	{0, 0}
 };
@@ -437,12 +435,6 @@ ustorage_fs_resume(device_t dev)
 	return (0);			/* success */
 }
 
-static int
-ustorage_fs_shutdown(device_t dev)
-{
-	return (0);			/* success */
-}
-
 /*
  * Generic functions to handle transfers
  */

Modified: head/sys/dev/usb/usb_compat_linux.c
==============================================================================
--- head/sys/dev/usb/usb_compat_linux.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/usb_compat_linux.c	Tue May  5 15:39:29 2009	(r191825)
@@ -59,7 +59,6 @@ static device_attach_t usb_linux_attach;
 static device_detach_t usb_linux_detach;
 static device_suspend_t usb_linux_suspend;
 static device_resume_t usb_linux_resume;
-static device_shutdown_t usb_linux_shutdown;
 
 static usb2_callback_t usb_linux_isoc_callback;
 static usb2_callback_t usb_linux_non_isoc_callback;
@@ -92,7 +91,6 @@ static device_method_t usb_linux_methods
 	DEVMETHOD(device_detach, usb_linux_detach),
 	DEVMETHOD(device_suspend, usb_linux_suspend),
 	DEVMETHOD(device_resume, usb_linux_resume),
-	DEVMETHOD(device_shutdown, usb_linux_shutdown),
 
 	{0, 0}
 };
@@ -360,23 +358,6 @@ usb_linux_resume(device_t dev)
 }
 
 /*------------------------------------------------------------------------*
- *	usb_linux_shutdown
- *
- * This function is the FreeBSD shutdown callback. Usually it does nothing.
- *------------------------------------------------------------------------*/
-static int
-usb_linux_shutdown(device_t dev)
-{
-	struct usb_linux_softc *sc = device_get_softc(dev);
-	struct usb_driver *udrv = usb_linux_get_usb_driver(sc);
-
-	if (udrv && udrv->shutdown) {
-		(udrv->shutdown) (sc->sc_ui);
-	}
-	return (0);
-}
-
-/*------------------------------------------------------------------------*
  * Linux emulation layer
  *------------------------------------------------------------------------*/
 

Modified: head/sys/dev/usb/usb_hub.c
==============================================================================
--- head/sys/dev/usb/usb_hub.c	Tue May  5 15:36:23 2009	(r191824)
+++ head/sys/dev/usb/usb_hub.c	Tue May  5 15:39:29 2009	(r191825)
@@ -132,7 +132,6 @@ static device_method_t uhub_methods[] = 
 
 	DEVMETHOD(device_suspend, uhub_suspend),
 	DEVMETHOD(device_resume, uhub_resume),
-	DEVMETHOD(device_shutdown, bus_generic_shutdown),
 
 	DEVMETHOD(bus_child_location_str, uhub_child_location_string),
 	DEVMETHOD(bus_child_pnpinfo_str, uhub_child_pnpinfo_string),



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200905051539.n45FdTPb085609>