diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-01-06 23:41:45 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 15:09:27 -0800 |
commit | 837e7f247a8ed3f5577462655f8099a81b360422 (patch) | |
tree | abf59b6ac3a0c27ad80dc282e9465c30eeb9fb55 /drivers/net/wireless/rt2x00/rt2x00dev.c | |
parent | 7e56d38d5d0bda89228821902af297a46b5fdb80 (diff) |
rt2x00: Move init_txring and init_rxring into rt2x00lib
Prior to enabling the radio rt2x00lib should go through all
rings and for each entry should call the callback function
init_txentry() and init_rxentry().
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index a11421274f7..b26c634f210 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c @@ -103,6 +103,46 @@ void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) } /* + * Ring initialization + */ +static void rt2x00lib_init_rxrings(struct rt2x00_dev *rt2x00dev) +{ + struct data_ring *ring = rt2x00dev->rx; + unsigned int i; + + if (!rt2x00dev->ops->lib->init_rxentry) + return; + + if (ring->data_addr) + memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); + + for (i = 0; i < ring->stats.limit; i++) + rt2x00dev->ops->lib->init_rxentry(rt2x00dev, &ring->entry[i]); + + rt2x00_ring_index_clear(ring); +} + +static void rt2x00lib_init_txrings(struct rt2x00_dev *rt2x00dev) +{ + struct data_ring *ring; + unsigned int i; + + if (!rt2x00dev->ops->lib->init_txentry) + return; + + txringall_for_each(rt2x00dev, ring) { + if (ring->data_addr) + memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); + + for (i = 0; i < ring->stats.limit; i++) + rt2x00dev->ops->lib->init_txentry(rt2x00dev, + &ring->entry[i]); + + rt2x00_ring_index_clear(ring); + } +} + +/* * Radio control handlers. */ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) @@ -118,6 +158,12 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) return 0; /* + * Initialize all data rings. + */ + rt2x00lib_init_rxrings(rt2x00dev); + rt2x00lib_init_txrings(rt2x00dev); + + /* * Enable radio. */ status = rt2x00dev->ops->lib->set_device_state(rt2x00dev, |