Util-Linux Archive on lore.kernel.org
 help / color / 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	[flat|nested] 2+ messages in thread

* Re: [PATCH] hwclock: define cmos_interface only if necessary
  2019-06-23 17:28 [PATCH] hwclock: define cmos_interface only if necessary unixmania
@ 2019-06-23 22:32 ` Carlos Santos
  0 siblings, 0 replies; 2+ messages in thread
From: Carlos Santos @ 2019-06-23 22:32 UTC (permalink / raw)
  To: util-linux

On Sun, Jun 23, 2019 at 2:28 PM <unixmania@gmail.com> wrote:
>
> 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
>

Please ignore this patch. I just sent an updated one.

-- 
Carlos Santos <unixmania@gmail.com>

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

end of thread, back to index

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

Util-Linux Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/util-linux/0 util-linux/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 util-linux util-linux/ https://lore.kernel.org/util-linux \
		util-linux@vger.kernel.org util-linux@archiver.kernel.org
	public-inbox-index util-linux


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.util-linux


AGPL code for this site: git clone https://public-inbox.org/ public-inbox