PERFORCE change 161552 for review

Hans Petter Selasky hselasky at FreeBSD.org
Mon May 4 12:17:45 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=161552

Change 161552 by hselasky at hselasky_laptop001 on 2009/05/04 12:17:42

	
	USB: Remove USB shutdown methods because they race with
	the attach/detach/suspend/resume methods. Possibly we
	could detach the Host or Device controller at shutdown
	instead to have a similar effect.
	
	PR:		usb/133896

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/net/if_aue.c#5 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_axe.c#6 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#8 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_cue.c#5 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_kue.c#5 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_rue.c#5 edit
.. //depot/projects/usb/src/sys/dev/usb/net/if_udav.c#5 edit
.. //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.c#3 edit
.. //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.h#3 edit
.. //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#11 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#35 edit
.. //depot/projects/usb/src/sys/dev/usb/usb_hub.c#17 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/net/if_aue.c#5 (text+ko) ====

@@ -173,7 +173,6 @@
 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 @@
 	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_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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/if_axe.c#6 (text+ko) ====

@@ -151,7 +151,6 @@
 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 @@
 	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_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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/if_cdce.c#8 (text+ko) ====

@@ -67,7 +67,6 @@
 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 @@
 	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 @@
 }
 
 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");

==== //depot/projects/usb/src/sys/dev/usb/net/if_cue.c#5 (text+ko) ====

@@ -86,7 +86,6 @@
 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 @@
 	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_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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/if_kue.c#5 (text+ko) ====

@@ -129,7 +129,6 @@
 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 @@
 	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 @@
 	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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/if_rue.c#5 (text+ko) ====

@@ -105,7 +105,6 @@
 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 @@
 	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_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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/if_udav.c#5 (text+ko) ====

@@ -69,7 +69,6 @@
 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 @@
 	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 @@
 {
 	/* 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);
-}

==== //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.c#3 (text+ko) ====

@@ -288,19 +288,6 @@
 	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)
 {

==== //depot/projects/usb/src/sys/dev/usb/net/usb_ethernet.h#3 (text+ko) ====

@@ -118,6 +118,5 @@
 		    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_ */

==== //depot/projects/usb/src/sys/dev/usb/storage/ustorage_fs.c#11 (text+ko) ====

@@ -202,7 +202,6 @@
 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 @@
 	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 @@
 	return (0);			/* success */
 }
 
-static int
-ustorage_fs_shutdown(device_t dev)
-{
-	return (0);			/* success */
-}
-
 /*
  * Generic functions to handle transfers
  */

==== //depot/projects/usb/src/sys/dev/usb/usb_compat_linux.c#35 (text+ko) ====

@@ -59,7 +59,6 @@
 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 @@
 	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_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
  *------------------------------------------------------------------------*/
 

==== //depot/projects/usb/src/sys/dev/usb/usb_hub.c#17 (text+ko) ====

@@ -132,7 +132,6 @@
 
 	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),


More information about the p4-projects mailing list