The todr_handle struct contains two unused function pointers, which are
either not implemented or with clones of eopnotsupp(). The following
diff removes this waste of kernel text.
Index: arch/sparc64/dev/rtc.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/sparc64/dev/rtc.c,v
retrieving revision 1.10
diff -u -p -r1.10 rtc.c
--- arch/sparc64/dev/rtc.c 11 Jul 2014 08:18:31 -0000 1.10
+++ arch/sparc64/dev/rtc.c 21 Apr 2021 19:24:32 -0000
@@ -119,8 +119,6 @@ int rtc_gettime(todr_chip_handle_t, stru
int rtc_settime(todr_chip_handle_t, struct timeval *);
int rtc_bq4802_gettime(todr_chip_handle_t, struct timeval *);
int rtc_bq4802_settime(todr_chip_handle_t, struct timeval *);
-int rtc_getcal(todr_chip_handle_t, int *);
-int rtc_setcal(todr_chip_handle_t, int);
int
rtc_match(struct device *parent, void *cf, void *aux)
@@ -166,8 +164,6 @@ rtc_attach(struct device *parent, struct
handle->cookie = sc;
handle->todr_gettime = rtc_gettime;
handle->todr_settime = rtc_settime;
- handle->todr_getcal = rtc_getcal;
- handle->todr_setcal = rtc_setcal;
handle->bus_cookie = NULL;
handle->todr_setwen = NULL;
@@ -403,16 +399,4 @@ rtc_bq4802_settime(todr_chip_handle_t ha
csr &= ~BQ4802_UTI;
bus_space_write_1(iot, ioh, BQ4802_CTRL, csr);
return (0);
-}
-
-int
-rtc_getcal(todr_chip_handle_t handle, int *vp)
-{
- return (EOPNOTSUPP);
-}
-
-int
-rtc_setcal(todr_chip_handle_t handle, int v)
-{
- return (EOPNOTSUPP);
}
Index: dev/clock_subr.h
===================================================================
RCS file: /OpenBSD/src/sys/dev/clock_subr.h,v
retrieving revision 1.6
diff -u -p -r1.6 clock_subr.h
--- dev/clock_subr.h 17 May 2020 13:21:20 -0000 1.6
+++ dev/clock_subr.h 21 Apr 2021 19:24:32 -0000
@@ -35,8 +35,6 @@
*
* todr_gettime: convert time-of-day clock into a `struct timeval'
* todr_settime: set time-of-day clock from a `struct timeval'
- * todr_getcal: get current TOD clock calibration value in ppm
- * todr_setcal: set calibration value in ppm in TOD clock
*
* (this is probably not so useful:)
* todr_setwen: provide a machine-dependent TOD clock write-enable callback
@@ -49,16 +47,12 @@ struct todr_chip_handle {
int (*todr_gettime)(struct todr_chip_handle *, struct timeval *);
int (*todr_settime)(struct todr_chip_handle *, struct timeval *);
- int (*todr_getcal)(struct todr_chip_handle *, int *);
- int (*todr_setcal)(struct todr_chip_handle *, int);
int (*todr_setwen)(struct todr_chip_handle *, int);
};
typedef struct todr_chip_handle *todr_chip_handle_t;
#define todr_gettime(ct, t) ((*(ct)->todr_gettime)(ct, t))
#define todr_settime(ct, t) ((*(ct)->todr_settime)(ct, t))
-#define todr_getcal(ct, vp) ((*(ct)->todr_gettime)(ct, vp))
-#define todr_setcal(ct, v) ((*(ct)->todr_settime)(ct, v))
#define todr_wenable(ct, v) if ((ct)->todr_setwen) \
((*(ct)->todr_setwen)(ct, v))
Index: dev/fdt/sxirtc.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/fdt/sxirtc.c,v
retrieving revision 1.4
diff -u -p -r1.4 sxirtc.c
--- dev/fdt/sxirtc.c 11 Aug 2019 14:46:18 -0000 1.4
+++ dev/fdt/sxirtc.c 21 Apr 2021 19:24:32 -0000
@@ -146,8 +146,6 @@ sxirtc_attach(struct device *parent, str
handle->cookie = self;
handle->todr_gettime = sxirtc_gettime;
handle->todr_settime = sxirtc_settime;
- handle->todr_getcal = NULL;
- handle->todr_setcal = NULL;
handle->bus_cookie = NULL;
handle->todr_setwen = NULL;
todr_handle = handle;
Index: dev/i2c/ds1307.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/i2c/ds1307.c,v
retrieving revision 1.2
diff -u -p -r1.2 ds1307.c
--- dev/i2c/ds1307.c 27 Apr 2020 12:41:44 -0000 1.2
+++ dev/i2c/ds1307.c 21 Apr 2021 19:24:32 -0000
@@ -72,8 +72,6 @@ int maxrtc_enable_osc(struct maxrtc_soft
int maxrtc_set_24h_mode(struct maxrtc_softc *);
int maxrtc_gettime(struct todr_chip_handle *, struct timeval *);
int maxrtc_settime(struct todr_chip_handle *, struct timeval *);
-int maxrtc_getcal(struct todr_chip_handle *, int *);
-int maxrtc_setcal(struct todr_chip_handle *, int);
/*
* Driver glue structures.
@@ -114,8 +112,6 @@ maxrtc_attach(struct device *parent, str
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = maxrtc_gettime;
sc->sc_todr.todr_settime = maxrtc_settime;
- sc->sc_todr.todr_getcal = maxrtc_getcal;
- sc->sc_todr.todr_setcal = maxrtc_setcal;
sc->sc_todr.todr_setwen = NULL;
if (maxrtc_enable_osc(sc) == -1)
@@ -275,16 +271,4 @@ maxrtc_settime(struct todr_chip_handle *
}
return (0);
-}
-
-int
-maxrtc_getcal(struct todr_chip_handle *ch, int *cal)
-{
- return (EOPNOTSUPP);
-}
-
-int
-maxrtc_setcal(struct todr_chip_handle *ch, int cal)
-{
- return (EOPNOTSUPP);
}
Index: dev/i2c/pcf8523.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/i2c/pcf8523.c,v
retrieving revision 1.4
diff -u -p -r1.4 pcf8523.c
--- dev/i2c/pcf8523.c 27 Apr 2020 12:36:03 -0000 1.4
+++ dev/i2c/pcf8523.c 21 Apr 2021 19:24:32 -0000
@@ -109,8 +109,6 @@ int pcfrtc_clock_read(struct pcfrtc_soft
int pcfrtc_clock_write(struct pcfrtc_softc *, struct clock_ymdhms *);
int pcfrtc_gettime(struct todr_chip_handle *, struct timeval *);
int pcfrtc_settime(struct todr_chip_handle *, struct timeval *);
-int pcfrtc_getcal(struct todr_chip_handle *, int *);
-int pcfrtc_setcal(struct todr_chip_handle *, int);
int
pcfrtc_match(struct device *parent, void *v, void *arg)
@@ -136,8 +134,6 @@ pcfrtc_attach(struct device *parent, str
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = pcfrtc_gettime;
sc->sc_todr.todr_settime = pcfrtc_settime;
- sc->sc_todr.todr_getcal = pcfrtc_getcal;
- sc->sc_todr.todr_setcal = pcfrtc_setcal;
sc->sc_todr.todr_setwen = NULL;
#if 0
@@ -201,18 +197,6 @@ pcfrtc_settime(struct todr_chip_handle *
}
return (0);
-}
-
-int
-pcfrtc_setcal(struct todr_chip_handle *ch, int cal)
-{
- return (EOPNOTSUPP);
-}
-
-int
-pcfrtc_getcal(struct todr_chip_handle *ch, int *cal)
-{
- return (EOPNOTSUPP);
}
uint8_t
Index: dev/i2c/pcf8563.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/i2c/pcf8563.c,v
retrieving revision 1.3
diff -u -p -r1.3 pcf8563.c
--- dev/i2c/pcf8563.c 13 Jan 2021 11:01:19 -0000 1.3
+++ dev/i2c/pcf8563.c 21 Apr 2021 19:24:32 -0000
@@ -96,8 +96,6 @@ int pcxrtc_clock_read(struct pcxrtc_soft
int pcxrtc_clock_write(struct pcxrtc_softc *, struct clock_ymdhms *);
int pcxrtc_gettime(struct todr_chip_handle *, struct timeval *);
int pcxrtc_settime(struct todr_chip_handle *, struct timeval *);
-int pcxrtc_getcal(struct todr_chip_handle *, int *);
-int pcxrtc_setcal(struct todr_chip_handle *, int);
int
pcxrtc_match(struct device *parent, void *v, void *arg)
@@ -123,8 +121,6 @@ pcxrtc_attach(struct device *parent, str
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = pcxrtc_gettime;
sc->sc_todr.todr_settime = pcxrtc_settime;
- sc->sc_todr.todr_getcal = pcxrtc_getcal;
- sc->sc_todr.todr_setcal = pcxrtc_setcal;
sc->sc_todr.todr_setwen = NULL;
#if 0
@@ -173,18 +169,6 @@ pcxrtc_settime(struct todr_chip_handle *
if (pcxrtc_clock_write(sc, &dt) == 0)
return (-1);
return (0);
-}
-
-int
-pcxrtc_setcal(struct todr_chip_handle *ch, int cal)
-{
- return (EOPNOTSUPP);
-}
-
-int
-pcxrtc_getcal(struct todr_chip_handle *ch, int *cal)
-{
- return (EOPNOTSUPP);
}
uint8_t
Index: dev/i2c/rs5c372.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/i2c/rs5c372.c,v
retrieving revision 1.5
diff -u -p -r1.5 rs5c372.c
--- dev/i2c/rs5c372.c 5 Oct 2009 18:59:36 -0000 1.5
+++ dev/i2c/rs5c372.c 21 Apr 2021 19:24:32 -0000
@@ -107,8 +107,6 @@ int ricohrtc_clock_read(struct ricohrtc_
int ricohrtc_clock_write(struct ricohrtc_softc *, struct clock_ymdhms *);
int ricohrtc_gettime(struct todr_chip_handle *, struct timeval *);
int ricohrtc_settime(struct todr_chip_handle *, struct timeval *);
-int ricohrtc_getcal(struct todr_chip_handle *, int *);
-int ricohrtc_setcal(struct todr_chip_handle *, int);
int
ricohrtc_match(struct device *parent, void *v, void *arg)
@@ -186,8 +184,6 @@ ricohrtc_attach(struct device *parent, s
sc->sc_todr.cookie = sc;
sc->sc_todr.todr_gettime = ricohrtc_gettime;
sc->sc_todr.todr_settime = ricohrtc_settime;
- sc->sc_todr.todr_getcal = ricohrtc_getcal;
- sc->sc_todr.todr_setcal = ricohrtc_setcal;
sc->sc_todr.todr_setwen = NULL;
#if 0
@@ -231,20 +227,6 @@ ricohrtc_settime(struct todr_chip_handle
if (ricohrtc_clock_write(sc, &dt) == 0)
return (-1);
return (0);
-}
-
-int
-ricohrtc_setcal(struct todr_chip_handle *ch, int cal)
-{
-
- return (EOPNOTSUPP);
-}
-
-int
-ricohrtc_getcal(struct todr_chip_handle *ch, int *cal)
-{
-
- return (EOPNOTSUPP);
}
void
Index: dev/ic/mk48txx.c
===================================================================
RCS file: /OpenBSD/src/sys/dev/ic/mk48txx.c,v
retrieving revision 1.7
diff -u -p -r1.7 mk48txx.c
--- dev/ic/mk48txx.c 5 Apr 2011 19:54:35 -0000 1.7
+++ dev/ic/mk48txx.c 21 Apr 2021 19:24:32 -0000
@@ -54,8 +54,6 @@ struct mk48txx {
int mk48txx_gettime(todr_chip_handle_t, struct timeval *);
int mk48txx_settime(todr_chip_handle_t, struct timeval *);
-int mk48txx_getcal(todr_chip_handle_t, int *);
-int mk48txx_setcal(todr_chip_handle_t, int);
int mk48txx_auto_century_adjust = 1;
@@ -111,8 +109,6 @@ mk48txx_attach(bt, bh, model, year0)
handle->cookie = mk;
handle->todr_gettime = mk48txx_gettime;
handle->todr_settime = mk48txx_settime;
- handle->todr_getcal = mk48txx_getcal;
- handle->todr_setcal = mk48txx_setcal;
handle->todr_setwen = NULL;
mk->mk_bt = bt;
mk->mk_bh = bh;
@@ -222,22 +218,6 @@ mk48txx_settime(handle, tv)
bus_space_write_1(bt, bh, clkoff + MK48TXX_ICSR, csr);
todr_wenable(handle, 0);
return (0);
-}
-
-int
-mk48txx_getcal(handle, vp)
- todr_chip_handle_t handle;
- int *vp;
-{
- return (EOPNOTSUPP);
-}
-
-int
-mk48txx_setcal(handle, v)
- todr_chip_handle_t handle;
- int v;
-{
- return (EOPNOTSUPP);
}
int