aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/ath9k/rc.c
diff options
context:
space:
mode:
authorSujith <Sujith.Manoharan@atheros.com>2008-11-17 22:33:36 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-11-26 09:47:22 -0500
commitfe60594a76d04b4fdea597bf93e4186a03d8d60c (patch)
tree4ad672387a27a51fda0a16a43b37b9543abff0e1 /drivers/net/wireless/ath9k/rc.c
parent256b77593f3ec07f58cd1f0d573ffe9ccd941b5b (diff)
ath9k: Simplify RC alloc/free functions
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/ath9k/rc.c')
-rw-r--r--drivers/net/wireless/ath9k/rc.c48
1 files changed, 7 insertions, 41 deletions
diff --git a/drivers/net/wireless/ath9k/rc.c b/drivers/net/wireless/ath9k/rc.c
index 21116c51758..09d622ab313 100644
--- a/drivers/net/wireless/ath9k/rc.c
+++ b/drivers/net/wireless/ath9k/rc.c
@@ -780,29 +780,6 @@ struct ath_rate_softc *ath_rate_attach(struct ath_hal *ah)
780 return asc; 780 return asc;
781} 781}
782 782
783static struct ath_rate_node *ath_rate_node_alloc(struct ath_vap *avp,
784 struct ath_rate_softc *rsc,
785 gfp_t gfp)
786{
787 struct ath_rate_node *anode;
788
789 anode = kzalloc(sizeof(struct ath_rate_node), gfp);
790 if (anode == NULL)
791 return NULL;
792
793 anode->avp = avp;
794 anode->asc = rsc;
795 avp->rc_node = anode;
796
797 return anode;
798}
799
800static void ath_rate_node_free(struct ath_rate_node *anode)
801{
802 if (anode != NULL)
803 kfree(anode);
804}
805
806void ath_rate_detach(struct ath_rate_softc *asc) 783void ath_rate_detach(struct ath_rate_softc *asc)
807{ 784{
808 if (asc != NULL) 785 if (asc != NULL)
@@ -1778,17 +1755,6 @@ static int ath_rate_newassoc(struct ath_softc *sc,
1778 return 0; 1755 return 0;
1779} 1756}
1780 1757
1781/*
1782 * This routine is called to initialize the rate control parameters
1783 * in the SIB. It is called initially during system initialization
1784 * or when a station is associated with the AP.
1785 */
1786static void ath_rc_sib_init(struct ath_rate_node *ath_rc_priv)
1787{
1788 ath_rc_priv->rssi_down_time = jiffies_to_msecs(jiffies);
1789}
1790
1791
1792static void ath_setup_rates(struct ath_softc *sc, 1758static void ath_setup_rates(struct ath_softc *sc,
1793 struct ieee80211_supported_band *sband, 1759 struct ieee80211_supported_band *sband,
1794 struct ieee80211_sta *sta, 1760 struct ieee80211_sta *sta,
@@ -1964,21 +1930,23 @@ static void *ath_rate_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp
1964 struct ath_vap *avp; 1930 struct ath_vap *avp;
1965 struct ath_rate_node *rate_priv; 1931 struct ath_rate_node *rate_priv;
1966 1932
1967 DPRINTF(sc, ATH_DBG_RATE, "%s\n", __func__);
1968
1969 vif = sc->sc_vaps[0]; 1933 vif = sc->sc_vaps[0];
1970 ASSERT(vif); 1934 ASSERT(vif);
1971 1935
1972 avp = (void *)vif->drv_priv; 1936 avp = (void *)vif->drv_priv;
1973 1937
1974 rate_priv = ath_rate_node_alloc(avp, sc->sc_rc, gfp); 1938 rate_priv = kzalloc(sizeof(struct ath_rate_node), gfp);
1975 if (!rate_priv) { 1939 if (!rate_priv) {
1976 DPRINTF(sc, ATH_DBG_FATAL, 1940 DPRINTF(sc, ATH_DBG_FATAL,
1977 "%s: Unable to allocate private rc structure\n", 1941 "%s: Unable to allocate private rc structure\n",
1978 __func__); 1942 __func__);
1979 return NULL; 1943 return NULL;
1980 } 1944 }
1981 ath_rc_sib_init(rate_priv); 1945
1946 rate_priv->avp = avp;
1947 rate_priv->asc = sc->sc_rc;
1948 avp->rc_node = rate_priv;
1949 rate_priv->rssi_down_time = jiffies_to_msecs(jiffies);
1982 1950
1983 return rate_priv; 1951 return rate_priv;
1984} 1952}
@@ -1987,10 +1955,8 @@ static void ath_rate_free_sta(void *priv, struct ieee80211_sta *sta,
1987 void *priv_sta) 1955 void *priv_sta)
1988{ 1956{
1989 struct ath_rate_node *rate_priv = priv_sta; 1957 struct ath_rate_node *rate_priv = priv_sta;
1990 struct ath_softc *sc = priv;
1991 1958
1992 DPRINTF(sc, ATH_DBG_RATE, "%s", __func__); 1959 kfree(rate_priv);
1993 ath_rate_node_free(rate_priv);
1994} 1960}
1995 1961
1996static struct rate_control_ops ath_rate_ops = { 1962static struct rate_control_ops ath_rate_ops = {