Subject: Re: [PATCH] SMU LED driver

From: Benjamin Herrenschmidt <[email-masked]>
Date: Mon, 08 Jan 2007 12:02:45 +1100

On Sat, 2007-01-06 at 22:19 +0100, Michael Hanselmann wrote:
> On Tue, Dec 26, 2006 at 08:25:52AM +1100, Benjamin Herrenschmidt wrote:
> > On Sun, 2006-12-24 at 12:23 +0100, Michael Hanselmann wrote:
> > > This patch adds a driver for the front LED in recent PowerMacs which
> > > have an SMU.
> 
> > As for the PMU driver, I'm pretty unhappy that it sycnhronously waits
> > for the completion. The original code I wrote was fully asynchronous.
> 
> Unfortunately, I can't see another way than doing it synchronously when
> one shouldn't use kmalloc(). The command (struct smu_simple_cmd) is kept
> on the stack. It contains the buffer used for both sending and
> retrieving data to/from the SMU. Making it module-global wouldn't work,
> because one request could conflict with another. struct smu_cmd can't be
> locked, so we can't check or wait for the status like via-pmu-led does.
> So, what should I do?
> 
> On another note, it seems like the PMU LED driver is already
> asynchronous.

Just have 1 request allocated once for all. Then, have a global set to
what status you want the LED at. Once the completion of any request
arrives, if the new status is different from what you want, send a new
one to fix it up :-)

That's the easy way.

The old PMU code did something more subtle because it was based on the
assumption that the LED was used to emit "pulses" based on HD activity.

Ben.