Deleted Added
full compact
if_uath.c (244503) if_uath.c (246565)
1/*-
2 * Copyright (c) 2006 Sam Leffler, Errno Consulting
3 * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

44 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
45 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
46 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
47 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
48 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
49 */
50
51#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2006 Sam Leffler, Errno Consulting
3 * Copyright (c) 2008-2009 Weongyo Jeong <weongyo@freebsd.org>
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

44 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
45 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
46 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
47 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
48 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
49 */
50
51#include <sys/cdefs.h>
52__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_uath.c 244503 2012-12-20 18:38:02Z hselasky $");
52__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_uath.c 246565 2013-02-08 21:15:47Z hselasky $");
53
54/*-
55 * Driver for Atheros AR5523 USB parts.
56 *
57 * The driver requires firmware to be loaded into the device. This
58 * is done on device discovery from a user application (uathload)
59 * that is launched by devd when a device with suitable product ID
60 * is recognized. Once firmware has been loaded the device will

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

353 /*
354 * Only post-firmware devices here.
355 */
356 mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK,
357 MTX_DEF);
358 callout_init(&sc->stat_ch, 0);
359 callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
360
53
54/*-
55 * Driver for Atheros AR5523 USB parts.
56 *
57 * The driver requires firmware to be loaded into the device. This
58 * is done on device discovery from a user application (uathload)
59 * that is launched by devd when a device with suitable product ID
60 * is recognized. Once firmware has been loaded the device will

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

353 /*
354 * Only post-firmware devices here.
355 */
356 mtx_init(&sc->sc_mtx, device_get_nameunit(sc->sc_dev), MTX_NETWORK_LOCK,
357 MTX_DEF);
358 callout_init(&sc->stat_ch, 0);
359 callout_init_mtx(&sc->watchdog_ch, &sc->sc_mtx, 0);
360
361 /*
362 * Allocate xfers for firmware commands.
363 */
364 error = uath_alloc_cmd_list(sc, sc->sc_cmd);
365 if (error != 0) {
366 device_printf(sc->sc_dev,
367 "could not allocate Tx command list\n");
368 goto fail;
369 }
370
371 error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
372 uath_usbconfig, UATH_N_XFERS, sc, &sc->sc_mtx);
373 if (error) {
374 device_printf(dev, "could not allocate USB transfers, "
375 "err=%s\n", usbd_errstr(error));
361 error = usbd_transfer_setup(uaa->device, &iface_index, sc->sc_xfer,
362 uath_usbconfig, UATH_N_XFERS, sc, &sc->sc_mtx);
363 if (error) {
364 device_printf(dev, "could not allocate USB transfers, "
365 "err=%s\n", usbd_errstr(error));
376 goto fail1;
366 goto fail;
377 }
378
379 sc->sc_cmd_dma_buf =
380 usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_INTR_TX], 0);
381 sc->sc_tx_dma_buf =
382 usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0);
383
384 /*
367 }
368
369 sc->sc_cmd_dma_buf =
370 usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_INTR_TX], 0);
371 sc->sc_tx_dma_buf =
372 usbd_xfer_get_frame_buffer(sc->sc_xfer[UATH_BULK_TX], 0);
373
374 /*
375 * Setup buffers for firmware commands.
376 */
377 error = uath_alloc_cmd_list(sc, sc->sc_cmd);
378 if (error != 0) {
379 device_printf(sc->sc_dev,
380 "could not allocate Tx command list\n");
381 goto fail1;
382 }
383
384 /*
385 * We're now ready to send+receive firmware commands.
386 */
387 UATH_LOCK(sc);
388 error = uath_host_available(sc);
389 if (error != 0) {
390 device_printf(sc->sc_dev, "could not initialize adapter\n");
391 goto fail3;
392 }

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

487
488 if (bootverbose)
489 ieee80211_announce(ic);
490
491 return (0);
492
493fail4: if_free(ifp);
494fail3: UATH_UNLOCK(sc);
385 * We're now ready to send+receive firmware commands.
386 */
387 UATH_LOCK(sc);
388 error = uath_host_available(sc);
389 if (error != 0) {
390 device_printf(sc->sc_dev, "could not initialize adapter\n");
391 goto fail3;
392 }

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

487
488 if (bootverbose)
489 ieee80211_announce(ic);
490
491 return (0);
492
493fail4: if_free(ifp);
494fail3: UATH_UNLOCK(sc);
495fail2: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS);
496fail1: uath_free_cmd_list(sc, sc->sc_cmd);
495fail2: uath_free_cmd_list(sc, sc->sc_cmd);
496fail1: usbd_transfer_unsetup(sc->sc_xfer, UATH_N_XFERS);
497fail:
498 return (error);
499}
500
501static int
502uath_detach(device_t dev)
503{
504 struct uath_softc *sc = device_get_softc(dev);

--- 2381 unchanged lines hidden ---
497fail:
498 return (error);
499}
500
501static int
502uath_detach(device_t dev)
503{
504 struct uath_softc *sc = device_get_softc(dev);

--- 2381 unchanged lines hidden ---