if_run.c (245047) | if_run.c (246614) |
---|---|
1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2008,2010 Damien Bergamini <damien.bergamini@free.fr> 3 * ported to FreeBSD by Akinori Furukoshi <moonlightakkiy@yahoo.ca> 4 * USB Consulting, Hans Petter Selasky <hselasky@freebsd.org> 5 * 6 * Permission to use, copy, modify, and distribute this software for any 7 * purpose with or without fee is hereby granted, provided that the above 8 * copyright notice and this permission notice appear in all copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19#include <sys/cdefs.h> |
20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 245047 2013-01-04 20:44:17Z hselasky $"); | 20__FBSDID("$FreeBSD: head/sys/dev/usb/wlan/if_run.c 246614 2013-02-10 10:36:16Z hselasky $"); |
21 22/*- 23 * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver. 24 * http://www.ralinktech.com/ 25 */ 26 27#include <sys/param.h> 28#include <sys/sockio.h> --- 682 unchanged lines hidden (view full) --- 711static int 712run_detach(device_t self) 713{ 714 struct run_softc *sc = device_get_softc(self); 715 struct ifnet *ifp = sc->sc_ifp; 716 struct ieee80211com *ic; 717 int i; 718 | 21 22/*- 23 * Ralink Technology RT2700U/RT2800U/RT3000U chipset driver. 24 * http://www.ralinktech.com/ 25 */ 26 27#include <sys/param.h> 28#include <sys/sockio.h> --- 682 unchanged lines hidden (view full) --- 711static int 712run_detach(device_t self) 713{ 714 struct run_softc *sc = device_get_softc(self); 715 struct ifnet *ifp = sc->sc_ifp; 716 struct ieee80211com *ic; 717 int i; 718 |
719 RUN_LOCK(sc); 720 sc->sc_detached = 1; 721 RUN_UNLOCK(sc); 722 |
|
719 /* stop all USB transfers */ 720 usbd_transfer_unsetup(sc->sc_xfer, RUN_N_XFER); 721 722 RUN_LOCK(sc); | 723 /* stop all USB transfers */ 724 usbd_transfer_unsetup(sc->sc_xfer, RUN_N_XFER); 725 726 RUN_LOCK(sc); |
723 | |
724 sc->ratectl_run = RUN_RATECTL_OFF; 725 sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; 726 727 /* free TX list, if any */ 728 for (i = 0; i != RUN_EP_QUEUES; i++) 729 run_unsetup_tx_list(sc, &sc->sc_epq[i]); 730 RUN_UNLOCK(sc); 731 --- 2704 unchanged lines hidden (view full) --- 3436 3437static int 3438run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 3439{ 3440 struct run_softc *sc = ifp->if_softc; 3441 struct ieee80211com *ic = sc->sc_ifp->if_l2com; 3442 struct ifreq *ifr = (struct ifreq *) data; 3443 int startall = 0; | 727 sc->ratectl_run = RUN_RATECTL_OFF; 728 sc->cmdq_run = sc->cmdq_key_set = RUN_CMDQ_ABORT; 729 730 /* free TX list, if any */ 731 for (i = 0; i != RUN_EP_QUEUES; i++) 732 run_unsetup_tx_list(sc, &sc->sc_epq[i]); 733 RUN_UNLOCK(sc); 734 --- 2704 unchanged lines hidden (view full) --- 3439 3440static int 3441run_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) 3442{ 3443 struct run_softc *sc = ifp->if_softc; 3444 struct ieee80211com *ic = sc->sc_ifp->if_l2com; 3445 struct ifreq *ifr = (struct ifreq *) data; 3446 int startall = 0; |
3444 int error = 0; | 3447 int error; |
3445 | 3448 |
3449 RUN_LOCK(sc); 3450 error = sc->sc_detached ? ENXIO : 0; 3451 RUN_UNLOCK(sc); 3452 if (error) 3453 return (error); 3454 |
|
3446 switch (cmd) { 3447 case SIOCSIFFLAGS: 3448 RUN_LOCK(sc); 3449 if (ifp->if_flags & IFF_UP) { 3450 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)){ 3451 startall = 1; 3452 run_init_locked(sc); 3453 } else --- 1504 unchanged lines hidden (view full) --- 4958 &sc->sc_mtx : NULL, USB_MS_TO_TICKS(ms)); 4959} 4960 4961static device_method_t run_methods[] = { 4962 /* Device interface */ 4963 DEVMETHOD(device_probe, run_match), 4964 DEVMETHOD(device_attach, run_attach), 4965 DEVMETHOD(device_detach, run_detach), | 3455 switch (cmd) { 3456 case SIOCSIFFLAGS: 3457 RUN_LOCK(sc); 3458 if (ifp->if_flags & IFF_UP) { 3459 if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)){ 3460 startall = 1; 3461 run_init_locked(sc); 3462 } else --- 1504 unchanged lines hidden (view full) --- 4967 &sc->sc_mtx : NULL, USB_MS_TO_TICKS(ms)); 4968} 4969 4970static device_method_t run_methods[] = { 4971 /* Device interface */ 4972 DEVMETHOD(device_probe, run_match), 4973 DEVMETHOD(device_attach, run_attach), 4974 DEVMETHOD(device_detach, run_detach), |
4966 4967 { 0, 0 } | 4975 DEVMETHOD_END |
4968}; 4969 4970static driver_t run_driver = { 4971 .name = "run", 4972 .methods = run_methods, 4973 .size = sizeof(struct run_softc) 4974}; 4975 4976static devclass_t run_devclass; 4977 4978DRIVER_MODULE(run, uhub, run_driver, run_devclass, NULL, 0); 4979MODULE_DEPEND(run, wlan, 1, 1, 1); 4980MODULE_DEPEND(run, usb, 1, 1, 1); 4981MODULE_DEPEND(run, firmware, 1, 1, 1); 4982MODULE_VERSION(run, 1); | 4976}; 4977 4978static driver_t run_driver = { 4979 .name = "run", 4980 .methods = run_methods, 4981 .size = sizeof(struct run_softc) 4982}; 4983 4984static devclass_t run_devclass; 4985 4986DRIVER_MODULE(run, uhub, run_driver, run_devclass, NULL, 0); 4987MODULE_DEPEND(run, wlan, 1, 1, 1); 4988MODULE_DEPEND(run, usb, 1, 1, 1); 4989MODULE_DEPEND(run, firmware, 1, 1, 1); 4990MODULE_VERSION(run, 1); |