From owner-p4-projects@FreeBSD.ORG Mon Jul 31 17:00:46 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C6ABB16A533; Mon, 31 Jul 2006 17:00:45 +0000 (UTC) X-Original-To: perforce@FreeBSD.org Delivered-To: perforce@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 88D3516A530 for ; Mon, 31 Jul 2006 17:00:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5091543D45 for ; Mon, 31 Jul 2006 17:00:45 +0000 (GMT) (envelope-from hselasky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k6VH0jHw048732 for ; Mon, 31 Jul 2006 17:00:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k6VH0iCX048729 for perforce@freebsd.org; Mon, 31 Jul 2006 17:00:44 GMT (envelope-from hselasky@FreeBSD.org) Date: Mon, 31 Jul 2006 17:00:44 GMT Message-Id: <200607311700.k6VH0iCX048729@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky To: Perforce Change Reviews Cc: Subject: PERFORCE change 102863 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 Jul 2006 17:00:46 -0000 http://perforce.freebsd.org/chv.cgi?CH=102863 Change 102863 by hselasky@hselasky_mini_itx on 2006/07/31 17:00:40 Factorize "ural_cfg_sleep()" into "usbd_config_td_sleep()". Affected files ... .. //depot/projects/usb/src/sys/dev/usb/if_ural.c#6 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.c#11 edit .. //depot/projects/usb/src/sys/dev/usb/usb_subr.h#16 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/if_ural.c#6 (text+ko) ==== @@ -178,9 +178,6 @@ ural_newstate_cb(struct ieee80211com *ic, enum ieee80211_state nstate, int arg); static void -ural_cfg_sleep(struct ural_softc *sc, u_int32_t timeout); - -static void ural_tx_bcn_complete(struct ural_softc *sc); static void @@ -1917,23 +1914,6 @@ *========================================================================*/ static void -ural_cfg_sleep(struct ural_softc *sc, u_int32_t timeout) -{ - int error; - - if (timeout == 0) { - timeout = 1; - } - - error = msleep(sc, &(sc->sc_mtx), 0, - "ural delay sleep", timeout); - - usbd_config_td_check_gone(&(sc->sc_config_td)); - - return; -} - -static void ural_tx_bcn_complete(struct ural_softc *sc) { if (sc->sc_bcn_mbuf) { @@ -2107,7 +2087,7 @@ ural_cfg_read(sc, RAL_STA_CSR0); /* wait a little */ - ural_cfg_sleep(sc, hz/100); + usbd_config_td_sleep(&(sc->sc_config_td), hz/100); ural_cfg_disable_rf_tune(sc); } @@ -2489,7 +2469,7 @@ if (ural_cfg_bbp_read(sc, RAL_BBP_VERSION) != 0) { break; } - ural_cfg_sleep(sc, hz/100); + usbd_config_td_sleep(&(sc->sc_config_td), hz/100); } else { printf("%s: timeout waiting for BBP\n", sc->sc_name); @@ -2574,7 +2554,7 @@ (RAL_BBP_AWAKE | RAL_RF_AWAKE)) { break; } - ural_cfg_sleep(sc, hz/100); + usbd_config_td_sleep(&(sc->sc_config_td), hz/100); } else { printf("%s: timeout waiting for " "BBP/RF to wakeup\n", sc->sc_name); ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.c#11 (text+ko) ==== @@ -2612,3 +2612,29 @@ } return; } + +/*------------------------------------------------------------------------* + * usbd_config_td_sleep + * + * NOTE: this function can only be called from the config thread + *------------------------------------------------------------------------*/ +void +usbd_config_td_sleep(struct usbd_config_td *ctd, u_int32_t timeout) +{ + register int error; + + if (timeout == 0) { + /* zero means no timeout, + * so avoid that by setting + * timeout to one: + */ + timeout = 1; + } + + error = msleep(ctd, ctd->p_mtx, 0, + "config td sleep", timeout); + + usbd_config_td_check_gone(ctd); + + return; +} ==== //depot/projects/usb/src/sys/dev/usb/usb_subr.h#16 (text+ko) ==== @@ -772,6 +772,9 @@ void usbd_config_td_check_gone(struct usbd_config_td *ctd); +void +usbd_config_td_sleep(struct usbd_config_td *ctd, u_int32_t timeout); + /* routines from usb.c */ #if 0