mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-21 16:29:59 +00:00
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>
This commit is contained in:
parent
dbc5e6989e
commit
8c0b4351cc
2 changed files with 32 additions and 32 deletions
|
@ -172,25 +172,25 @@
|
||||||
|
|
||||||
/* The actual gptimer API */
|
/* The actual gptimer API */
|
||||||
|
|
||||||
void set_gptimer_pwidth(int timer_id, uint32_t width);
|
void set_gptimer_pwidth(unsigned int timer_id, uint32_t width);
|
||||||
uint32_t get_gptimer_pwidth(int timer_id);
|
uint32_t get_gptimer_pwidth(unsigned int timer_id);
|
||||||
void set_gptimer_period(int timer_id, uint32_t period);
|
void set_gptimer_period(unsigned int timer_id, uint32_t period);
|
||||||
uint32_t get_gptimer_period(int timer_id);
|
uint32_t get_gptimer_period(unsigned int timer_id);
|
||||||
uint32_t get_gptimer_count(int timer_id);
|
uint32_t get_gptimer_count(unsigned int timer_id);
|
||||||
int get_gptimer_intr(int timer_id);
|
int get_gptimer_intr(unsigned int timer_id);
|
||||||
void clear_gptimer_intr(int timer_id);
|
void clear_gptimer_intr(unsigned int timer_id);
|
||||||
int get_gptimer_over(int timer_id);
|
int get_gptimer_over(unsigned int timer_id);
|
||||||
void clear_gptimer_over(int timer_id);
|
void clear_gptimer_over(unsigned int timer_id);
|
||||||
void set_gptimer_config(int timer_id, uint16_t config);
|
void set_gptimer_config(unsigned int timer_id, uint16_t config);
|
||||||
uint16_t get_gptimer_config(int timer_id);
|
uint16_t get_gptimer_config(unsigned int timer_id);
|
||||||
int get_gptimer_run(int timer_id);
|
int get_gptimer_run(unsigned int timer_id);
|
||||||
void set_gptimer_pulse_hi(int timer_id);
|
void set_gptimer_pulse_hi(unsigned int timer_id);
|
||||||
void clear_gptimer_pulse_hi(int timer_id);
|
void clear_gptimer_pulse_hi(unsigned int timer_id);
|
||||||
void enable_gptimers(uint16_t mask);
|
void enable_gptimers(uint16_t mask);
|
||||||
void disable_gptimers(uint16_t mask);
|
void disable_gptimers(uint16_t mask);
|
||||||
void disable_gptimers_sync(uint16_t mask);
|
void disable_gptimers_sync(uint16_t mask);
|
||||||
uint16_t get_enabled_gptimers(void);
|
uint16_t get_enabled_gptimers(void);
|
||||||
uint32_t get_gptimer_status(int group);
|
uint32_t get_gptimer_status(unsigned int group);
|
||||||
void set_gptimer_status(int group, uint32_t value);
|
void set_gptimer_status(unsigned int group, uint32_t value);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -137,7 +137,7 @@ static uint32_t const timil_mask[MAX_BLACKFIN_GPTIMERS] =
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
void set_gptimer_pwidth(int timer_id, uint32_t value)
|
void set_gptimer_pwidth(unsigned int timer_id, uint32_t value)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->width = value;
|
timer_regs[timer_id]->width = value;
|
||||||
|
@ -145,14 +145,14 @@ void set_gptimer_pwidth(int timer_id, uint32_t value)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_pwidth);
|
EXPORT_SYMBOL(set_gptimer_pwidth);
|
||||||
|
|
||||||
uint32_t get_gptimer_pwidth(int timer_id)
|
uint32_t get_gptimer_pwidth(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->width;
|
return timer_regs[timer_id]->width;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_pwidth);
|
EXPORT_SYMBOL(get_gptimer_pwidth);
|
||||||
|
|
||||||
void set_gptimer_period(int timer_id, uint32_t period)
|
void set_gptimer_period(unsigned int timer_id, uint32_t period)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->period = period;
|
timer_regs[timer_id]->period = period;
|
||||||
|
@ -160,28 +160,28 @@ void set_gptimer_period(int timer_id, uint32_t period)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_period);
|
EXPORT_SYMBOL(set_gptimer_period);
|
||||||
|
|
||||||
uint32_t get_gptimer_period(int timer_id)
|
uint32_t get_gptimer_period(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->period;
|
return timer_regs[timer_id]->period;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_period);
|
EXPORT_SYMBOL(get_gptimer_period);
|
||||||
|
|
||||||
uint32_t get_gptimer_count(int timer_id)
|
uint32_t get_gptimer_count(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->counter;
|
return timer_regs[timer_id]->counter;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_count);
|
EXPORT_SYMBOL(get_gptimer_count);
|
||||||
|
|
||||||
uint32_t get_gptimer_status(int group)
|
uint32_t get_gptimer_status(unsigned int group)
|
||||||
{
|
{
|
||||||
tassert(group < BFIN_TIMER_NUM_GROUP);
|
tassert(group < BFIN_TIMER_NUM_GROUP);
|
||||||
return group_regs[group]->status;
|
return group_regs[group]->status;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_status);
|
EXPORT_SYMBOL(get_gptimer_status);
|
||||||
|
|
||||||
void set_gptimer_status(int group, uint32_t value)
|
void set_gptimer_status(unsigned int group, uint32_t value)
|
||||||
{
|
{
|
||||||
tassert(group < BFIN_TIMER_NUM_GROUP);
|
tassert(group < BFIN_TIMER_NUM_GROUP);
|
||||||
group_regs[group]->status = value;
|
group_regs[group]->status = value;
|
||||||
|
@ -189,42 +189,42 @@ void set_gptimer_status(int group, uint32_t value)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_status);
|
EXPORT_SYMBOL(set_gptimer_status);
|
||||||
|
|
||||||
int get_gptimer_intr(int timer_id)
|
int get_gptimer_intr(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]);
|
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & timil_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_intr);
|
EXPORT_SYMBOL(get_gptimer_intr);
|
||||||
|
|
||||||
void clear_gptimer_intr(int timer_id)
|
void clear_gptimer_intr(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id];
|
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = timil_mask[timer_id];
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clear_gptimer_intr);
|
EXPORT_SYMBOL(clear_gptimer_intr);
|
||||||
|
|
||||||
int get_gptimer_over(int timer_id)
|
int get_gptimer_over(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]);
|
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & tovf_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_over);
|
EXPORT_SYMBOL(get_gptimer_over);
|
||||||
|
|
||||||
void clear_gptimer_over(int timer_id)
|
void clear_gptimer_over(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id];
|
group_regs[BFIN_TIMER_OCTET(timer_id)]->status = tovf_mask[timer_id];
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(clear_gptimer_over);
|
EXPORT_SYMBOL(clear_gptimer_over);
|
||||||
|
|
||||||
int get_gptimer_run(int timer_id)
|
int get_gptimer_run(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]);
|
return !!(group_regs[BFIN_TIMER_OCTET(timer_id)]->status & trun_mask[timer_id]);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(get_gptimer_run);
|
EXPORT_SYMBOL(get_gptimer_run);
|
||||||
|
|
||||||
void set_gptimer_config(int timer_id, uint16_t config)
|
void set_gptimer_config(unsigned int timer_id, uint16_t config)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config = config;
|
timer_regs[timer_id]->config = config;
|
||||||
|
@ -232,7 +232,7 @@ void set_gptimer_config(int timer_id, uint16_t config)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_config);
|
EXPORT_SYMBOL(set_gptimer_config);
|
||||||
|
|
||||||
uint16_t get_gptimer_config(int timer_id)
|
uint16_t get_gptimer_config(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
return timer_regs[timer_id]->config;
|
return timer_regs[timer_id]->config;
|
||||||
|
@ -280,7 +280,7 @@ void disable_gptimers_sync(uint16_t mask)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(disable_gptimers_sync);
|
EXPORT_SYMBOL(disable_gptimers_sync);
|
||||||
|
|
||||||
void set_gptimer_pulse_hi(int timer_id)
|
void set_gptimer_pulse_hi(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config |= TIMER_PULSE_HI;
|
timer_regs[timer_id]->config |= TIMER_PULSE_HI;
|
||||||
|
@ -288,7 +288,7 @@ void set_gptimer_pulse_hi(int timer_id)
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL(set_gptimer_pulse_hi);
|
EXPORT_SYMBOL(set_gptimer_pulse_hi);
|
||||||
|
|
||||||
void clear_gptimer_pulse_hi(int timer_id)
|
void clear_gptimer_pulse_hi(unsigned int timer_id)
|
||||||
{
|
{
|
||||||
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
tassert(timer_id < MAX_BLACKFIN_GPTIMERS);
|
||||||
timer_regs[timer_id]->config &= ~TIMER_PULSE_HI;
|
timer_regs[timer_id]->config &= ~TIMER_PULSE_HI;
|
||||||
|
|
Loading…
Reference in a new issue