util-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwclock: define cmos_interface only if necessary
@ 2019-06-23 17:28 unixmania
  2019-06-23 22:32 ` Carlos Santos
  0 siblings, 1 reply; 2+ messages in thread
From: unixmania @ 2019-06-23 17:28 UTC (permalink / raw)
  To: util-linux; +Cc: Carlos Santos

From: Carlos Santos <unixmania@gmail.com>

Move the static declaration to the probe_for_cmos_clock() function and
make it conditional to i386/x86_64, preventing a "defined but not used"
compiler warning.

Signed-off-by: Carlos Santos <unixmania@gmail.com>
---
 sys-utils/hwclock-cmos.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/sys-utils/hwclock-cmos.c b/sys-utils/hwclock-cmos.c
index a11f676b8..ada4a9c43 100644
--- a/sys-utils/hwclock-cmos.c
+++ b/sys-utils/hwclock-cmos.c
@@ -398,21 +398,21 @@ static const char *get_device_path(void)
 	return NULL;
 }
 
-static struct clock_ops cmos_interface = {
-	N_("Using direct ISA access to the clock"),
-	get_permissions_cmos,
-	read_hardware_clock_cmos,
-	set_hardware_clock_cmos,
-	synchronize_to_clock_tick_cmos,
-	get_device_path,
-};
-
 /*
  * return &cmos if cmos clock present, NULL otherwise.
  */
 struct clock_ops *probe_for_cmos_clock(void)
 {
 #if defined(__i386__) || defined(__x86_64__)
+	static struct clock_ops cmos_interface = {
+		N_("Using direct ISA access to the clock"),
+		get_permissions_cmos,
+		read_hardware_clock_cmos,
+		set_hardware_clock_cmos,
+		synchronize_to_clock_tick_cmos,
+		get_device_path,
+	};
+
 	return &cmos_interface;
 #else
 	return NULL;
-- 
2.18.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-06-24  2:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-23 17:28 [PATCH] hwclock: define cmos_interface only if necessary unixmania
2019-06-23 22:32 ` Carlos Santos

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).