/* Choose the power state appropriate for the device depending on whether it can wake up the system and/or is power manageable by the platform (PCI_D3hot is the default) and put the device into that state.  */
int pci_prepare_to_sleep(struct pci_dev *dev)
/* Choose the power state appropriate for the device depending on whether it can wake up the system and/or is power manageable by the platform (PCI_D3hot is the default) and put the device into that state.  */
int pci_prepare_to_sleep(struct pci_dev *dev)
{
	pci_power_t target_state = pci_target_state(dev);
	int error;
	if (target_state == PCI_POWER_ERROR)
		return -EIO;
	pci_enable_wake(dev, target_state, device_may_wakeup(&dev->dev));
	error = pci_set_power_state(dev, target_state);
	if (error)
		pci_enable_wake(dev, target_state, false);
	return error;
}