On 28/02/2015 at 13:22:54 -0800, Joe Perches wrote :
> My thought was that it might be better to
> use a local struct rtc_time r like
> 
>       r.tm_sec = bcd2bin(date[AB08XX_REG_SC] & 0x7F);
>       r.tm_min = bcd2bin(date[AB08XX_REG_MN] & 0x7F);
>       r.tm_hour = bcd2bin(date[AB08XX_REG_HR] & 0x3F);
>       r.tm_wday = date[AB08XX_REG_WD] & 0x7;
>       r.tm_mday = bcd2bin(date[AB08XX_REG_DA] & 0x3F);
>       r.tm_mon = bcd2bin(date[AB08XX_REG_MO] & 0x1F) - 1;
>       r.tm_year = bcd2bin(date[AB08XX_REG_YR]);
>       if (r.tm_year < 70)
>               r.tm_year += 100;
> 
>       err = rtc_valid_tm(&r);
>       if (!err)
>               *tm = r;
>       else
>               dev_err(&client->dev, "retrieved date/time is not valid\n");
> 
>       return err;
> 

I'm sure this is not needed as userspace has to bail out if the ioctl
fails. I'll let that up to the rtc maintainers though.

-- 
Alexandre Belloni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to