Il Tue, Apr 10, 2007 at 12:13:21PM +0200, Pavel Machek ha scritto: 
> Hi!
> 
> > > >A while back I proposed a patch to support powerpc. The comments where
> > > >that it was a bit ugly with all those #ifdef's. Now the question is how
> > > >do I do this neatly?
> > > [...]
> > > >I could solve this as Stefan suggested like this:
> > > >
> > > >#ifdef CONFIG_PPC
> > > >int s2ram_hacks(void) return 0;
> > > >#else
> > > >int s2ram_hacks(void)
> > > >{
> > > >.
> > > >}
> > > >#end
> > > >
> > > >for a few functions. Still I would put a large part in #ifdef/#end
> > > >blocks, just because it is not used. Also there will be some #ifdefs left
> > > >in main.
> > > 
> > > Looking at the older patch:
> > > - move PMU check into s2ram_is_supported, return error on failure
> > > - rename s2ram_do_pmu to s2ram_hacks (and maybe find a better name for
> > > both); this would be the hook for doing platform-specific black magic
> > > (PMU_IOC_SLEEP for PPC)
> > > - nop for s2ram_resume()
> > > - not sure about command line arguments...
> > > 
> > > Then maybe split s2ram.c into s2ram, s2ram-x86.c and s2ram-ppc.c; this
> > > will ease the addition of a new platform.
> > 
> > Patch for the split (compile tested only). usage() and command line
> > handling  still require work, I'll think something (-ENOSLEEP now).
> > Btw, when test_mode is set there's a call to machine_known with id -1...
> > is this a leftover of some previous patch?
> 
> Yes, this looks like way to go.

Ok, I've done another iteration over this patch. I've splitted usage()
into a generic part and a platform specific function. Each arch can
provide additional command line options using S2RAM_PLATFORM_OPTS define
(a bit ugly, do you have a better solution?).

PPC part is a bit strange, in the original patch PMU_IOC_SLEEP was
exclusive with /sys/power/mem, i.e. s2ram_do() is called iff PMU is
supported _and_ PMU_IOC_SLEEP fails; is this correct?

I'll send a serie of 2 patches in reply to this mail: the first one
splits x86 specific code adding s2ram-x86.{c,h}; the second one adds PPC
support (s2ram-ppc.{c,h}).

Luca
-- 
Quando un uomo porta dei fiori a sua moglie senza motivo, 
un motivo c'e`.

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Suspend-devel mailing list
Suspend-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/suspend-devel

Reply via email to