Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/i2c Use todr_[gs]ettime_ymdhms functions that handle...
details: https://anonhg.NetBSD.org/src/rev/d7773a29baee
branches: trunk
changeset: 330203:d7773a29baee
user: tsutsui <tsutsui%NetBSD.org@localhost>
date: Sun Jun 29 04:04:02 2014 +0000
description:
Use todr_[gs]ettime_ymdhms functions that handle ymdhms format properly.
Compile test only.
diffstat:
sys/dev/i2c/rs5c372.c | 29 ++++++++++-------------------
1 files changed, 10 insertions(+), 19 deletions(-)
diffs (76 lines):
diff -r 737efb961e38 -r d7773a29baee sys/dev/i2c/rs5c372.c
--- a/sys/dev/i2c/rs5c372.c Sun Jun 29 04:00:59 2014 +0000
+++ b/sys/dev/i2c/rs5c372.c Sun Jun 29 04:04:02 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rs5c372.c,v 1.12 2012/01/21 19:44:30 nonaka Exp $ */
+/* $NetBSD: rs5c372.c,v 1.13 2014/06/29 04:04:02 tsutsui Exp $ */
/*-
* Copyright (C) 2005 NONAKA Kimihiro <nonaka%netbsd.org@localhost>
@@ -26,7 +26,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rs5c372.c,v 1.12 2012/01/21 19:44:30 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rs5c372.c,v 1.13 2014/06/29 04:04:02 tsutsui Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -58,8 +58,8 @@
static void rs5c372rtc_reg_write(struct rs5c372rtc_softc *, int, uint8_t);
static int rs5c372rtc_clock_read(struct rs5c372rtc_softc *, struct clock_ymdhms *);
static int rs5c372rtc_clock_write(struct rs5c372rtc_softc *, struct clock_ymdhms *);
-static int rs5c372rtc_gettime(struct todr_chip_handle *, struct timeval *);
-static int rs5c372rtc_settime(struct todr_chip_handle *, struct timeval *);
+static int rs5c372rtc_gettime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
+static int rs5c372rtc_settime_ymdhms(todr_chip_handle_t, struct clock_ymdhms *);
static int
rs5c372rtc_match(device_t parent, cfdata_t cf, void *arg)
@@ -91,8 +91,8 @@
sc->sc_address = ia->ia_addr;
sc->sc_dev = self;
sc->sc_todr.cookie = sc;
- sc->sc_todr.todr_gettime = rs5c372rtc_gettime;
- sc->sc_todr.todr_settime = rs5c372rtc_settime;
+ sc->sc_todr.todr_gettime_ymdhms = rs5c372rtc_gettime_ymdhms;
+ sc->sc_todr.todr_settime_ymdhms = rs5c372rtc_settime_ymdhms;
sc->sc_todr.todr_setwen = NULL;
todr_attach(&sc->sc_todr);
@@ -103,31 +103,22 @@
}
static int
-rs5c372rtc_gettime(struct todr_chip_handle *ch, struct timeval *tv)
+rs5c372rtc_gettime_ymdhms(todr_chip_handle_t ch, struct clock_ymdhms *dt)
{
struct rs5c372rtc_softc *sc = ch->cookie;
- struct clock_ymdhms dt;
- memset(&dt, 0, sizeof(dt));
-
- if (rs5c372rtc_clock_read(sc, &dt) == 0)
+ if (rs5c372rtc_clock_read(sc, dt) == 0)
return (-1);
- tv->tv_sec = clock_ymdhms_to_secs(&dt);
- tv->tv_usec = 0;
-
return (0);
}
static int
-rs5c372rtc_settime(struct todr_chip_handle *ch, struct timeval *tv)
+rs5c372rtc_settime_ymdhms(todr_chip_handle_t ch, struct clock_ymdhms *dt)
{
struct rs5c372rtc_softc *sc = ch->cookie;
- struct clock_ymdhms dt;
- clock_secs_to_ymdhms(tv->tv_sec, &dt);
-
- if (rs5c372rtc_clock_write(sc, &dt) == 0)
+ if (rs5c372rtc_clock_write(sc, dt) == 0)
return (-1);
return (0);
Home |
Main Index |
Thread Index |
Old Index