Thread (4 messages) flat view 4 messages, 2 authors, 2018-06-18

powerpc: use time64_t in read_persistent_clock

From: Mathieu Malaterre <hidden>
Date: 2018-06-13 20:24:24

Arnd,

In 5bfd643583b2e I can see that you changed:

$ git show 5bfd643583b2e -- arch/powerpc/platforms/powermac/time.c
[...]
 #ifdef CONFIG_ADB_PMU
-static unsigned long pmu_get_time(void)
+static time64_t pmu_get_time(void)
 {
        struct adb_request req;
-       unsigned int now;
+       time64_t now;

        if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
                return 0;
@@ -160,10 +151,10 @@ static unsigned long pmu_get_time(void)
                       req.reply_len);
        now = (req.reply[0] << 24) + (req.reply[1] << 16)
                + (req.reply[2] << 8) + req.reply[3];
-       return ((unsigned long)now) - RTC_OFFSET;
+       return now - RTC_OFFSET;
 }
[...]

As far as I can tell the old function would never return a negative
value and rely on unsigned long roll over. Now I am seeing negative
value being returned and it seems to break later on in the rtc
library.

Could you comment why you removed the cast to (unsigned long) in your commit ?

Thanks
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help