qemu-timer.c: rename qemu_timer_new_scale()

Get rid of qemu_timer_new() implementation, and update all
callers to use qemu_timer_new_ms() or qemu_timer_new_ns()
instead.

Rename qemu_new_timer_scale() to qemu_new_timer() to follow
upstream conventions.

Change-Id: Id2c04f8597ec5026e02f87b3e2c5507920eb688e
diff --git a/hw/goldfish_timer.c b/hw/goldfish_timer.c
index a714b22..567ce2e 100644
--- a/hw/goldfish_timer.c
+++ b/hw/goldfish_timer.c
@@ -34,16 +34,6 @@
     QEMUTimer *timer;
 };
 
-/* Converts nanoseconds into ticks */
-static int64_t ns2tks(int64_t ns) {
-    return muldiv64(ns, get_ticks_per_sec(), 1000000000);
-}
-
-/* Converts ticks into nanoseconds */
-static int64_t tks2ns(int64_t tks) {
-    return muldiv64(tks, 1000000000, get_ticks_per_sec());
-}
-
 #define  GOLDFISH_TIMER_SAVE_VERSION  1
 
 static void  goldfish_timer_save(QEMUFile*  f, void*  opaque)
@@ -53,9 +43,9 @@
     qemu_put_be64(f, s->now_ns);  /* in case the kernel is in the middle of a timer read */
     qemu_put_byte(f, s->armed);
     if (s->armed) {
-        int64_t  now_tks   = qemu_get_clock(vm_clock);
-        int64_t  alarm_tks = ns2tks(s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32);
-        qemu_put_be64(f, alarm_tks - now_tks);
+        int64_t  now_ns   = qemu_get_clock_ns(vm_clock);
+        int64_t  alarm_ns = (s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32);
+        qemu_put_be64(f, alarm_ns - now_ns);
     }
 }
 
@@ -88,7 +78,7 @@
     struct timer_state *s = (struct timer_state *)opaque;
     switch(offset) {
         case TIMER_TIME_LOW:
-            s->now_ns = tks2ns(qemu_get_clock(vm_clock));
+            s->now_ns = qemu_get_clock_ns(vm_clock);
             return s->now_ns;
         case TIMER_TIME_HIGH:
             return s->now_ns >> 32;
@@ -101,16 +91,16 @@
 static void goldfish_timer_write(void *opaque, target_phys_addr_t offset, uint32_t value_ns)
 {
     struct timer_state *s = (struct timer_state *)opaque;
-    int64_t alarm_tks, now_tks;
+    int64_t alarm_ns, now_ns;
     switch(offset) {
         case TIMER_ALARM_LOW:
             s->alarm_low_ns = value_ns;
-            alarm_tks = ns2tks(s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32);
-            now_tks   = qemu_get_clock(vm_clock);
-            if (alarm_tks <= now_tks) {
+            alarm_ns = (s->alarm_low_ns | (int64_t)s->alarm_high_ns << 32);
+            now_ns   = qemu_get_clock_ns(vm_clock);
+            if (alarm_ns <= now_ns) {
                 goldfish_device_set_irq(&s->dev, 0, 1);
             } else {
-                qemu_mod_timer(s->timer, alarm_tks);
+                qemu_mod_timer(s->timer, alarm_ns);
                 s->armed = 1;
             }
             break;
@@ -251,7 +241,7 @@
 {
     timer_state.dev.base = timerbase;
     timer_state.dev.irq = timerirq;
-    timer_state.timer = qemu_new_timer(vm_clock, goldfish_timer_tick, &timer_state);
+    timer_state.timer = qemu_new_timer_ns(vm_clock, goldfish_timer_tick, &timer_state);
     goldfish_device_add(&timer_state.dev, goldfish_timer_readfn, goldfish_timer_writefn, &timer_state);
     register_savevm( "goldfish_timer", 0, GOLDFISH_TIMER_SAVE_VERSION,
                      goldfish_timer_save, goldfish_timer_load, &timer_state);