Re: [PATCH 06/10] libata: implement new Power Management framework

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

 



On Tue, 2006-06-13 at 00:50 +0900, Tejun Heo wrote:

>  int ata_pci_device_suspend(struct pci_dev *pdev, pm_message_t state)
>  {
> -	pci_save_state(pdev);
> -	pci_disable_device(pdev);
> +	struct ata_host_set *first_hset = dev_get_drvdata(&pdev->dev);
> +	struct ata_host_set *host_set;
> +	int rc = 0;
> +
> +	for (host_set = first_hset; host_set; host_set = host_set->next) {
> +		rc = ata_host_set_suspend(host_set, state);
> +		if (rc)
> +			break;
> +	}
>  
> -	if (state.event == PM_EVENT_SUSPEND)
> -		pci_set_power_state(pdev, PCI_D3hot);
> +	if (rc == 0) {
> +		pci_save_state(pdev);
> +		pci_disable_device(pdev);
>  
> -	return 0;
> +		if (state.event == PM_EVENT_SUSPEND)
> +			pci_set_power_state(pdev, PCI_D3hot);
> +	} else {
> +		/* Resume the first host_set too if the second one
> +		 * failed to sleep.
> +		 */
> +		if (host_set != first_hset)
> +			ata_host_set_resume(first_hset);
> +	}
> +
> +	return rc;
>  }

Is it possible to add a callback in ata_pci_device_suspend() to do
controller-level operation before calling pci_save_state()......?
One possible solution is to put this callback into a structure together
with host_set.
Otherwise user-defined ahci_pci_device_suspend() will duplicate most
code of ata_pci_device_suspend().

Thanks,
Forrest
-
: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux