[linux-pm] [PATCH 5/5] [pci pm] Make pci_choose_state() use the real device state requested

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

 



On Sat, 18 Feb 2006, Pavel Machek wrote:

> Hi!
>
> >  	case PM_EVENT_FREEZE:
> >  	case PM_EVENT_SUSPEND:
> > -		return PCI_D3hot;
> > +		if (msg.state && msg.state <= PCI_D3hot)
> > +			state = msg.state;
> > +		break;
> >  	default:
>
> Silently ignores wrong value passed-in by user. Not nice...

The value is bounded, so anything passed above PCI_D3hot is translated to
PCI_D3hot.

[ That's the best we can do since we can't report an error nicely because
the pci_choose_state() interface was poorly designed. The function must be
called by the drivers, and returns a pci_power_t. It is not expected to
fail, and the argument is usually passed unchecked to
pci_set_power_state().

It would have been much safer to have pci_device_suspend() in
drivers/pci/pci-driver.c call pci_choose_state() to translate the value.
That could easily verify the user input, and it could just pass the
translated state to the drivers, which would have been compatible with the
previous API and not required a change to every single PCI driver.. ]

Thanks,


	Pat


[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