diff options
author | Mike Frysinger <vapier@gentoo.org> | 2009-11-15 02:35:22 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2009-12-15 00:15:30 -0500 |
commit | 8c0b4351ccec30e2926d0d0742ee1fa145f6e8e3 (patch) | |
tree | bc4bb49fdf2848824c59138f9c05c0b704f2117d /arch/blackfin | |
parent | dbc5e6989e2261c965bae5269d26ed1641e1534c (diff) |
Blackfin: gptimers: use unsigned timer/group ids
Since we always use these ids as unsigned values, and we have some assert
code to make sure they don't exceed a limit, avoid signed issues.
Reported-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'arch/blackfin')
-rw-r--r-- | arch/blackfin/include/asm/gptimers.h | 32 | ||||
-rw-r--r-- | arch/blackfin/kernel/gptimers.c | 32 |
2 files changed, 32 insertions, 32 deletions
diff --git a/arch/blackfin/include/asm/gptimers.h b/arch/blackfin/include/asm/gptimers.h index 89f08decb8e0..c722acdda0d3 100644 --- a/arch/blackfin/include/asm/gptimers.h +++ b/arch/blackfin/include/asm/gptimers.h | |||
@@ -172,25 +172,25 @@ | |||
172 | 172 | ||
173 | /* The actual gptimer API */ | 173 | /* The actual gptimer API */ |
174 | 174 | ||
175 | void set_gptimer_pwidth(int timer_id, uint32_t width); | 175 | void set_gptimer_pwidth(unsigned int timer_id, uint32_t width); |
176 | uint32_t get_gptimer_pwidth(int timer_id); | 176 | uint32_t get_gptimer_pwidth(unsigned int timer_id); |
177 | void set_gptimer_period(int timer_id, uint32_t period); | 177 | void set_gptimer_period(unsigned int timer_id, uint32_t period); |
178 | uint32_t get_gptimer_period(int timer_id); | 178 | uint32_t get_gptimer_period(unsigned int timer_id); |
179 | uint32_t get_gptimer_count(int timer_id); | 179 | uint32_t get_gptimer_count(unsigned int timer_id); |
180 | int get_gptimer_intr(int timer_id); | 180 | int get_gptimer_intr(unsigned int timer_id); |
181 | void clear_gptimer_intr(int timer_id); | 181 | void clear_gptimer_intr(unsigned int timer_id); |
182 | int get_gptimer_over(int timer_id); | 182 | int get_gptimer_over(unsigned int timer_id); |
183 | void clear_gptimer_over(int timer_id); | 183 | void clear_gptimer_over(unsigned int timer_id); |
184 | void set_gptimer_config(int timer_id, uint16_t config); | 184 | void set_gptimer_config(unsigned int timer_id, uint16_t config); |
185 | uint16_t get_gptimer_config(int timer_id); | 185 | uint16_t get_gptimer_config(unsigned int timer_id); |
186 | int get_gptimer_run(int timer_id); | 186 | int get_gptimer_run(unsigned int timer_id); |
187 | void set_gptimer_pulse_hi(int timer_id); | 187 | void set_gptimer_pulse_hi(unsigned int timer_id); |
188 | void clear_gptimer_pulse_hi(int timer_id); | 188 | void clear_gptimer_pulse_hi(unsigned int timer_id); |
189 | void enable_gptimers(uint16_t mask); | 189 | void enable_gptimers(uint16_t mask); |
190 | void disable_gptimers(uint16_t mask); | 190 | void disable_gptimers(uint16_t mask); |
191 | void disable_gptimers_sync(uint16_t mask); | 191 | void disable_gptimers_sync(uint16_t mask); |
192 | uint16_t get_enabled_gptimers(void); | 192 | uint16_t get_enabled_gptimers(void); |
193 | uint32_t get_gptimer_status(int group); | 193 | uint32_t get_gptimer_status(unsigned int group); |
194 | void set_gptimer_status(int group, uint32_t value); | 194 | void set_gptimer_status(unsigned int group, uint32_t value); |
195 | 195 | ||
196 | #endif | 196 | #endif |
diff --git a/arch/blackfin/kernel/gptimers.c b/arch/blackfin/kernel/gptimers.c index 7281a91d26b5..cdbe075de1dc 100644 --- a/arch/blackfin/kernel/gptimers.c +++ b/arch/blackfin/kernel/gptimers.c | |||
@@ -137,7 +137,7 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] = | |||
137 | #endif | 137 | #endif |
138 | }; | 138 | }; |
139 | 139 | ||
140 | void set_gptimer_pwidth(int timer_id, uint32_t value) | 140 | void set_gptimer_pwidth(unsigned int timer_id, uint32_t value) |
141 | { | 141 | { |
142 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 142 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
143 | timer_regs[timer_id]->width = value; | 143 | timer_regs[timer_id]->width = value; |
@@ -145,14 +145,14 @@ void set_gptimer_pwidth(int timer_id, uint32_t value) | |||
145 | } | 145 | } |
146 | EXPORT_SYMBOL(set_gptimer_pwidth); | 146 | EXPORT_SYMBOL(set_gptimer_pwidth); |
147 | 147 | ||
148 | uint32_t get_gptimer_pwidth(int timer_id) | 148 | uint32_t get_gptimer_pwidth(unsigned int timer_id) |
149 | { | 149 | { |
150 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 150 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
151 | return timer_regs[timer_id]->width; | 151 | return timer_regs[timer_id]->width; |
152 | } | 152 | } |
153 | EXPORT_SYMBOL(get_gptimer_pwidth); | 153 | EXPORT_SYMBOL(get_gptimer_pwidth); |
154 | 154 | ||
155 | void set_gptimer_period(int timer_id, uint32_t period) | 155 | void set_gptimer_period(unsigned int timer_id, uint32_t period) |
156 | { | 156 | { |
157 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 157 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
158 | timer_regs[timer_id]->period = period; | 158 | timer_regs[timer_id]->period = period; |
@@ -160,28 +160,28 @@ void set_gptimer_period(int timer_id, uint32_t period) | |||
160 | } | 160 | } |
161 | EXPORT_SYMBOL(set_gptimer_period); | 161 | EXPORT_SYMBOL(set_gptimer_period); |
162 | 162 | ||
163 | uint32_t get_gptimer_period(int timer_id) | 163 | uint32_t get_gptimer_period(unsigned int timer_id) |
164 | { | 164 | { |
165 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 165 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
166 | return timer_regs[timer_id]->period; | 166 | return timer_regs[timer_id]->period; |
167 | } | 167 | } |
168 | EXPORT_SYMBOL(get_gptimer_period); | 168 | EXPORT_SYMBOL(get_gptimer_period); |
169 | 169 | ||
170 | uint32_t get_gptimer_count(int timer_id) | 170 | uint32_t get_gptimer_count(unsigned int timer_id) |
171 | { | 171 | { |
172 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 172 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
173 | return timer_regs[timer_id]->counter; | 173 | return timer_regs[timer_id]->counter; |
174 | } | 174 | } |
175 | EXPORT_SYMBOL(get_gptimer_count); | 175 | EXPORT_SYMBOL(get_gptimer_count); |
176 | 176 | ||
177 | uint32_t get_gptimer_status(int group) | 177 | uint32_t get_gptimer_status(unsigned int group) |
178 | { | 178 | { |
179 | tassert(group < BFIN_TIMER_NUM_GROUP); | 179 | tassert(group < BFIN_TIMER_NUM_GROUP); |
180 | return group_regs[group]->status; | 180 | return group_regs[group]->status; |
181 | } | 181 | } |
182 | EXPORT_SYMBOL(get_gptimer_status); | 182 | EXPORT_SYMBOL(get_gptimer_status); |
183 | 183 | ||
184 | void set_gptimer_status(int group, uint32_t value) | 184 | void set_gptimer_status(unsigned int group, uint32_t value) |
185 | { | 185 | { |
186 | tassert(group < BFIN_TIMER_NUM_GROUP); | 186 | tassert(group < BFIN_TIMER_NUM_GROUP); |
187 | group_regs[group]->status = value; | 187 | group_regs[group]->status = value; |
@@ -189,42 +189,42 @@ void set_gptimer_status(int group, uint32_t value) | |||
189 | } | 189 | } |
190 | EXPORT_SYMBOL(set_gptimer_status); | 190 | EXPORT_SYMBOL(set_gptimer_status); |
191 | 191 | ||
192 | int get_gptimer_intr(int timer_id) | 192 | int get_gptimer_intr(unsigned int timer_id) |
193 | { | 193 | { |
194 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 194 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
195 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]); | 195 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]); |
196 | } | 196 | } |
197 | EXPORT_SYMBOL(get_gptimer_intr); | 197 | EXPORT_SYMBOL(get_gptimer_intr); |
198 | 198 | ||
199 | void clear_gptimer_intr(int timer_id) | 199 | void clear_gptimer_intr(unsigned int timer_id) |
200 | { | 200 | { |
201 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 201 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
202 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id]; | 202 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id]; |
203 | } | 203 | } |
204 | EXPORT_SYMBOL(clear_gptimer_intr); | 204 | EXPORT_SYMBOL(clear_gptimer_intr); |
205 | 205 | ||
206 | int get_gptimer_over(int timer_id) | 206 | int get_gptimer_over(unsigned int timer_id) |
207 | { | 207 | { |
208 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 208 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
209 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]); | 209 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]); |
210 | } | 210 | } |
211 | EXPORT_SYMBOL(get_gptimer_over); | 211 | EXPORT_SYMBOL(get_gptimer_over); |
212 | 212 | ||
213 | void clear_gptimer_over(int timer_id) | 213 | void clear_gptimer_over(unsigned int timer_id) |
214 | { | 214 | { |
215 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 215 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
216 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id]; | 216 | group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id]; |
217 | } | 217 | } |
218 | EXPORT_SYMBOL(clear_gptimer_over); | 218 | EXPORT_SYMBOL(clear_gptimer_over); |
219 | 219 | ||
220 | int get_gptimer_run(int timer_id) | 220 | int get_gptimer_run(unsigned int timer_id) |
221 | { | 221 | { |
222 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 222 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
223 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]); | 223 | return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]); |
224 | } | 224 | } |
225 | EXPORT_SYMBOL(get_gptimer_run); | 225 | EXPORT_SYMBOL(get_gptimer_run); |
226 | 226 | ||
227 | void set_gptimer_config(int timer_id, uint16_t config) | 227 | void set_gptimer_config(unsigned int timer_id, uint16_t config) |
228 | { | 228 | { |
229 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 229 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
230 | timer_regs[timer_id]->config = config; | 230 | timer_regs[timer_id]->config = config; |
@@ -232,7 +232,7 @@ void set_gptimer_config(int timer_id, uint16_t config) | |||
232 | } | 232 | } |
233 | EXPORT_SYMBOL(set_gptimer_config); | 233 | EXPORT_SYMBOL(set_gptimer_config); |
234 | 234 | ||
235 | uint16_t get_gptimer_config(int timer_id) | 235 | uint16_t get_gptimer_config(unsigned int timer_id) |
236 | { | 236 | { |
237 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 237 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
238 | return timer_regs[timer_id]->config; | 238 | return timer_regs[timer_id]->config; |
@@ -280,7 +280,7 @@ void disable_gptimers_sync(uint16_t mask) | |||
280 | } | 280 | } |
281 | EXPORT_SYMBOL(disable_gptimers_sync); | 281 | EXPORT_SYMBOL(disable_gptimers_sync); |
282 | 282 | ||
283 | void set_gptimer_pulse_hi(int timer_id) | 283 | void set_gptimer_pulse_hi(unsigned int timer_id) |
284 | { | 284 | { |
285 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 285 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
286 | timer_regs[timer_id]->config |= TIMER_PULSE_HI; | 286 | timer_regs[timer_id]->config |= TIMER_PULSE_HI; |
@@ -288,7 +288,7 @@ void set_gptimer_pulse_hi(int timer_id) | |||
288 | } | 288 | } |
289 | EXPORT_SYMBOL(set_gptimer_pulse_hi); | 289 | EXPORT_SYMBOL(set_gptimer_pulse_hi); |
290 | 290 | ||
291 | void clear_gptimer_pulse_hi(int timer_id) | 291 | void clear_gptimer_pulse_hi(unsigned int timer_id) |
292 | { | 292 | { |
293 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); | 293 | tassert(timer_id < MAX_BLACKFIN_GPTIMERS); |
294 | timer_regs[timer_id]->config &= ~TIMER_PULSE_HI; | 294 | timer_regs[timer_id]->config &= ~TIMER_PULSE_HI; |