Deleted Added
full compact
uhso.c (239180) uhso.c (239299)
1/*-
2 * Copyright (c) 2010 Fredrik Lindberg <fli@shapeshifter.se>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2010 Fredrik Lindberg <fli@shapeshifter.se>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 */
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/dev/usb/net/uhso.c 239180 2012-08-10 15:29:41Z hselasky $");
27__FBSDID("$FreeBSD: head/sys/dev/usb/net/uhso.c 239299 2012-08-15 15:42:57Z hselasky $");
28
29#include <sys/param.h>
30#include <sys/types.h>
31#include <sys/sockio.h>
32#include <sys/mbuf.h>
33#include <sys/malloc.h>
34#include <sys/kernel.h>
35#include <sys/module.h>

--- 433 unchanged lines hidden (view full) ---

469static int uhso_if_ioctl(struct ifnet *, u_long, caddr_t);
470static int uhso_if_output(struct ifnet *, struct mbuf *, struct sockaddr *,
471 struct route *);
472static void uhso_if_rxflush(void *);
473
474static device_probe_t uhso_probe;
475static device_attach_t uhso_attach;
476static device_detach_t uhso_detach;
28
29#include <sys/param.h>
30#include <sys/types.h>
31#include <sys/sockio.h>
32#include <sys/mbuf.h>
33#include <sys/malloc.h>
34#include <sys/kernel.h>
35#include <sys/module.h>

--- 433 unchanged lines hidden (view full) ---

469static int uhso_if_ioctl(struct ifnet *, u_long, caddr_t);
470static int uhso_if_output(struct ifnet *, struct mbuf *, struct sockaddr *,
471 struct route *);
472static void uhso_if_rxflush(void *);
473
474static device_probe_t uhso_probe;
475static device_attach_t uhso_attach;
476static device_detach_t uhso_detach;
477static device_free_softc_t uhso_free_softc;
477static void uhso_free_softc(struct uhso_softc *);
478
479static device_method_t uhso_methods[] = {
480 DEVMETHOD(device_probe, uhso_probe),
481 DEVMETHOD(device_attach, uhso_attach),
482 DEVMETHOD(device_detach, uhso_detach),
478
479static device_method_t uhso_methods[] = {
480 DEVMETHOD(device_probe, uhso_probe),
481 DEVMETHOD(device_attach, uhso_attach),
482 DEVMETHOD(device_detach, uhso_detach),
483 DEVMETHOD(device_free_softc, uhso_free_softc),
484 { 0, 0 }
485};
486
487static driver_t uhso_driver = {
488 .name = "uhso",
489 .methods = uhso_methods,
490 .size = sizeof(struct uhso_softc)
491};

--- 200 unchanged lines hidden (view full) ---

692 uhso_if_stop(sc);
693 bpfdetach(sc->sc_ifp);
694 if_detach(sc->sc_ifp);
695 if_free(sc->sc_ifp);
696 mtx_unlock(&sc->sc_mtx);
697 usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX);
698 }
699
483 { 0, 0 }
484};
485
486static driver_t uhso_driver = {
487 .name = "uhso",
488 .methods = uhso_methods,
489 .size = sizeof(struct uhso_softc)
490};

--- 200 unchanged lines hidden (view full) ---

691 uhso_if_stop(sc);
692 bpfdetach(sc->sc_ifp);
693 if_detach(sc->sc_ifp);
694 if_free(sc->sc_ifp);
695 mtx_unlock(&sc->sc_mtx);
696 usbd_transfer_unsetup(sc->sc_if_xfer, UHSO_IFNET_MAX);
697 }
698
699 device_claim_softc(self);
700
701 uhso_free_softc(sc);
702
700 return (0);
701}
702
703UCOM_UNLOAD_DRAIN(uhso);
704
705static void
703 return (0);
704}
705
706UCOM_UNLOAD_DRAIN(uhso);
707
708static void
706uhso_free_softc(device_t dev, void *arg)
709uhso_free_softc(struct uhso_softc *sc)
707{
710{
708 struct uhso_softc *sc = arg;
709
710 if (ucom_unref(&sc->sc_super_ucom)) {
711 if (ucom_unref(&sc->sc_super_ucom)) {
711 if (mtx_initialized(&sc->sc_mtx))
712 mtx_destroy(&sc->sc_mtx);
713 device_free_softc(dev, sc);
712 mtx_destroy(&sc->sc_mtx);
713 device_free_softc(sc);
714 }
715}
716
717static void
718uhso_free(struct ucom_softc *ucom)
719{
714 }
715}
716
717static void
718uhso_free(struct ucom_softc *ucom)
719{
720 uhso_free_softc(NULL, ucom->sc_parent);
720 uhso_free_softc(ucom->sc_parent);
721}
722
723static void
724uhso_test_autoinst(void *arg, struct usb_device *udev,
725 struct usb_attach_arg *uaa)
726{
727 struct usb_interface *iface;
728 struct usb_interface_descriptor *id;

--- 1205 unchanged lines hidden ---
721}
722
723static void
724uhso_test_autoinst(void *arg, struct usb_device *udev,
725 struct usb_attach_arg *uaa)
726{
727 struct usb_interface *iface;
728 struct usb_interface_descriptor *id;

--- 1205 unchanged lines hidden ---