summaryrefslogtreecommitdiffstats
path: root/drivers/staging/android
diff options
context:
space:
mode:
authorJohn Stultz2012-02-09 23:24:34 +0100
committerGreg Kroah-Hartman2012-02-10 19:06:19 +0100
commitf2f28eacf240baffbba5e9744278f85fc62ddd60 (patch)
tree353c686bb3f78381036f443ec21805c3ba3608aa /drivers/staging/android
parentstaging: android-alarm: Fix include compile issues (diff)
downloadkernel-qcow2-linux-f2f28eacf240baffbba5e9744278f85fc62ddd60.tar.gz
kernel-qcow2-linux-f2f28eacf240baffbba5e9744278f85fc62ddd60.tar.xz
kernel-qcow2-linux-f2f28eacf240baffbba5e9744278f85fc62ddd60.zip
staging: android-alarm: Fix namespace collision with upstreamed alarmtimers
The upstreamed alarmtimers are similar but not quite 100% API compatibile with the android in-kernel alarm api. To aid the transition, prefix the the android in-kernel api with android_ CC: Arve Hjønnevåg <arve@android.com> CC: Android Kernel Team <kernel-team@android.com> Signed-off-by: John Stultz <john.stultz@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/android')
-rw-r--r--drivers/staging/android/alarm-dev.c14
-rw-r--r--drivers/staging/android/alarm.c37
-rw-r--r--drivers/staging/android/android_alarm.h17
3 files changed, 35 insertions, 33 deletions
diff --git a/drivers/staging/android/alarm-dev.c b/drivers/staging/android/alarm-dev.c
index 80ea85086e45..758d828784f4 100644
--- a/drivers/staging/android/alarm-dev.c
+++ b/drivers/staging/android/alarm-dev.c
@@ -55,7 +55,7 @@ static uint32_t alarm_pending;
static uint32_t alarm_enabled;
static uint32_t wait_pending;
-static struct alarm alarms[ANDROID_ALARM_TYPE_COUNT];
+static struct android_alarm alarms[ANDROID_ALARM_TYPE_COUNT];
static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
@@ -90,7 +90,7 @@ static long alarm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
case ANDROID_ALARM_CLEAR(0):
spin_lock_irqsave(&alarm_slock, flags);
pr_alarm(IO, "alarm %d clear\n", alarm_type);
- alarm_try_to_cancel(&alarms[alarm_type]);
+ android_alarm_try_to_cancel(&alarms[alarm_type]);
if (alarm_pending) {
alarm_pending &= ~alarm_type_mask;
if (!alarm_pending && !wait_pending)
@@ -121,7 +121,7 @@ from_old_alarm_set:
pr_alarm(IO, "alarm %d set %ld.%09ld\n", alarm_type,
new_alarm_time.tv_sec, new_alarm_time.tv_nsec);
alarm_enabled |= alarm_type_mask;
- alarm_start_range(&alarms[alarm_type],
+ android_alarm_start_range(&alarms[alarm_type],
timespec_to_ktime(new_alarm_time),
timespec_to_ktime(new_alarm_time));
spin_unlock_irqrestore(&alarm_slock, flags);
@@ -152,7 +152,7 @@ from_old_alarm_set:
rv = -EFAULT;
goto err1;
}
- rv = alarm_set_rtc(new_rtc_time);
+ rv = android_alarm_set_rtc(new_rtc_time);
spin_lock_irqsave(&alarm_slock, flags);
alarm_pending |= ANDROID_ALARM_TIME_CHANGE_MASK;
wake_up(&alarm_wait_queue);
@@ -213,7 +213,7 @@ static int alarm_release(struct inode *inode, struct file *file)
alarm_enabled &= ~alarm_type_mask;
}
spin_unlock_irqrestore(&alarm_slock, flags);
- alarm_cancel(&alarms[i]);
+ android_alarm_cancel(&alarms[i]);
spin_lock_irqsave(&alarm_slock, flags);
}
if (alarm_pending | wait_pending) {
@@ -230,7 +230,7 @@ static int alarm_release(struct inode *inode, struct file *file)
return 0;
}
-static void alarm_triggered(struct alarm *alarm)
+static void alarm_triggered(struct android_alarm *alarm)
{
unsigned long flags;
uint32_t alarm_type_mask = 1U << alarm->type;
@@ -269,7 +269,7 @@ static int __init alarm_dev_init(void)
return err;
for (i = 0; i < ANDROID_ALARM_TYPE_COUNT; i++)
- alarm_init(&alarms[i], i, alarm_triggered);
+ android_alarm_init(&alarms[i], i, alarm_triggered);
wake_lock_init(&alarm_wake_lock, WAKE_LOCK_SUSPEND, "alarm");
return 0;
diff --git a/drivers/staging/android/alarm.c b/drivers/staging/android/alarm.c
index 7aaf5b8aa4f0..1f8bb5ca5682 100644
--- a/drivers/staging/android/alarm.c
+++ b/drivers/staging/android/alarm.c
@@ -70,7 +70,7 @@ static bool suspended;
static void update_timer_locked(struct alarm_queue *base, bool head_removed)
{
- struct alarm *alarm;
+ struct android_alarm *alarm;
bool is_wakeup = base == &alarms[ANDROID_ALARM_RTC_WAKEUP] ||
base == &alarms[ANDROID_ALARM_ELAPSED_REALTIME_WAKEUP];
@@ -85,7 +85,7 @@ static void update_timer_locked(struct alarm_queue *base, bool head_removed)
if (!base->first)
return;
- alarm = container_of(base->first, struct alarm, node);
+ alarm = container_of(base->first, struct android_alarm, node);
pr_alarm(FLOW, "selected alarm, type %d, func %pF at %lld\n",
alarm->type, alarm->function, ktime_to_ns(alarm->expires));
@@ -102,12 +102,12 @@ static void update_timer_locked(struct alarm_queue *base, bool head_removed)
hrtimer_start_expires(&base->timer, HRTIMER_MODE_ABS);
}
-static void alarm_enqueue_locked(struct alarm *alarm)
+static void alarm_enqueue_locked(struct android_alarm *alarm)
{
struct alarm_queue *base = &alarms[alarm->type];
struct rb_node **link = &base->alarms.rb_node;
struct rb_node *parent = NULL;
- struct alarm *entry;
+ struct android_alarm *entry;
int leftmost = 1;
pr_alarm(FLOW, "added alarm, type %d, func %pF at %lld\n",
@@ -122,7 +122,7 @@ static void alarm_enqueue_locked(struct alarm *alarm)
while (*link) {
parent = *link;
- entry = rb_entry(parent, struct alarm, node);
+ entry = rb_entry(parent, struct android_alarm, node);
/*
* We dont care about collisions. Nodes with
* the same expiry time stay together.
@@ -144,13 +144,13 @@ static void alarm_enqueue_locked(struct alarm *alarm)
}
/**
- * alarm_init - initialize an alarm
+ * android_alarm_init - initialize an alarm
* @alarm: the alarm to be initialized
* @type: the alarm type to be used
* @function: alarm callback function
*/
-void alarm_init(struct alarm *alarm,
- enum android_alarm_type type, void (*function)(struct alarm *))
+void android_alarm_init(struct android_alarm *alarm,
+ enum android_alarm_type type, void (*function)(struct android_alarm *))
{
RB_CLEAR_NODE(&alarm->node);
alarm->type = type;
@@ -161,12 +161,13 @@ void alarm_init(struct alarm *alarm,
/**
- * alarm_start_range - (re)start an alarm
+ * android_alarm_start_range - (re)start an alarm
* @alarm: the alarm to be added
* @start: earliest expiry time
* @end: expiry time
*/
-void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end)
+void android_alarm_start_range(struct android_alarm *alarm, ktime_t start,
+ ktime_t end)
{
unsigned long flags;
@@ -178,7 +179,7 @@ void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end)
}
/**
- * alarm_try_to_cancel - try to deactivate an alarm
+ * android_alarm_try_to_cancel - try to deactivate an alarm
* @alarm: alarm to stop
*
* Returns:
@@ -187,7 +188,7 @@ void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end)
* -1 when the alarm may currently be excuting the callback function and
* cannot be stopped (it may also be inactive)
*/
-int alarm_try_to_cancel(struct alarm *alarm)
+int android_alarm_try_to_cancel(struct android_alarm *alarm)
{
struct alarm_queue *base = &alarms[alarm->type];
unsigned long flags;
@@ -218,17 +219,17 @@ int alarm_try_to_cancel(struct alarm *alarm)
}
/**
- * alarm_cancel - cancel an alarm and wait for the handler to finish.
+ * android_alarm_cancel - cancel an alarm and wait for the handler to finish.
* @alarm: the alarm to be cancelled
*
* Returns:
* 0 when the alarm was not active
* 1 when the alarm was active
*/
-int alarm_cancel(struct alarm *alarm)
+int android_alarm_cancel(struct android_alarm *alarm)
{
for (;;) {
- int ret = alarm_try_to_cancel(alarm);
+ int ret = android_alarm_try_to_cancel(alarm);
if (ret >= 0)
return ret;
cpu_relax();
@@ -239,7 +240,7 @@ int alarm_cancel(struct alarm *alarm)
* alarm_set_rtc - set the kernel and rtc walltime
* @new_time: timespec value containing the new time
*/
-int alarm_set_rtc(struct timespec new_time)
+int android_alarm_set_rtc(struct timespec new_time)
{
int i;
int ret;
@@ -317,7 +318,7 @@ ktime_t alarm_get_elapsed_realtime(void)
static enum hrtimer_restart alarm_timer_triggered(struct hrtimer *timer)
{
struct alarm_queue *base;
- struct alarm *alarm;
+ struct android_alarm *alarm;
unsigned long flags;
ktime_t now;
@@ -331,7 +332,7 @@ static enum hrtimer_restart alarm_timer_triggered(struct hrtimer *timer)
base - alarms, ktime_to_ns(now));
while (base->first) {
- alarm = container_of(base->first, struct alarm, node);
+ alarm = container_of(base->first, struct android_alarm, node);
if (alarm->softexpires.tv64 > now.tv64) {
pr_alarm(FLOW, "don't call alarm, %pF, %lld (s %lld)\n",
alarm->function, ktime_to_ns(alarm->expires),
diff --git a/drivers/staging/android/android_alarm.h b/drivers/staging/android/android_alarm.h
index 753ed93bc4d3..9213581c927b 100644
--- a/drivers/staging/android/android_alarm.h
+++ b/drivers/staging/android/android_alarm.h
@@ -57,23 +57,24 @@ enum android_alarm_type {
*
*/
-struct alarm {
+struct android_alarm {
struct rb_node node;
enum android_alarm_type type;
ktime_t softexpires;
ktime_t expires;
- void (*function)(struct alarm *);
+ void (*function)(struct android_alarm *);
};
-void alarm_init(struct alarm *alarm,
- enum android_alarm_type type, void (*function)(struct alarm *));
-void alarm_start_range(struct alarm *alarm, ktime_t start, ktime_t end);
-int alarm_try_to_cancel(struct alarm *alarm);
-int alarm_cancel(struct alarm *alarm);
+void android_alarm_init(struct android_alarm *alarm,
+ enum android_alarm_type type, void (*function)(struct android_alarm *));
+void android_alarm_start_range(struct android_alarm *alarm, ktime_t start,
+ ktime_t end);
+int android_alarm_try_to_cancel(struct android_alarm *alarm);
+int android_alarm_cancel(struct android_alarm *alarm);
ktime_t alarm_get_elapsed_realtime(void);
/* set rtc while preserving elapsed realtime */
-int alarm_set_rtc(const struct timespec ts);
+int android_alarm_set_rtc(const struct timespec ts);
#endif