summary refs log tree commit diff
path: root/arch/m68k/mac/misc.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2018-08-24 12:02:06 +1000
committerGeert Uytterhoeven <geert@linux-m68k.org>2018-08-31 09:33:45 +0200
commit0986b16ab49b18063d29a9e02e9c7fab1928bc8e (patch)
treee53bbfdfa0086338e52e2973e9c06f1795a7eff4 /arch/m68k/mac/misc.c
parent5b394b2ddf0347bef56e50c69a58773c94343ff3 (diff)
downloadlinux-0986b16ab49b18063d29a9e02e9c7fab1928bc8e.tar.gz
m68k/mac: Use correct PMU response format
Now that the 68k Mac port has adopted the via-pmu driver, it must decode
the PMU response accordingly otherwise the date and time will be wrong.

Fixes: ebd722275f9cfc67 ("macintosh/via-pmu: Replace via-pmu68k driver with via-pmu driver")
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Diffstat (limited to 'arch/m68k/mac/misc.c')
-rw-r--r--arch/m68k/mac/misc.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index 3534aa6a4dc2..1b083c500b9a 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -98,11 +98,10 @@ static time64_t pmu_read_time(void)
 
 	if (pmu_request(&req, NULL, 1, PMU_READ_RTC) < 0)
 		return 0;
-	while (!req.complete)
-		pmu_poll();
+	pmu_wait_complete(&req);
 
-	time = (u32)((req.reply[1] << 24) | (req.reply[2] << 16) |
-		     (req.reply[3] << 8) | req.reply[4]);
+	time = (u32)((req.reply[0] << 24) | (req.reply[1] << 16) |
+		     (req.reply[2] << 8) | req.reply[3]);
 
 	return time - RTC_OFFSET;
 }
@@ -116,8 +115,7 @@ static void pmu_write_time(time64_t time)
 			(data >> 24) & 0xFF, (data >> 16) & 0xFF,
 			(data >> 8) & 0xFF, data & 0xFF) < 0)
 		return;
-	while (!req.complete)
-		pmu_poll();
+	pmu_wait_complete(&req);
 }
 
 static __u8 pmu_read_pram(int offset)