Re: [PATCH/RFT v2] gpio: gpio-rcar: Support S2RAM

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

 



On 12/24/2017 03:37 PM, Yoshihiro Kaneko wrote:
> From: Hien Dang <hien.dang.eb@xxxxxxxxxxx>
> 
> This patch adds an implementation that saves and restores the state of
> GPIO configuration on suspend and resume.
> 
> Signed-off-by: Hien Dang <hien.dang.eb@xxxxxxxxxxx>
> Signed-off-by: Takeshi Kihara <takeshi.kihara.df@xxxxxxxxxxx>
> [Modify structure of the bank info to simplify a saving registers]
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@xxxxxxxxx>
> ---

[snip]

> +static SIMPLE_DEV_PM_OPS(gpio_rcar_pm_ops,
> +		gpio_rcar_suspend, gpio_rcar_resume);
> +#define DEV_PM_OPS (&gpio_rcar_pm_ops)
> +#else
> +#define DEV_PM_OPS NULL
> +#endif /* CONFIG_PM_SLEEP*/
> +
>  static int gpio_rcar_probe(struct platform_device *pdev)
>  {
>  	struct gpio_rcar_priv *p;
> @@ -536,6 +604,7 @@ static int gpio_rcar_remove(struct platform_device *pdev)
>  	.remove		= gpio_rcar_remove,
>  	.driver		= {
>  		.name	= "gpio_rcar",
> +		.pm     = DEV_PM_OPS,
>  		.of_match_table = of_match_ptr(gpio_rcar_of_table),
>  	}
>  };
> 

You can safely follow the next simpler pattern (add pm functions after
gpio_rcar_remove() function and remove DEV_PM_OPS macro):

#ifdef CONFIG_PM_SLEEP
static int gpio_rcar_suspend(struct device *dev)
{
	...
}

static int gpio_rcar_resume(struct device *dev)
{
	...
}
#endif

static SIMPLE_DEV_PM_OPS(gpio_rcar_pm_ops, gpio_rcar_suspend, gpio_rcar_resume);

static struct platform_driver gpio_rcar_device_driver = {
        .probe          = gpio_rcar_probe,
	.remove		= gpio_rcar_remove,
	.driver		= {
		.name	= "gpio_rcar",
		.pm     = &gpio_rcar_pm_ops,
		.of_match_table = of_match_ptr(gpio_rcar_of_table),
	}
};

--
With best wishes,
Vladimir



[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux