Re: [PATCH 2/3] [v2] m68k: mac: use time64_t in RTC handling

From: Arnd Bergmann
Date: Wed Jul 18 2018 - 10:26:21 EST


On Wed, Jul 18, 2018 at 3:49 PM, Finn Thain <fthain@xxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 18 Jul 2018, Arnd Bergmann wrote:

>>
>> -static long via_read_time(void)
>> +static time64_t via_read_time(void)
>> {
>> union {
>> __u8 cdata[4];
>> - long idata;
>> + __u32 idata;
>> } result, last_result;
>> + time64_t ret;
>
> ret isn't used.
>
>> int count = 1;
>>
>> via_pram_command(0x81, &last_result.cdata[3]);
>> @@ -279,12 +280,8 @@ static long via_read_time(void)
>> via_pram_command(0x89, &result.cdata[1]);
>> via_pram_command(0x8D, &result.cdata[0]);
>>
>> - if (result.idata == last_result.idata) {
>> - if (result.idata < RTC_OFFSET)
>> - result.idata += 0x100000000ull;
>> -
>> - return result.idata - RTC_OFFSET;
>> - }
>> + if (result.idata == last_result.idata)
>> + return (time64_t(result.idata) - RTC_OFFSET);
>>
>
> Did you mean to write,
>
> return (time64_t)result.idata - RTC_OFFSET;
>
> ?

Right, I should have at least tried to build it again.

Arnd