Date: Sun, 25 Jun 2006 17:22:48 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 99993 for review Message-ID: <200606251722.k5PHMmGn048206@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=99993 Change 99993 by hselasky@hselasky_mini_itx on 2006/06/25 17:22:26 Finished converting "sys/dev/if_ndis/if_ndis_usb.c". Affected files ... .. //depot/projects/usb/src/sys/dev/if_ndis/if_ndis_usb.c#2 edit Differences ... ==== //depot/projects/usb/src/sys/dev/if_ndis/if_ndis_usb.c#2 (text+ko) ==== @@ -31,8 +31,6 @@ */ #include <sys/cdefs.h> -__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.5 2005/04/24 20:21:22 wpaul Exp $"); - #include <sys/param.h> #include <sys/systm.h> #include <sys/sockio.h> @@ -42,6 +40,11 @@ #include <sys/socket.h> #include <sys/sysctl.h> +#include <dev/usb/usb_port.h> +#include <dev/usb/usb.h> +#include <dev/usb/usb_subr.h> +#include <dev/usb/usb_quirks.h> + #include <net/if.h> #include <net/if_arp.h> #include <net/ethernet.h> @@ -50,14 +53,6 @@ #include <net/bpf.h> -#include <sys/bus.h> -#include <machine/bus.h> -#include <dev/usb/usb.h> -#include <dev/usb/usbdi.h> -#include <dev/usb/usbdi_util.h> -#include <dev/usb/usbdivar.h> -#include "usbdevs.h" - #include <net80211/ieee80211_var.h> #include <compat/ndis/pe_var.h> @@ -67,25 +62,26 @@ #include <compat/ndis/ndis_var.h> #include <dev/if_ndis/if_ndisvar.h> +__FBSDID("$FreeBSD: src/sys/dev/if_ndis/if_ndis_usb.c,v 1.5 2005/04/24 20:21:22 wpaul Exp $"); + MODULE_DEPEND(ndis, usb, 1, 1, 1); -Static int ndisusb_match (device_ptr_t); -Static int ndisusb_attach (device_ptr_t); -Static struct resource_list *ndis_get_resource_list - (device_t, device_t); +static device_probe_t ndisusb_probe; +static device_attach_t ndisusb_attach; +static struct resource_list *ndis_get_resource_list(device_t, device_t); -extern int ndisdrv_modevent (module_t, int, void *); -extern int ndis_attach (device_t); -extern int ndis_shutdown (device_t); -extern int ndis_detach (device_t); -extern int ndis_suspend (device_t); -extern int ndis_resume (device_t); +extern device_attach_t ndis_attach; +extern device_shutdown_t ndis_shutdown; +extern device_detach_t ndis_detach; +extern device_suspend_t ndis_suspend; +extern device_resume_t ndis_resume; +extern int ndisdrv_modevent(module_t, int, void *); extern unsigned char drv_data[]; -Static device_method_t ndis_methods[] = { +static device_method_t ndis_methods[] = { /* Device interface */ - DEVMETHOD(device_probe, ndisusb_match), + DEVMETHOD(device_probe, ndisusb_probe), DEVMETHOD(device_attach, ndisusb_attach), DEVMETHOD(device_detach, ndis_detach), DEVMETHOD(device_shutdown, ndis_shutdown), @@ -98,60 +94,56 @@ { 0, 0 } }; -Static driver_t ndis_driver = { +static driver_t ndis_driver = { "ndis", ndis_methods, sizeof(struct ndis_softc) }; -Static devclass_t ndis_devclass; +static devclass_t ndis_devclass; DRIVER_MODULE(ndis, uhub, ndis_driver, ndis_devclass, ndisdrv_modevent, 0); -USB_MATCH(ndisusb) +static int +ndisusb_probe(device_t dev) { - USB_MATCH_START(ndisusb, uaa); + struct usb_attach_arg *uaa = device_get_ivars(dev); - if (windrv_lookup(0, "USB Bus") == NULL) - return(UMATCH_NONE); + if (windrv_lookup(0, "USB Bus") == NULL) { + return UMATCH_NONE; + } - if (uaa->iface != NULL) - return(UMATCH_NONE); + if (uaa->iface != NULL) { + return UMATCH_NONE; + } - return(UMATCH_NONE); + return UMATCH_NONE; } -USB_ATTACH(ndisusb) +static int +ndisusb_attach(device_t dev) { - USB_ATTACH_START(ndisusb, dummy, uaa); - struct ndis_softc *sc; - driver_object *drv; + struct ndis_softc *sc = device_get_softc(dev); + driver_object *drv; - sc = (struct ndis_softc *)dummy; - - if (uaa->device == NULL) - USB_ATTACH_ERROR_RETURN; - - sc->ndis_dev = self; + sc->ndis_dev = dev; /* Create PDO for this device instance */ drv = windrv_lookup(0, "USB Bus"); - windrv_create_pdo(drv, self); + windrv_create_pdo(drv, dev); - if (ndis_attach(self) != 0) - USB_ATTACH_ERROR_RETURN; + if (ndis_attach(dev) != 0) { + return ENXIO; + } - USB_ATTACH_SUCCESS_RETURN; + return 0; /* success */ } static struct resource_list * -ndis_get_resource_list(dev, child) - device_t dev; - device_t child; +ndis_get_resource_list(device_t dev, device_t child) { - struct ndis_softc *sc; + struct ndis_softc *sc = device_get_softc(dev); - sc = device_get_softc(dev); return (BUS_GET_RESOURCE_LIST(device_get_parent(sc->ndis_dev), dev)); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606251722.k5PHMmGn048206>