diff options
author | imp <imp@FreeBSD.org> | 2007-06-18 22:25:46 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2007-06-18 22:25:46 +0000 |
commit | 03e581dfb9e93327c7f7fc43b3c9163cf28a9b2b (patch) | |
tree | c29c30e36c2a0bdd2fd7ef00eb8abdd63d110e66 | |
parent | 54ee9439a2328f935838093a7c5ac676a23bc173 (diff) | |
download | FreeBSD-src-03e581dfb9e93327c7f7fc43b3c9163cf28a9b2b.zip FreeBSD-src-03e581dfb9e93327c7f7fc43b3c9163cf28a9b2b.tar.gz |
Use device_foo_t to declare kobj methods
Fix shutdown type to return int rather than void.
-rw-r--r-- | sys/dev/usb/if_aue.c | 18 | ||||
-rw-r--r-- | sys/dev/usb/if_axe.c | 18 | ||||
-rw-r--r-- | sys/dev/usb/if_cue.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_kue.c | 12 | ||||
-rw-r--r-- | sys/dev/usb/if_rue.c | 19 | ||||
-rw-r--r-- | sys/dev/usb/if_rum.c | 24 | ||||
-rw-r--r-- | sys/dev/usb/if_udav.c | 28 | ||||
-rw-r--r-- | sys/dev/usb/if_ural.c | 7 |
8 files changed, 80 insertions, 58 deletions
diff --git a/sys/dev/usb/if_aue.c b/sys/dev/usb/if_aue.c index b472b8f..3ed68af 100644 --- a/sys/dev/usb/if_aue.c +++ b/sys/dev/usb/if_aue.c @@ -185,9 +185,13 @@ static const struct aue_type aue_devs[] = { }; #define aue_lookup(v, p) ((const struct aue_type *)usb_lookup(aue_devs, v, p)) -static int aue_match(device_t); -static int aue_attach(device_t); -static int aue_detach(device_t); +static device_probe_t aue_match; +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; static void aue_reset_pegasus_II(struct aue_softc *sc); static int aue_encap(struct aue_softc *, struct mbuf *, int); @@ -210,15 +214,11 @@ static void aue_init(void *); static void aue_init_body(struct aue_softc *); static void aue_stop(struct aue_softc *); static void aue_watchdog(struct aue_softc *); -static void aue_shutdown(device_t); static int aue_ifmedia_upd(struct ifnet *); static void aue_ifmedia_sts(struct ifnet *, struct ifmediareq *); static void aue_eeprom_getword(struct aue_softc *, int, u_int16_t *); static void aue_read_eeprom(struct aue_softc *, caddr_t, int, int, int); -static int aue_miibus_readreg(device_t, int, int); -static int aue_miibus_writereg(device_t, int, int, int); -static void aue_miibus_statchg(device_t); static void aue_setmulti(struct aue_softc *); static void aue_reset(struct aue_softc *); @@ -1405,7 +1405,7 @@ aue_stop(struct aue_softc *sc) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int aue_shutdown(device_t dev) { struct aue_softc *sc; @@ -1417,7 +1417,7 @@ aue_shutdown(device_t dev) aue_stop(sc); AUE_SXUNLOCK(sc); - return; + return (0); } static void diff --git a/sys/dev/usb/if_axe.c b/sys/dev/usb/if_axe.c index 6341ef7..a0a6675 100644 --- a/sys/dev/usb/if_axe.c +++ b/sys/dev/usb/if_axe.c @@ -120,9 +120,13 @@ static struct axe_type axe_devs[] = { { 0, 0 } }; -static int axe_match(device_t); -static int axe_attach(device_t); -static int axe_detach(device_t); +static device_probe_t axe_match; +static device_attach_t axe_attach; +static device_detach_t axe_detach; +static device_shutdown_t axe_shutdown; +static miibus_readreg_t axe_miibus_readreg; +static miibus_writereg_t axe_miibus_writereg; +static miibus_statchg_t axe_miibus_statchg; static int axe_encap(struct axe_softc *, struct mbuf *, int); static void axe_rxeof(usbd_xfer_handle, usbd_private_handle, usbd_status); @@ -135,10 +139,6 @@ static int axe_ioctl(struct ifnet *, u_long, caddr_t); static void axe_init(void *); static void axe_stop(struct axe_softc *); static void axe_watchdog(struct ifnet *); -static void axe_shutdown(device_t); -static int axe_miibus_readreg(device_t, int, int); -static int axe_miibus_writereg(device_t, int, int, int); -static void axe_miibus_statchg(device_t); static int axe_cmd(struct axe_softc *, int, int, int, void *); static int axe_ifmedia_upd(struct ifnet *); static void axe_ifmedia_sts(struct ifnet *, struct ifmediareq *); @@ -1124,7 +1124,7 @@ axe_stop(struct axe_softc *sc) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int axe_shutdown(device_t dev) { struct axe_softc *sc; @@ -1135,5 +1135,5 @@ axe_shutdown(device_t dev) axe_stop(sc); AXE_SLEEPUNLOCK(sc); - return; + return (0); } diff --git a/sys/dev/usb/if_cue.c b/sys/dev/usb/if_cue.c index b862b47..c01b24e 100644 --- a/sys/dev/usb/if_cue.c +++ b/sys/dev/usb/if_cue.c @@ -90,9 +90,10 @@ static struct cue_type cue_devs[] = { { 0, 0 } }; -static int cue_match(device_t); -static int cue_attach(device_t); -static int cue_detach(device_t); +static device_probe_t cue_match; +static device_attach_t cue_attach; +static device_detach_t cue_detach; +static device_shutdown_t cue_shutdown; static int cue_encap(struct cue_softc *, struct mbuf *, int); static void cue_rxeof(usbd_xfer_handle, usbd_private_handle, usbd_status); @@ -104,7 +105,6 @@ static int cue_ioctl(struct ifnet *, u_long, caddr_t); static void cue_init(void *); static void cue_stop(struct cue_softc *); static void cue_watchdog(struct ifnet *); -static void cue_shutdown(device_t); static void cue_setmulti(struct cue_softc *); static uint32_t cue_mchash(const uint8_t *); @@ -1057,7 +1057,7 @@ cue_stop(struct cue_softc *sc) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int cue_shutdown(device_t dev) { struct cue_softc *sc; @@ -1069,5 +1069,5 @@ cue_shutdown(device_t dev) cue_stop(sc); CUE_UNLOCK(sc); - return; + return (0); } diff --git a/sys/dev/usb/if_kue.c b/sys/dev/usb/if_kue.c index 11fb1b7..95d6f92 100644 --- a/sys/dev/usb/if_kue.c +++ b/sys/dev/usb/if_kue.c @@ -125,10 +125,10 @@ static struct kue_type kue_devs[] = { { 0, 0 } }; -static int kue_match(device_t); -static int kue_attach(device_t); -static int kue_detach(device_t); -static void kue_shutdown(device_t); +static device_probe_t kue_match; +static device_attach_t kue_attach; +static device_detach_t kue_detach; +static device_shutdown_t kue_shutdown; static int kue_encap(struct kue_softc *, struct mbuf *, int); static void kue_rxeof(usbd_xfer_handle, usbd_private_handle, usbd_status); static void kue_txeof(usbd_xfer_handle, usbd_private_handle, usbd_status); @@ -996,7 +996,7 @@ kue_stop(struct kue_softc *sc) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int kue_shutdown(device_t dev) { struct kue_softc *sc; @@ -1005,5 +1005,5 @@ kue_shutdown(device_t dev) kue_stop(sc); - return; + return (0); } diff --git a/sys/dev/usb/if_rue.c b/sys/dev/usb/if_rue.c index 268a873..8ecb4aa 100644 --- a/sys/dev/usb/if_rue.c +++ b/sys/dev/usb/if_rue.c @@ -127,9 +127,13 @@ static struct rue_type rue_devs[] = { { 0, 0 } }; -static int rue_match(device_t); -static int rue_attach(device_t); -static int rue_detach(device_t); +static device_probe_t rue_match; +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; +static miibus_statchg_t rue_miibus_statchg; static int rue_encap(struct rue_softc *, struct mbuf *, int); #ifdef RUE_INTR_PIPE @@ -144,14 +148,9 @@ static int rue_ioctl(struct ifnet *, u_long, caddr_t); static void rue_init(void *); static void rue_stop(struct rue_softc *); static void rue_watchdog(struct ifnet *); -static void rue_shutdown(device_t); static int rue_ifmedia_upd(struct ifnet *); static void rue_ifmedia_sts(struct ifnet *, struct ifmediareq *); -static int rue_miibus_readreg(device_t, int, int); -static int rue_miibus_writereg(device_t, int, int, int); -static void rue_miibus_statchg(device_t); - static void rue_setmulti(struct rue_softc *); static void rue_reset(struct rue_softc *); @@ -1359,7 +1358,7 @@ rue_stop(struct rue_softc *sc) * get confused by errant DMAs when rebooting. */ -static void +static int rue_shutdown(device_t dev) { struct rue_softc *sc; @@ -1371,4 +1370,6 @@ rue_shutdown(device_t dev) rue_reset(sc); rue_stop(sc); RUE_UNLOCK(sc); + + return (0); } diff --git a/sys/dev/usb/if_rum.c b/sys/dev/usb/if_rum.c index 21b589d..a17221b 100644 --- a/sys/dev/usb/if_rum.c +++ b/sys/dev/usb/if_rum.c @@ -357,8 +357,6 @@ static const struct rfprog { { 165, 0x00b33, 0x012ad, 0x2e014, 0x30285 } }; -USB_DECLARE_DRIVER(rum); - static int rum_match(device_t self) { @@ -374,7 +372,8 @@ rum_match(device_t self) static int rum_attach(device_t self) { - USB_ATTACH_START(rum, sc, uaa); + struct rum_softc *sc = device_get_softc(self); + struct usb_attach_arg *uaa = device_get_ivars(self); struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp; const uint8_t *ucode = NULL; @@ -573,7 +572,7 @@ rum_attach(device_t self) static int rum_detach(device_t self) { - USB_DETACH_START(rum, sc); + struct rum_softc *sc = device_get_softc(self); struct ieee80211com *ic = &sc->sc_ic; struct ifnet *ifp = ic->ic_ifp; @@ -2536,4 +2535,21 @@ rum_get_rssi(struct rum_softc *sc, uint8_t raw) return rssi; } +static device_method_t rum_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rum_match), + DEVMETHOD(device_attach, rum_attach), + DEVMETHOD(device_detach, rum_detach), + + { 0, 0 } +}; + +static driver_t rum_driver = { + "rum", + rum_methods, + sizeof(struct rum_softc) +}; + +static devclass_t rum_devclass; + DRIVER_MODULE(rum, uhub, rum_driver, rum_devclass, usbd_driver_load, 0); diff --git a/sys/dev/usb/if_udav.c b/sys/dev/usb/if_udav.c index 457b04d..2b3008d 100644 --- a/sys/dev/usb/if_udav.c +++ b/sys/dev/usb/if_udav.c @@ -126,6 +126,7 @@ __FBSDID("$FreeBSD$"); #include <dev/mii/mii.h> #include <dev/mii/miivar.h> +#include <dev/usb/usb_port.h> #include <dev/usb/usb.h> #include <dev/usb/usbdi.h> #include <dev/usb/usbdi_util.h> @@ -150,10 +151,13 @@ USB_DECLARE_DRIVER(udav); #endif #if defined(__FreeBSD__) -static int udav_match(device_t); -static int udav_attach(device_t); -static int udav_detach(device_t); -static void udav_shutdown(device_t); +static device_probe_t udav_match; +static device_attach_t udav_attach; +static device_detach_t udav_detach; +static device_shutdown_t udav_shutdown; +static miibus_readreg_t udav_miibus_readreg; +static miibus_writereg_t udav_miibus_writereg; +static miibus_statchg_t udav_miibus_statchg; #endif static int udav_openpipes(struct udav_softc *); @@ -174,10 +178,10 @@ static int udav_ifmedia_change(struct ifnet *); static void udav_ifmedia_status(struct ifnet *, struct ifmediareq *); static void udav_lock_mii(struct udav_softc *); static void udav_unlock_mii(struct udav_softc *); +#if defined(__NetBSD__) static int udav_miibus_readreg(device_t, int, int); static void udav_miibus_writereg(device_t, int, int, int); static void udav_miibus_statchg(device_t); -#if defined(__NetBSD__) static int udav_init(struct ifnet *); #elif defined(__FreeBSD__) static void udav_init(void *); @@ -1850,14 +1854,14 @@ udav_miibus_readreg(device_t dev, int phy, int reg) return (data16); } -static void +static int udav_miibus_writereg(device_t dev, int phy, int reg, int data) { struct udav_softc *sc; u_int8_t val[2]; if (dev == NULL) - return; + return (0); /* XXX real error? */ sc = USBGETSOFTC(dev); @@ -1869,14 +1873,14 @@ udav_miibus_writereg(device_t dev, int phy, int reg, int data) printf("%s: %s: dying\n", device_get_nameunit(sc->sc_dev), __func__); #endif - return; + return (0); /* XXX real error? */ } /* XXX: one PHY only for the internal PHY */ if (phy != 0) { DPRINTFN(0xff, ("%s: %s: phy=%d is not supported\n", device_get_nameunit(sc->sc_dev), __func__, phy)); - return; + return (0); /* XXX real error? */ } udav_lock_mii(sc); @@ -1900,7 +1904,7 @@ udav_miibus_writereg(device_t dev, int phy, int reg, int data) udav_unlock_mii(sc); - return; + return (0); } static void @@ -1923,7 +1927,7 @@ udav_miibus_statchg(device_t dev) * Stop all chip I/O so that the kernel's probe routines don't * get confused by errant DMAs when rebooting. */ -static void +static int udav_shutdown(device_t dev) { struct udav_softc *sc; @@ -1932,7 +1936,7 @@ udav_shutdown(device_t dev) udav_stop_task(sc); - return; + return (0); } static void diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index ba8c15a..1ea738d 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -344,9 +344,10 @@ static const struct { { 161, 0x08808, 0x0242f, 0x00281 } }; -static int ural_match(device_t); -static int ural_attach(device_t); -static int ural_detach(device_t); +static device_probe_t ural_match; +static device_attach_t ural_attach; +static device_detach_t ural_detach; + static device_method_t ural_methods[] = { /* Device interface */ DEVMETHOD(device_probe, ural_match), |