All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m68k/mac: Use correct PMU response format
@ 2018-08-24  2:02 Finn Thain
  2018-08-31  7:01 ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Finn Thain @ 2018-08-24  2:02 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, linux-kernel

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.

Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
I mistakenly omitted this change from my PMU patch series when I
dropped "[PATCH v3 10/12] macintosh: Use common code to access RTC".
Version 4 of that series has since been merged, which unfortunately
means that pmu_read_time() has regressed on m68k PowerBooks. This
patch is intended to prevent that regression from appearing in v4.19.
---
 arch/m68k/mac/misc.c | 10 ++++------
 1 file 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)
-- 
2.16.4


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

* Re: [PATCH] m68k/mac: Use correct PMU response format
  2018-08-24  2:02 [PATCH] m68k/mac: Use correct PMU response format Finn Thain
@ 2018-08-31  7:01 ` Geert Uytterhoeven
  2018-08-31  7:12   ` Finn Thain
  0 siblings, 1 reply; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-08-31  7:01 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, Linux Kernel Mailing List

Hi Finn,

On Fri, Aug 24, 2018 at 4:02 AM Finn Thain <fthain@telegraphics.com.au> wrote:
> 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.
>
> Signed-off-by: Finn Thain <fthain@telegraphics.com.au>

Looks good to me, so I will queue as a fix for v4.19.

I guess the proper Fixes tag is:

Fixes: ebd722275f9cfc67 ("macintosh/via-pmu: Replace via-pmu68k driver
with via-pmu driver")

Can you please confirm? Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] m68k/mac: Use correct PMU response format
  2018-08-31  7:01 ` Geert Uytterhoeven
@ 2018-08-31  7:12   ` Finn Thain
  2018-08-31  7:41     ` Geert Uytterhoeven
  0 siblings, 1 reply; 4+ messages in thread
From: Finn Thain @ 2018-08-31  7:12 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: linux-m68k, Linux Kernel Mailing List

On Fri, 31 Aug 2018, Geert Uytterhoeven wrote:

> Hi Finn,
> 
> On Fri, Aug 24, 2018 at 4:02 AM Finn Thain <fthain@telegraphics.com.au> wrote:
> > 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.
> >
> > Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> 
> Looks good to me, so I will queue as a fix for v4.19.
> 

Thanks!

> I guess the proper Fixes tag is:
> 
> Fixes: ebd722275f9cfc67 ("macintosh/via-pmu: Replace via-pmu68k driver
> with via-pmu driver")
> 
> Can you please confirm? Thanks!
> 

If you want to add a 'fixes' tag, that would be it. I omitted the tag 
because a -stable tree isn't needed for this. I don't mind either way.

-- 

> Gr{oetje,eeting}s,
> 
>                         Geert
> 
> 

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

* Re: [PATCH] m68k/mac: Use correct PMU response format
  2018-08-31  7:12   ` Finn Thain
@ 2018-08-31  7:41     ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2018-08-31  7:41 UTC (permalink / raw)
  To: Finn Thain; +Cc: linux-m68k, Linux Kernel Mailing List

Hi Finn,

On Fri, Aug 31, 2018 at 9:12 AM Finn Thain <fthain@telegraphics.com.au> wrote:
> On Fri, 31 Aug 2018, Geert Uytterhoeven wrote:
> > On Fri, Aug 24, 2018 at 4:02 AM Finn Thain <fthain@telegraphics.com.au> wrote:
> > > 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.
> > >
> > > Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
> >
> > Looks good to me, so I will queue as a fix for v4.19.
> >
>
> Thanks!
>
> > I guess the proper Fixes tag is:
> >
> > Fixes: ebd722275f9cfc67 ("macintosh/via-pmu: Replace via-pmu68k driver
> > with via-pmu driver")
> >
> > Can you please confirm? Thanks!
> >
>
> If you want to add a 'fixes' tag, that would be it. I omitted the tag
> because a -stable tree isn't needed for this. I don't mind either way.

You never know who will backport the original series...

Thanks, applied and queued for v4.19.

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

end of thread, other threads:[~2018-08-31  7:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-24  2:02 [PATCH] m68k/mac: Use correct PMU response format Finn Thain
2018-08-31  7:01 ` Geert Uytterhoeven
2018-08-31  7:12   ` Finn Thain
2018-08-31  7:41     ` Geert Uytterhoeven

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.