/* Locking: Caller. Returns: -EINVAL if IPM is not supported, 0 otherwise.  */
void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy)
/* Locking: Caller. Returns: -EINVAL if IPM is not supported, 0 otherwise.  */
void ata_dev_enable_pm(struct ata_device *dev, enum link_pm policy)
{
	int rc = 0;
	struct ata_port *ap = dev->link->ap;
	if (ap->ops->enable_pm)
		rc = ap->ops->enable_pm(ap, policy);
	if (rc)
		goto enable_pm_out;
	rc = ata_dev_set_dipm(dev, policy);
enable_pm_out:
	if (rc)
		ap->pm_policy = MAX_PERFORMANCE;
	else
		ap->pm_policy = policy;
	return;
}