On Mon, 16 Apr 2007 23:22:32 +0200 Luca Tettamanti <[EMAIL PROTECTED]> wrote:
> Il Mon, Apr 16, 2007 at 10:35:25PM +0200, Tim Dijkstra ha scritto:
> > On Sun, 15 Apr 2007 02:36:12 +0200
> > Luca Tettamanti <[EMAIL PROTECTED]> wrote:
> >
> > > > @@ -27,7 +27,16 @@
> > > > int s2ram_do(void)
> > > > {
> > > > int ret = 0;
> > > > - FILE *f = fopen("/sys/power/state", "w");
> > > > + FILE *f;
> > > > +
> > > > + /* If this works we're done. Else we just continue as if
> > > > nothing
> > > > + * happened, future kernels will work with /s/p/s. */
> > > > + ret = s2ram_do_pmu();
> > > > + if (!ret)
> > > > + return ret;
> > > > + ret = 0;
> > > > +
> > > > + f = fopen("/sys/power/state", "w");
> > > > if (!f) {
> > > > printf("/sys/power/state does not exist; what kind of
> > > > ninja mutant machine is this?\n");
> > > > return ENODEV;
> > >
> > > This is what I was trying to avoid. PMU in generic code is not nice.
> > > I've corrected the 'ARCH' bug above and added headers as per Pavel's
> > > comment.
> > >
> > > Anyway, since PPC actually wants to override (as in "do something
> > > different") s2ram_do it's also possibile to make it a weak symbol so
> > > that s2ram-ppc.c can provides its own implementation, will generic code
> > > contains a sensitive default. I'm attacching a patch with the weak
> > > symbol version.
> >
> > I don't think the s2ram_do_pmu call is that problematic to have in the
> > generic code.
> >
> > The trade of have to make is, do we want to duplicate
> > the /sys/power/state stuff or do we want an empty function in x86 piece
> > of the code.
> >
> > I think the latter is better choice.
>
> Well, it's possible to do something like this:
>
> int s2ram_default_do(void) {
> use /s/p/s
> }
>
> __attribute__((weak)) int s2ram_do(void) {
> return s2ram_default_do();
> }
>
> and then in PPC code:
>
> int s2ram_do(void) {
> poke PMU;
>
> return s2ram_default_do();
> }
I must confess that I didn't know about these fancy weak-linking stuff,
learned something new;) To me it seems a bit overkill, but logically it
seems the OK, so be my guest...
grts Tim
signature.asc
Description: PGP signature
------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/
_______________________________________________ Suspend-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/suspend-devel
