Commit 147cd165 authored by Dae S. Kim's avatar Dae S. Kim Committed by Greg Kroah-Hartman

Staging: android: Alarm driver cleanups

Little cleanups. Enum value ANDROID_ALARM_TYPE_COUNT was treated as
an alarm type within a switch statement. That condition was unreachable
though.
Signed-off-by: default avatarDae S. Kim <dae@velatum.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7ee34ab2
...@@ -67,10 +67,8 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT]; ...@@ -67,10 +67,8 @@ static struct devalarm alarms[ANDROID_ALARM_TYPE_COUNT];
static int is_wakeup(enum android_alarm_type type) static int is_wakeup(enum android_alarm_type type)
{ {
if (type == ANDROID_ALARM_RTC_WAKEUP || return (type == ANDROID_ALARM_RTC_WAKEUP ||
type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP) type == ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP);
return 1;
return 0;
} }
...@@ -85,12 +83,9 @@ static void devalarm_start(struct devalarm *alrm, ktime_t exp) ...@@ -85,12 +83,9 @@ static void devalarm_start(struct devalarm *alrm, ktime_t exp)
static int devalarm_try_to_cancel(struct devalarm *alrm) static int devalarm_try_to_cancel(struct devalarm *alrm)
{ {
int ret;
if (is_wakeup(alrm->type)) if (is_wakeup(alrm->type))
ret = alarm_try_to_cancel(&alrm->u.alrm); return alarm_try_to_cancel(&alrm->u.alrm);
else return hrtimer_try_to_cancel(&alrm->u.hrt);
ret = hrtimer_try_to_cancel(&alrm->u.hrt);
return ret;
} }
static void devalarm_cancel(struct devalarm *alrm) static void devalarm_cancel(struct devalarm *alrm)
...@@ -223,10 +218,12 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -223,10 +218,12 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case ANDROID_ALARM_ELAPSED_REALTIME: case ANDROID_ALARM_ELAPSED_REALTIME:
get_monotonic_boottime(&tmp_time); get_monotonic_boottime(&tmp_time);
break; break;
case ANDROID_ALARM_TYPE_COUNT:
case ANDROID_ALARM_SYSTEMTIME: case ANDROID_ALARM_SYSTEMTIME:
ktime_get_ts(&tmp_time); ktime_get_ts(&tmp_time);
break; break;
default:
rv = -EINVAL;
goto err1;
} }
if (copy_to_user((void __user *)arg, &tmp_time, if (copy_to_user((void __user *)arg, &tmp_time,
sizeof(tmp_time))) { sizeof(tmp_time))) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment