Re: [PATCH] ahci: platform support for suspend/resume

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

 



On Wed, Nov 16, 2011 at 12:27:59PM -0800, Brian Norris wrote:
> Add platform hooks for custom suspend() and resume() functions. The
> generic suspend/resume code in drivers/ata/ahci_platform.c is adapted
> from the PCI version in drivers/ata/ahci.c.
> 
> Note that in order to suspend, we require that both suspend() and
> resume() functions be supplied.
> 
> Signed-off-by: Brian Norris <computersforpeace@xxxxxxxxx>
> ---
> Based on:
>     git://github.com/jgarzik/libata-dev.git ALL
> 
>  drivers/ata/ahci_platform.c   |   72 +++++++++++++++++++++++++++++++++++++++++
>  include/linux/ahci_platform.h |    2 +
>  2 files changed, 74 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c
> index ec55595..98bf5e9 100644
> --- a/drivers/ata/ahci_platform.c
> +++ b/drivers/ata/ahci_platform.c
> @@ -202,6 +202,75 @@ static int __devexit ahci_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +#ifdef CONFIG_PM
> +static int ahci_suspend(struct device *dev)
> +{
> +	struct ahci_platform_data *pdata = dev_get_platdata(dev);
> +	struct ata_host *host = dev_get_drvdata(dev);
> +	struct ahci_host_priv *hpriv = host->private_data;
> +	void __iomem *mmio = hpriv->mmio;
> +	u32 ctl;
> +	int rc;
> +
> +	/* Does platform support suspend/resume? */
> +	if (!pdata->suspend || !pdata->resume)
> +		return -EINVAL;

should you really prevent suspend is platform doesn't provide
->suspend() ?

I mean, we could some platform where all clocks are autogated and
there's no need for platform to do anything. Would it be better to only
call pdata->suspend if it exists but still let the AHCI-specific part go
through ?

-- 
balbi

Attachment: signature.asc
Description: Digital signature


[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