]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
hwclock: remove dead code and other minor fixes
authorSami Kerola <kerolasa@iki.fi>
Sun, 17 Jul 2016 10:30:40 +0000 (11:30 +0100)
committerSami Kerola <kerolasa@iki.fi>
Sat, 4 Feb 2017 23:39:37 +0000 (23:39 +0000)
Use #ifdef rather than #if to avoid undefined preprocessor identifier
warning.

Remove dead code.  The #if 0 ensured the code has not been used for long
time, which is good because the linux/mc146818rtc.h is not been part of
user-api for long time.

Value of the adjtime_p->last_calib_time is checked if it has value of zero,
so testing none-zero bit later is necessarily true, and therefore does not
need to be checked.

And at the and remove unnecessary boolean variable.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
sys-utils/hwclock-cmos.c
sys-utils/hwclock-rtc.c
sys-utils/hwclock.c

index 9d9a42a8b8f31026e675f76f9fbed89af85bb435..6595725fd1b18fed5c953c08ed92260720e504b5 100644 (file)
@@ -269,7 +269,7 @@ void set_cmos_access(const struct hwclock_control *ctl)
 }
 #endif                         /* __alpha */
 
-#if __alpha__
+#ifdef __alpha__
 /*
  * The Alpha doesn't allow user-level code to disable interrupts (for good
  * reasons). Instead, we ensure atomic operation by performing the operation
index 8dd47092f2624befc770d8f17a6302fde76cb723..b974cc2aa59aa8039e769e8484157d50cff641f3 100644 (file)
@@ -53,18 +53,6 @@ struct sparc_rtc_time
 #define RTCGET _IOR('p', 20, struct sparc_rtc_time)
 #define RTCSET _IOW('p', 21, struct sparc_rtc_time)
 
-/* non-sparc stuff */
-#if 0
-# include <linux/version.h>
-/*
- * Check if the /dev/rtc interface is available in this version of the
- * system headers. 131072 is linux 2.0.0.
- */
-# if LINUX_VERSION_CODE >= 131072
-#  include <linux/mc146818rtc.h>
-# endif
-#endif
-
 /*
  * struct rtc_time is present since 1.3.99.
  * Earlier (since 1.3.89), a struct tm was used.
index fc476c088454f08e64fc79f6440eef0976a4c54e..b08bd781a68d1a094474b30bc199f7af9de9558f 100644 (file)
@@ -972,7 +972,7 @@ adjust_drift_factor(const struct hwclock_control *ctl,
                        printf(_("Not adjusting drift factor because it has "
                                 "been less than four hours since the last "
                                 "calibration.\n"));
-       } else if (adjtime_p->last_calib_time != 0) {
+       } else {
                /*
                 * At adjustment time we drift correct the hardware clock
                 * according to the contents of the adjtime file and refresh
@@ -1221,8 +1221,6 @@ static int
 manipulate_clock(const struct hwclock_control *ctl, const time_t set_time,
                 const struct timeval startup_time, struct adjtime *adjtime)
 {
-       /* Set if user lacks necessary authorization to access the clock */
-       bool no_auth;
        /* The time at which we read the Hardware Clock */
        struct timeval read_time;
        /*
@@ -1240,11 +1238,9 @@ manipulate_clock(const struct hwclock_control *ctl, const time_t set_time,
        /* local return code */
        int rc = 0;
 
-       if (!ctl->systz && !ctl->predict) {
-               no_auth = ur->get_permissions();
-               if (no_auth)
+       if (!ctl->systz && !ctl->predict)
+               if (ur->get_permissions())
                        return EX_NOPERM;
-       }
 
        if ((ctl->set || ctl->systohc || ctl->adjust) &&
            (adjtime->local_utc == UTC) != ctl->universal) {