linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@linux-mips.org>
To: Alessandro Zummo <a.zummo@towertech.it>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: linux-rtc@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [PATCH 1/2] rtc: cmos: Fix non-ACPI undefined reference to `hpet_rtc_interrupt'
Date: Tue, 2 Oct 2018 02:08:49 +0100 (BST)	[thread overview]
Message-ID: <alpine.LFD.2.21.1810020132270.20762@eddie.linux-mips.org> (raw)
In-Reply-To: <alpine.LFD.2.21.1810020122330.20762@eddie.linux-mips.org>

Fix a commit 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm 
instead of HPET") `rtc-cmos' regression causing a link error:

drivers/rtc/rtc-cmos.o: In function `cmos_platform_probe':
rtc-cmos.c:(.init.text+0x33c): undefined reference to `hpet_rtc_interrupt'
rtc-cmos.c:(.init.text+0x3f4): undefined reference to `hpet_rtc_interrupt'

with non-ACPI platforms using this driver.  The cause is the change of 
the condition guarding the use of `hpet_rtc_interrupt'.

Previously it was a call to `is_hpet_enabled'.  That function is static 
inline and has a hardcoded 0 result for non-ACPI platforms, which imply 
!HPET_EMULATE_RTC.  Consequently the compiler optimized the whole block 
away including the reference to `hpet_rtc_interrupt', which never made 
it to the link stage.

Now the guarding condition is a call to `use_hpet_alarm', which is not 
static inline and therefore the compiler may not be able to prove that 
it actually always returns 0 for non-ACPI platforms.  Consequently the 
build breaks with an unsatisfied reference, because `hpet_rtc_interrupt' 
is nowhere defined at link time.

Fix the problem by marking `use_hpet_alarm' inline.  As the `inline' 
keyword serves as an optimization hint rather than a requirement the 
compiler is still free to choose whether inlining will be beneficial or 
not for ACPI platforms.

Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org>
Fixes: 311ee9c151ad ("rtc: cmos: allow using ACPI for RTC alarm instead of HPET")
Cc: stable@vger.kernel.org # 4.18+
---
 drivers/rtc/rtc-cmos.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

linux-rtc-cmos-use-hpet-alarm-inline.diff
Index: linux-20180812-4maxp64/drivers/rtc/rtc-cmos.c
===================================================================
--- linux-20180812-4maxp64.orig/drivers/rtc/rtc-cmos.c
+++ linux-20180812-4maxp64/drivers/rtc/rtc-cmos.c
@@ -167,7 +167,7 @@ static inline int hpet_unregister_irq_ha
 #endif
 
 /* Don't use HPET for RTC Alarm event if ACPI Fixed event is used */
-static int use_hpet_alarm(void)
+static inline int use_hpet_alarm(void)
 {
 	return is_hpet_enabled() && !use_acpi_alarm;
 }

  reply	other threads:[~2018-10-02  1:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-02  1:08 [PATCH 0/2] rtc: cmos: Fix non-ACPI (non-x86) platform support Maciej W. Rozycki
2018-10-02  1:08 ` Maciej W. Rozycki [this message]
2018-10-02  1:09 ` [PATCH 2/2] rtc: cmos: Remove the `use_acpi_alarm' module parameter for !ACPI Maciej W. Rozycki
2018-10-04 10:29 ` [PATCH 0/2] rtc: cmos: Fix non-ACPI (non-x86) platform support Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.21.1810020132270.20762@eddie.linux-mips.org \
    --to=macro@linux-mips.org \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).