[linux-pm] Some thoughts on suspend/resume development

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

On Wed, 2005-03-09 at 08:54, Pavel Machek wrote:
> Hi!
> 
> > > For user suspends (made through sysfs) the user may want to convey
> > > arbitrary information to a driver, things like which clocks to turn
> > > off, which power level to change to, and so on.  This information
> > > will vary from driver to driver, and the PM core shouldn't even try to
> > > impose any sort of structure on it.  I think the best approach will be
> > > to pass to the driver a character pointer giving the data written to
> > > /sys/.../power/state, so that users can send whatever they want just
> > > by writing it to the file.  This means adding an additional field to
> > > pm_message_t.
> > 
> > Uh, that would really suck. This would entail a string parser in every
> > driver, which is what we wanted to get away from with sysfs. A better way
> > would be to have a driver export a file with the specific features that it
> > supports encoded in a meaningful and efficient way (i.e. a fixed-length
> > string, character, or constant).
> 
> [I'm not advocating char *, but: ] string parser in every driver does
> not neccessarily seem evil to me. In most cases it will be
> 
> 	if (!strcmp(state.string, "suspend")) {
> 		do something
> 	}
> 
> ..and that seems quite okay.

A number would be faster to parse. Perhaps we could use an ul for the
action, and a string for the parameters? That way you don't have to do n
strcmps in your drivers, but still get flexibility with the parameters.
The numbers for actions could also be standardised and perhaps used in
inter-driver communication (eg to get children suspended as well)?

Nigel
-- 
Nigel Cunningham
Software Engineer, Canberra, Australia
http://www.cyclades.com
Bus: +61 (2) 6291 9554; Hme: +61 (2) 6292 8028;  Mob: +61 (417) 100 574

Maintainer of Suspend2 Kernel Patches http://suspend2.net


[Index of Archives]     [Linux ACPI]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [CPU Freq]     [Kernel Newbies]     [Fedora Kernel]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux