Re: dead clock functions

2021-04-21 Thread Greg Steuck
Thanks Miod!

Miod Vallat  writes:

> 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.

OK gnezdo if somebody wants to commit.

If art@ comes back to finish this in another 20 years we'll know where
to find the old versions.

>
> 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.c11 Jul 2014 08:18:31 -  1.10
> +++ arch/sparc64/dev/rtc.c21 Apr 2021 19:24:32 -
> @@ -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 -  1.6
> +++ dev/clock_subr.h  21 Apr 2021 19:24:32 -
> @@ -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 -  1.4
> +++ dev/fdt/sxirtc.c  21 Apr 2021 19:24:32 -
> @@ -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 -  1.2
> +++ dev/i2c/ds1307.c  21 Apr 2021 19:24:32 -
> @@ -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;
> - 

dead clock functions

2021-04-21 Thread Miod Vallat
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 -  1.10
+++ arch/sparc64/dev/rtc.c  21 Apr 2021 19:24:32 -
@@ -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.h17 May 2020 13:21:20 -  1.6
+++ dev/clock_subr.h21 Apr 2021 19:24:32 -
@@ -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.c11 Aug 2019 14:46:18 -  1.4
+++ dev/fdt/sxirtc.c21 Apr 2021 19:24:32 -
@@ -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.c27 Apr 2020 12:41:44 -  1.2
+++ dev/i2c/ds1307.c21 Apr 2021 19:24:32 -
@@ -72,8 +72,6 @@ int   maxrtc_enable_osc(struct maxrtc_soft
 intmaxrtc_set_24h_mode(struct maxrtc_softc *);
 intmaxrtc_gettime(struct todr_chip_handle *, struct timeval *);
 intmaxrtc_settime(struct todr_chip_handle *, struct timeval *);
-intmaxrtc_getcal(struct todr_chip_handle *, int *);
-intmaxrtc_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,