lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200907262145.46363.rjw@sisk.pl>
Date:	Sun, 26 Jul 2009 21:45:45 +0200
From:	"Rafael J. Wysocki" <rjw@...k.pl>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
Cc:	Erik Ekman <erik@...o.se>, Frans Pop <elendil@...net.nl>,
	Alan Cox <alan@...ux.intel.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 -tip][RFC] serial8250: update to dev_pm_ops

On Sunday 26 July 2009, Dmitry Torokhov wrote:
> On Jul 25, 2009, at 1:59 PM, Erik Ekman <erik@...o.se> wrote:
> 
> > serial8250: update to dev_pm_ops
> >
> > From dmesg:
> > Platform driver 'serial8250' needs updating - please use dev_pm_ops
> >
> > Signed-off-by: Erik Ekman <erik@...o.se>
> > --
> > Updated to handle hibernation as understood based on info from  
> > Rafael J. Wysocki.
> > Please let me know if any special handling is needed.
> >
> > diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
> > index fb867a9..e93222c 100644
> > --- a/drivers/serial/8250.c
> > +++ b/drivers/serial/8250.c
> > @@ -2982,42 +2982,50 @@ static int __devexit serial8250_remove 
> > (struct platform_device *dev)
> >    return 0;
> > }
> >
> > -static int serial8250_suspend(struct platform_device *dev,  
> > pm_message_t state)
> > +static int serial8250_suspend(struct device *dev)
> > {
> >    int i;
> >
> >    for (i = 0; i < UART_NR; i++) {
> >        struct uart_8250_port *up = &serial8250_ports[i];
> >
> > -        if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev- 
> > >dev)
> > +        if (up->port.type != PORT_UNKNOWN && up->port.dev == dev)
> >            uart_suspend_port(&serial8250_reg, &up->port);
> >    }
> >
> >    return 0;
> > }
> >
> > -static int serial8250_resume(struct platform_device *dev)
> > +static int serial8250_resume(struct device *dev)
> > {
> >    int i;
> >
> >    for (i = 0; i < UART_NR; i++) {
> >        struct uart_8250_port *up = &serial8250_ports[i];
> >
> > -        if (up->port.type != PORT_UNKNOWN && up->port.dev == &dev- 
> > >dev)
> > +        if (up->port.type != PORT_UNKNOWN && up->port.dev == dev)
> >            serial8250_resume_port(i);
> >    }
> >
> >    return 0;
> > }
> >
> > +static struct dev_pm_ops serial8250_pm_ops = {
> > +    .resume   = serial8250_resume,
> > +    .suspend  = serial8250_suspend,
> > +    .freeze   = serial8250_resume,
> > +    .thaw     = serial8250_suspend,
> > +    .restore  = serial8250_resume,
> > +    .poweroff = serial8250_suspend,
> > +};
> 
> 
> Do we really both freeze and poweroff for serial port? I am getting  
> wary of these mechanical conversions...

And this one is incorrect, because I made a mistake in one of my previous
messages.  Obviously _suspend() should not be used for .thaw(), but for
.freeze(), and analogously with _resume().

Also, .poweroff() in probably unnecessary and .freeze() is only necessary if
there's anything to be saved before hibernation and restored during the
subsequent resume.

In fact, I wouldn't advise anyone to do these conversions mechanically.

Best,
Rafael
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ