@@ -130,7 +130,7 @@ int rtc_read_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
else {
memset(alarm, 0, sizeof(struct rtc_wkalrm));
alarm->enabled = rtc->aie_timer.enabled;
- alarm->time = rtc_ktime_to_tm(rtc->aie_timer.node.expires);
+ rtc_ktime_to_tm(rtc->aie_timer.node.expires, &alarm->time);
}
mutex_unlock(&rtc->ops_lock);
@@ -185,7 +185,7 @@ int rtc_set_alarm(struct rtc_device *rtc, struct rtc_wkalrm *alarm)
if (rtc->aie_timer.enabled) {
rtc_timer_remove(rtc, &rtc->aie_timer);
}
- rtc->aie_timer.node.expires = rtc_tm_to_ktime(alarm->time);
+ rtc->aie_timer.node.expires = rtc_tm_to_ktime(&alarm->time);
rtc->aie_timer.period = ktime_set(0, 0);
if (alarm->enabled) {
err = rtc_timer_enqueue(rtc, &rtc->aie_timer);
@@ -244,7 +244,7 @@ int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled)
__rtc_read_time(rtc, &tm);
onesec = ktime_set(1, 0);
- now = rtc_tm_to_ktime(tm);
+ now = rtc_tm_to_ktime(&tm);
rtc->uie_rtctimer.node.expires = ktime_add(now, onesec);
rtc->uie_rtctimer.period = ktime_set(1, 0);
err = rtc_timer_enqueue(rtc, &rtc->uie_rtctimer);
@@ -521,7 +521,7 @@ static int rtc_timer_enqueue(struct rtc_device *rtc, struct rtc_timer *timer)
if (&timer->node == timerqueue_getnext(&rtc->timerqueue)) {
struct rtc_wkalrm alarm;
int err;
- alarm.time = rtc_ktime_to_tm(timer->node.expires);
+ rtc_ktime_to_tm(timer->node.expires, &alarm.time);
alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm);
if (err == -ETIME)
@@ -558,7 +558,7 @@ static void rtc_timer_remove(struct rtc_device *rtc, struct rtc_timer *timer)
next = timerqueue_getnext(&rtc->timerqueue);
if (!next)
return;
- alarm.time = rtc_ktime_to_tm(next->expires);
+ rtc_ktime_to_tm(next->expires, &alarm.time);
alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm);
if (err == -ETIME)
@@ -589,7 +589,7 @@ void rtc_timer_do_work(struct work_struct *work)
mutex_lock(&rtc->ops_lock);
again:
__rtc_read_time(rtc, &tm);
- now = rtc_tm_to_ktime(tm);
+ now = rtc_tm_to_ktime(&tm);
while ((next = timerqueue_getnext(&rtc->timerqueue))) {
if (next->expires.tv64 > now.tv64)
break;
@@ -614,7 +614,7 @@ again:
if (next) {
struct rtc_wkalrm alarm;
int err;
- alarm.time = rtc_ktime_to_tm(next->expires);
+ rtc_ktime_to_tm(next->expires, &alarm.time);
alarm.enabled = 1;
err = __rtc_set_alarm(rtc, &alarm);
if (err == -ETIME)
@@ -120,10 +120,10 @@ EXPORT_SYMBOL(rtc_tm_to_time);
/*
* Convert rtc_time to ktime
*/
-ktime_t rtc_tm_to_ktime(struct rtc_time tm)
+ktime_t rtc_tm_to_ktime(const struct rtc_time *tm)
{
time_t time;
- rtc_tm_to_time(&tm, &time);
+ rtc_tm_to_time(tm, &time);
return ktime_set(time, 0);
}
EXPORT_SYMBOL_GPL(rtc_tm_to_ktime);
@@ -131,17 +131,15 @@ EXPORT_SYMBOL_GPL(rtc_tm_to_ktime);
/*
* Convert ktime to rtc_time
*/
-struct rtc_time rtc_ktime_to_tm(ktime_t kt)
+void rtc_ktime_to_tm(ktime_t kt, struct rtc_time *tm)
{
struct timespec ts;
- struct rtc_time ret;
ts = ktime_to_timespec(kt);
/* Round up any ns */
if (ts.tv_nsec)
ts.tv_sec++;
- rtc_time_to_tm(ts.tv_sec, &ret);
- return ret;
+ rtc_time_to_tm(ts.tv_sec, tm);
}
EXPORT_SYMBOL_GPL(rtc_ktime_to_tm);
@@ -107,8 +107,8 @@ extern int rtc_year_days(unsigned int day, unsigned int month, unsigned int year
extern int rtc_valid_tm(const struct rtc_time *tm);
extern int rtc_tm_to_time(const struct rtc_time *tm, unsigned long *time);
extern void rtc_time_to_tm(unsigned long time, struct rtc_time *tm);
-extern ktime_t rtc_tm_to_ktime(struct rtc_time tm);
-extern struct rtc_time rtc_ktime_to_tm(ktime_t kt);
+extern ktime_t rtc_tm_to_ktime(const struct rtc_time *tm);
+extern void rtc_ktime_to_tm(ktime_t kt, struct rtc_time *tm);
#include <linux/device.h>