[RFC v4 14/22] clockevents: clockevents_program_event(): turn clc into unsigned long

From: Nicolai Stange
Date: Mon Aug 22 2016 - 19:35:59 EST


Right now, being of type unsigned long long, the clc local variable in
clockevents_program_event() is unnecessarily wide as it gets cast to
unsigned long anyway.

Degrade clc's type to unsigned long and remove the now superfluous casts.

Signed-off-by: Nicolai Stange <nicstange@xxxxxxxxx>
---
kernel/time/clockevents.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 7832050..8fddb67 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -311,7 +311,7 @@ static int clockevents_program_min_delta(struct clock_event_device *dev)
int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
bool force)
{
- unsigned long long clc;
+ unsigned long clc;
int64_t delta;
int rc;

@@ -337,11 +337,12 @@ int clockevents_program_event(struct clock_event_device *dev, ktime_t expires,
if (delta <= 0)
return force ? clockevents_program_min_delta(dev) : -ETIME;

- clc = ((unsigned long long) delta * dev->mult) >> dev->shift;
- clc = min_t(unsigned long, clc, dev->max_delta_ticks);
- clc = max_t(unsigned long, clc, dev->min_delta_ticks_adjusted);
+ clc = (unsigned long)(((unsigned long long)delta *
+ dev->mult) >> dev->shift);
+ clc = min(clc, dev->max_delta_ticks);
+ clc = max(clc, dev->min_delta_ticks_adjusted);

- rc = dev->set_next_event((unsigned long) clc, dev);
+ rc = dev->set_next_event(clc, dev);

return (rc && force) ? clockevents_program_min_delta(dev) : rc;
}
--
2.9.2