aboutsummaryrefslogtreecommitdiffstats
path: root/arch/blackfin
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2009-11-15 02:35:22 -0500
committerMike Frysinger <vapier@gentoo.org>2009-12-15 00:15:30 -0500
commit8c0b4351ccec30e2926d0d0742ee1fa145f6e8e3 (patch)
treebc4bb49fdf2848824c59138f9c05c0b704f2117d /arch/blackfin
parentdbc5e6989e2261c965bae5269d26ed1641e1534c (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.h32
-rw-r--r--arch/blackfin/kernel/gptimers.c32
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
175void set_gptimer_pwidth(int timer_id, uint32_t width); 175void set_gptimer_pwidth(unsigned int timer_id, uint32_t width);
176uint32_t get_gptimer_pwidth(int timer_id); 176uint32_t get_gptimer_pwidth(unsigned int timer_id);
177void set_gptimer_period(int timer_id, uint32_t period); 177void set_gptimer_period(unsigned int timer_id, uint32_t period);
178uint32_t get_gptimer_period(int timer_id); 178uint32_t get_gptimer_period(unsigned int timer_id);
179uint32_t get_gptimer_count(int timer_id); 179uint32_t get_gptimer_count(unsigned int timer_id);
180int get_gptimer_intr(int timer_id); 180int get_gptimer_intr(unsigned int timer_id);
181void clear_gptimer_intr(int timer_id); 181void clear_gptimer_intr(unsigned int timer_id);
182int get_gptimer_over(int timer_id); 182int get_gptimer_over(unsigned int timer_id);
183void clear_gptimer_over(int timer_id); 183void clear_gptimer_over(unsigned int timer_id);
184void set_gptimer_config(int timer_id, uint16_t config); 184void set_gptimer_config(unsigned int timer_id, uint16_t config);
185uint16_t get_gptimer_config(int timer_id); 185uint16_t get_gptimer_config(unsigned int timer_id);
186int get_gptimer_run(int timer_id); 186int get_gptimer_run(unsigned int timer_id);
187void set_gptimer_pulse_hi(int timer_id); 187void set_gptimer_pulse_hi(unsigned int timer_id);
188void clear_gptimer_pulse_hi(int timer_id); 188void clear_gptimer_pulse_hi(unsigned int timer_id);
189void enable_gptimers(uint16_t mask); 189void enable_gptimers(uint16_t mask);
190void disable_gptimers(uint16_t mask); 190void disable_gptimers(uint16_t mask);
191void disable_gptimers_sync(uint16_t mask); 191void disable_gptimers_sync(uint16_t mask);
192uint16_t get_enabled_gptimers(void); 192uint16_t get_enabled_gptimers(void);
193uint32_t get_gptimer_status(int group); 193uint32_t get_gptimer_status(unsigned int group);
194void set_gptimer_status(int group, uint32_t value); 194void 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
140void set_gptimer_pwidth(int timer_id, uint32_t value) 140void 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}
146EXPORT_SYMBOL(set_gptimer_pwidth); 146EXPORT_SYMBOL(set_gptimer_pwidth);
147 147
148uint32_t get_gptimer_pwidth(int timer_id) 148uint32_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}
153EXPORT_SYMBOL(get_gptimer_pwidth); 153EXPORT_SYMBOL(get_gptimer_pwidth);
154 154
155void set_gptimer_period(int timer_id, uint32_t period) 155void 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}
161EXPORT_SYMBOL(set_gptimer_period); 161EXPORT_SYMBOL(set_gptimer_period);
162 162
163uint32_t get_gptimer_period(int timer_id) 163uint32_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}
168EXPORT_SYMBOL(get_gptimer_period); 168EXPORT_SYMBOL(get_gptimer_period);
169 169
170uint32_t get_gptimer_count(int timer_id) 170uint32_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}
175EXPORT_SYMBOL(get_gptimer_count); 175EXPORT_SYMBOL(get_gptimer_count);
176 176
177uint32_t get_gptimer_status(int group) 177uint32_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}
182EXPORT_SYMBOL(get_gptimer_status); 182EXPORT_SYMBOL(get_gptimer_status);
183 183
184void set_gptimer_status(int group, uint32_t value) 184void 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}
190EXPORT_SYMBOL(set_gptimer_status); 190EXPORT_SYMBOL(set_gptimer_status);
191 191
192int get_gptimer_intr(int timer_id) 192int 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}
197EXPORT_SYMBOL(get_gptimer_intr); 197EXPORT_SYMBOL(get_gptimer_intr);
198 198
199void clear_gptimer_intr(int timer_id) 199void 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}
204EXPORT_SYMBOL(clear_gptimer_intr); 204EXPORT_SYMBOL(clear_gptimer_intr);
205 205
206int get_gptimer_over(int timer_id) 206int 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}
211EXPORT_SYMBOL(get_gptimer_over); 211EXPORT_SYMBOL(get_gptimer_over);
212 212
213void clear_gptimer_over(int timer_id) 213void 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}
218EXPORT_SYMBOL(clear_gptimer_over); 218EXPORT_SYMBOL(clear_gptimer_over);
219 219
220int get_gptimer_run(int timer_id) 220int 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}
225EXPORT_SYMBOL(get_gptimer_run); 225EXPORT_SYMBOL(get_gptimer_run);
226 226
227void set_gptimer_config(int timer_id, uint16_t config) 227void 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}
233EXPORT_SYMBOL(set_gptimer_config); 233EXPORT_SYMBOL(set_gptimer_config);
234 234
235uint16_t get_gptimer_config(int timer_id) 235uint16_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}
281EXPORT_SYMBOL(disable_gptimers_sync); 281EXPORT_SYMBOL(disable_gptimers_sync);
282 282
283void set_gptimer_pulse_hi(int timer_id) 283void 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}
289EXPORT_SYMBOL(set_gptimer_pulse_hi); 289EXPORT_SYMBOL(set_gptimer_pulse_hi);
290 290
291void clear_gptimer_pulse_hi(int timer_id) 291void 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;