From: Thomas Weißschuh Date: Tue, 4 Apr 2023 14:42:32 +0000 (+0000) Subject: hwclock: constify struct clock_opts X-Git-Tag: v2.39-rc3~41^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e08dddbc8bb496dd400c2165d185a5c17fe3d8bd;p=thirdparty%2Futil-linux.git hwclock: constify struct clock_opts Signed-off-by: Thomas Weißschuh --- diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c index 56ee624736..d3173fe9f5 100644 --- a/sys-utils/hwclock-cmos.c +++ b/sys-utils/hwclock-cmos.c @@ -369,7 +369,7 @@ static const char *get_device_path(void) return NULL; } -static struct clock_ops cmos_interface = { +static const struct clock_ops cmos_interface = { N_("Using direct ISA access to the clock"), get_permissions_cmos, read_hardware_clock_cmos, @@ -381,7 +381,7 @@ static struct clock_ops cmos_interface = { /* * return &cmos if cmos clock present, NULL otherwise. */ -struct clock_ops *probe_for_cmos_clock(void) +const struct clock_ops *probe_for_cmos_clock(void) { return &cmos_interface; } diff --git a/sys-utils/hwclock-rtc.c b/sys-utils/hwclock-rtc.c index 70c3a2fe7a..b647c00bf3 100644 --- a/sys-utils/hwclock-rtc.c +++ b/sys-utils/hwclock-rtc.c @@ -142,7 +142,7 @@ static void close_rtc(void) static int open_rtc(const struct hwclock_control *ctl) { - static const char *fls[] = { + static const char * const fls[] = { #ifdef __ia64__ "/dev/efirtc", "/dev/misc/efirtc", @@ -406,7 +406,7 @@ static const char *get_device_path(void) return rtc_dev_name; } -static struct clock_ops rtc_interface = { +static const struct clock_ops rtc_interface = { N_("Using the rtc interface to the clock."), get_permissions_rtc, read_hardware_clock_rtc, @@ -416,7 +416,7 @@ static struct clock_ops rtc_interface = { }; /* return &rtc if /dev/rtc can be opened, NULL otherwise */ -struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) +const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl) { const int rtc_fd = open_rtc(ctl); diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c index ad1eb688e4..0dfe7f0841 100644 --- a/sys-utils/hwclock.c +++ b/sys-utils/hwclock.c @@ -99,7 +99,7 @@ UL_DEBUG_DEFINE_MASK(hwclock); UL_DEBUG_DEFINE_MASKNAMES(hwclock) = UL_DEBUG_EMPTY_MASKNAMES; /* The struct that holds our hardware access routines */ -static struct clock_ops *ur; +static const struct clock_ops *ur; /* Maximal clock adjustment in seconds per day. (adjtime() glibc call has 2145 seconds limit on i386, so it is good enough for us as well, diff --git a/sys-utils/hwclock.h b/sys-utils/hwclock.h index 951857c223..b5b72d45d7 100644 --- a/sys-utils/hwclock.h +++ b/sys-utils/hwclock.h @@ -65,8 +65,8 @@ struct clock_ops { const char *(*get_device_path) (void); }; -extern struct clock_ops *probe_for_cmos_clock(void); -extern struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl); +extern const struct clock_ops *probe_for_cmos_clock(void); +extern const struct clock_ops *probe_for_rtc_clock(const struct hwclock_control *ctl); /* hwclock.c */ extern double time_diff(struct timeval subtrahend, struct timeval subtractor);