rtc: cmos: Remove the `use_acpi_alarm' module parameter for !ACPI
Fix a problem with commit311ee9c151
("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") defining `use_acpi_alarm' module parameter even for non-ACPI platforms, which ignore it. Wrap the definition into #ifdef CONFIG_ACPI and use a static inline wrapper function, hardcoded to return 0 and consequently optimized away for !ACPI, following the existing pattern with HPET handling functions. Signed-off-by: Maciej W. Rozycki <macro@linux-mips.org> Fixes:311ee9c151
("rtc: cmos: allow using ACPI for RTC alarm instead of HPET") Cc: stable@vger.kernel.org # 4.18+ Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
d197a25385
commit
bc51098cdd
1 changed files with 20 additions and 7 deletions
|
@ -50,6 +50,7 @@
|
||||||
/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
|
/* this is for "generic access to PC-style RTC" using CMOS_READ/CMOS_WRITE */
|
||||||
#include <linux/mc146818rtc.h>
|
#include <linux/mc146818rtc.h>
|
||||||
|
|
||||||
|
#ifdef CONFIG_ACPI
|
||||||
/*
|
/*
|
||||||
* Use ACPI SCI to replace HPET interrupt for RTC Alarm event
|
* Use ACPI SCI to replace HPET interrupt for RTC Alarm event
|
||||||
*
|
*
|
||||||
|
@ -61,6 +62,18 @@
|
||||||
static bool use_acpi_alarm;
|
static bool use_acpi_alarm;
|
||||||
module_param(use_acpi_alarm, bool, 0444);
|
module_param(use_acpi_alarm, bool, 0444);
|
||||||
|
|
||||||
|
static inline int cmos_use_acpi_alarm(void)
|
||||||
|
{
|
||||||
|
return use_acpi_alarm;
|
||||||
|
}
|
||||||
|
#else /* !CONFIG_ACPI */
|
||||||
|
|
||||||
|
static inline int cmos_use_acpi_alarm(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
struct cmos_rtc {
|
struct cmos_rtc {
|
||||||
struct rtc_device *rtc;
|
struct rtc_device *rtc;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -169,7 +182,7 @@ static inline int hpet_unregister_irq_handler(irq_handler_t handler)
|
||||||
/* Don't use HPET for RTC Alarm event if ACPI Fixed event is used */
|
/* Don't use HPET for RTC Alarm event if ACPI Fixed event is used */
|
||||||
static inline int use_hpet_alarm(void)
|
static inline int use_hpet_alarm(void)
|
||||||
{
|
{
|
||||||
return is_hpet_enabled() && !use_acpi_alarm;
|
return is_hpet_enabled() && !cmos_use_acpi_alarm();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*----------------------------------------------------------------*/
|
/*----------------------------------------------------------------*/
|
||||||
|
@ -340,7 +353,7 @@ static void cmos_irq_enable(struct cmos_rtc *cmos, unsigned char mask)
|
||||||
if (use_hpet_alarm())
|
if (use_hpet_alarm())
|
||||||
hpet_set_rtc_irq_bit(mask);
|
hpet_set_rtc_irq_bit(mask);
|
||||||
|
|
||||||
if ((mask & RTC_AIE) && use_acpi_alarm) {
|
if ((mask & RTC_AIE) && cmos_use_acpi_alarm()) {
|
||||||
if (cmos->wake_on)
|
if (cmos->wake_on)
|
||||||
cmos->wake_on(cmos->dev);
|
cmos->wake_on(cmos->dev);
|
||||||
}
|
}
|
||||||
|
@ -358,7 +371,7 @@ static void cmos_irq_disable(struct cmos_rtc *cmos, unsigned char mask)
|
||||||
if (use_hpet_alarm())
|
if (use_hpet_alarm())
|
||||||
hpet_mask_rtc_irq_bit(mask);
|
hpet_mask_rtc_irq_bit(mask);
|
||||||
|
|
||||||
if ((mask & RTC_AIE) && use_acpi_alarm) {
|
if ((mask & RTC_AIE) && cmos_use_acpi_alarm()) {
|
||||||
if (cmos->wake_off)
|
if (cmos->wake_off)
|
||||||
cmos->wake_off(cmos->dev);
|
cmos->wake_off(cmos->dev);
|
||||||
}
|
}
|
||||||
|
@ -980,7 +993,7 @@ static int cmos_suspend(struct device *dev)
|
||||||
}
|
}
|
||||||
spin_unlock_irq(&rtc_lock);
|
spin_unlock_irq(&rtc_lock);
|
||||||
|
|
||||||
if ((tmp & RTC_AIE) && !use_acpi_alarm) {
|
if ((tmp & RTC_AIE) && !cmos_use_acpi_alarm()) {
|
||||||
cmos->enabled_wake = 1;
|
cmos->enabled_wake = 1;
|
||||||
if (cmos->wake_on)
|
if (cmos->wake_on)
|
||||||
cmos->wake_on(dev);
|
cmos->wake_on(dev);
|
||||||
|
@ -1031,7 +1044,7 @@ static void cmos_check_wkalrm(struct device *dev)
|
||||||
* ACPI RTC wake event is cleared after resume from STR,
|
* ACPI RTC wake event is cleared after resume from STR,
|
||||||
* ACK the rtc irq here
|
* ACK the rtc irq here
|
||||||
*/
|
*/
|
||||||
if (t_now >= cmos->alarm_expires && use_acpi_alarm) {
|
if (t_now >= cmos->alarm_expires && cmos_use_acpi_alarm()) {
|
||||||
cmos_interrupt(0, (void *)cmos->rtc);
|
cmos_interrupt(0, (void *)cmos->rtc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1066,7 @@ static int __maybe_unused cmos_resume(struct device *dev)
|
||||||
struct cmos_rtc *cmos = dev_get_drvdata(dev);
|
struct cmos_rtc *cmos = dev_get_drvdata(dev);
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
|
|
||||||
if (cmos->enabled_wake && !use_acpi_alarm) {
|
if (cmos->enabled_wake && !cmos_use_acpi_alarm()) {
|
||||||
if (cmos->wake_off)
|
if (cmos->wake_off)
|
||||||
cmos->wake_off(dev);
|
cmos->wake_off(dev);
|
||||||
else
|
else
|
||||||
|
@ -1132,7 +1145,7 @@ static u32 rtc_handler(void *context)
|
||||||
* Or else, ACPI SCI is enabled during suspend/resume only,
|
* Or else, ACPI SCI is enabled during suspend/resume only,
|
||||||
* update rtc irq in that case.
|
* update rtc irq in that case.
|
||||||
*/
|
*/
|
||||||
if (use_acpi_alarm)
|
if (cmos_use_acpi_alarm())
|
||||||
cmos_interrupt(0, (void *)cmos->rtc);
|
cmos_interrupt(0, (void *)cmos->rtc);
|
||||||
else {
|
else {
|
||||||
/* Fix me: can we use cmos_interrupt() here as well? */
|
/* Fix me: can we use cmos_interrupt() here as well? */
|
||||||
|
|
Loading…
Reference in a new issue