Commit 2c7d47a4 authored by Mateusz Jończyk's avatar Mateusz Jończyk Committed by Alexandre Belloni

rtc: mc146818-lib: refactor mc146818_does_rtc_work

Refactor mc146818_does_rtc_work() so that it uses mc146818_avoid_UIP().
It is enough to call mc146818_avoid_UIP() with no callback.
Signed-off-by: default avatarMateusz Jończyk <mat.jonczyk@o2.pl>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
Link: https://lore.kernel.org/r/20211210200131.153887-8-mat.jonczyk@o2.pl
parent 2a61b0ac
...@@ -84,22 +84,7 @@ EXPORT_SYMBOL_GPL(mc146818_avoid_UIP); ...@@ -84,22 +84,7 @@ EXPORT_SYMBOL_GPL(mc146818_avoid_UIP);
*/ */
bool mc146818_does_rtc_work(void) bool mc146818_does_rtc_work(void)
{ {
int i; return mc146818_avoid_UIP(NULL, NULL);
unsigned char val;
unsigned long flags;
for (i = 0; i < 10; i++) {
spin_lock_irqsave(&rtc_lock, flags);
val = CMOS_READ(RTC_FREQ_SELECT);
spin_unlock_irqrestore(&rtc_lock, flags);
if ((val & RTC_UIP) == 0)
return true;
mdelay(1);
}
return false;
} }
EXPORT_SYMBOL_GPL(mc146818_does_rtc_work); EXPORT_SYMBOL_GPL(mc146818_does_rtc_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment