Re: [patch] pm: fix runtime powermanagement's /sys interface

Patrick Mochel
2006-01-06T00:04:07Z

On Fri, 6 Jan 2006, Pavel Machek wrote:

> On Pá 06-01-06 00:46:29, Dominik Brodowski wrote:
> > On Fri, Jan 06, 2006 at 12:08:49AM +0100, Pavel Machek wrote:
> > > Ok, so lets at least add value-checking to .../power file, and prevent
> > > userspace see changes to PM_EVENT_SUSPEND value. 2 and 0 are now
> > > "arbitrary cookies". I'd like to use "on" and "off", but pcmcia
> > > apparently depends on "2" and "0", so...
> > >
> > > Any objections?
> >
> > Sorry, but yes -- the same as before, minus the PCMCIA breakage.
>
> I don't understand at this point.
>
> Current code takes value from user, and passes it down to driver,
> without any checking. If user writes 666 into the file, it will
> happily pass down 666 to the driver. Driver does not expect 666 in
> pm_message_t.event. It may oops, BUG_ON() or anything like that.
>
> Shall I change
>
> #define PM_EVENT_SUSPEND 2
>
> to
>
> #define PM_EVENT_SUSPEND 1324
>
> to get my point across? This is kernel-specific value, it should not
> be exported to userland.

A better point, and one that would actually be useful, would be to remove
the file altogether. Let Dominik export a power file, with complete
control over the values, for each pcmcia device. Then you never have to
worry about breaking PCMCIA again.

Thanks,

Patrick