diff options
author | Ivo van Doorn <ivdoorn@gmail.com> | 2008-01-06 17:41:45 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:09:27 -0500 |
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 a11421274f79..b26c634f210b 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) | |||
103 | } | 103 | } |
104 | 104 | ||
105 | /* | 105 | /* |
106 | * Ring initialization | ||
107 | */ | ||
108 | static void rt2x00lib_init_rxrings(struct rt2x00_dev *rt2x00dev) | ||
109 | { | ||
110 | struct data_ring *ring = rt2x00dev->rx; | ||
111 | unsigned int i; | ||
112 | |||
113 | if (!rt2x00dev->ops->lib->init_rxentry) | ||
114 | return; | ||
115 | |||
116 | if (ring->data_addr) | ||
117 | memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); | ||
118 | |||
119 | for (i = 0; i < ring->stats.limit; i++) | ||
120 | rt2x00dev->ops->lib->init_rxentry(rt2x00dev, &ring->entry[i]); | ||
121 | |||
122 | rt2x00_ring_index_clear(ring); | ||
123 | } | ||
124 | |||
125 | static void rt2x00lib_init_txrings(struct rt2x00_dev *rt2x00dev) | ||
126 | { | ||
127 | struct data_ring *ring; | ||
128 | unsigned int i; | ||
129 | |||
130 | if (!rt2x00dev->ops->lib->init_txentry) | ||
131 | return; | ||
132 | |||
133 | txringall_for_each(rt2x00dev, ring) { | ||
134 | if (ring->data_addr) | ||
135 | memset(ring->data_addr, 0, rt2x00_get_ring_size(ring)); | ||
136 | |||
137 | for (i = 0; i < ring->stats.limit; i++) | ||
138 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, | ||
139 | &ring->entry[i]); | ||
140 | |||
141 | rt2x00_ring_index_clear(ring); | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /* | ||
106 | * Radio control handlers. | 146 | * Radio control handlers. |
107 | */ | 147 | */ |
108 | int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | 148 | int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) |
@@ -118,6 +158,12 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
118 | return 0; | 158 | return 0; |
119 | 159 | ||
120 | /* | 160 | /* |
161 | * Initialize all data rings. | ||
162 | */ | ||
163 | rt2x00lib_init_rxrings(rt2x00dev); | ||
164 | rt2x00lib_init_txrings(rt2x00dev); | ||
165 | |||
166 | /* | ||
121 | * Enable radio. | 167 | * Enable radio. |
122 | */ | 168 | */ |
123 | status = rt2x00dev->ops->lib->set_device_state(rt2x00dev, | 169 | status = rt2x00dev->ops->lib->set_device_state(rt2x00dev, |