Re: [PATCH 2/2] PCI PM: Read device power state from register after updating it

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

 



On Tue, 26 May 2009 21:52:29 +0200
"Rafael J. Wysocki" <rjw@xxxxxxx> wrote:

> On Monday 18 May 2009, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rjw@xxxxxxx>
> > 
> > After attempting to change the power state of a PCI device
> > pci_raw_set_power_state() doesn't check if the value it wrote into
> > the device's PCI_PM_CTRL register has been stored in there.  Still,
> > it modifies the device's current_state field as though that's the
> > case.  This may cause the driver of the device to think that its
> > power state has been changed while in fact it hasn't.
> > 
> > To prevent such situations from happening modify
> > pci_raw_set_power_state() so that it reads the device's PCI_PM_CTRL
> > register after writing into it and uses the value read from the
> > register to update the device's current_state field.  Also make it
> > return -EIO if the new state of the device is not equal to the state
> > requested by the called.
> > 
> > To distinguish this error condition from the other ones make
> > pci_raw_set_power_state() return -ENOSYS instead of -EIO when it is
> > impossible to change the power state of the device, because it
> > doesn't support the native PCI PM at all or the requested target
> > state is not supported by it.
> 
> Having reconsidered it I think that -ENODEV is probably better than
> -ENOSYS for this purpose.  Updated patch follows.

Applied to linux-next, thanks Rafael.

-- 
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux