[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM0PR04MB4211B8283948F8DB63115DD580DB0@AM0PR04MB4211.eurprd04.prod.outlook.com>
Date: Thu, 22 Nov 2018 02:30:46 +0000
From: Aisheng DONG <aisheng.dong@....com>
To: Joakim Zhang <qiangqing.zhang@....com>,
"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
"mkl@...gutronix.de" <mkl@...gutronix.de>
CC: "wg@...ndegger.com" <wg@...ndegger.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: RE: [PATCH V4 1/1] can: flexcan: add self wakeup support
[...]
> +
> +static int __maybe_unused flexcan_noirq_suspend(struct device *device)
> +{
> + struct net_device *dev = dev_get_drvdata(device);
> + struct flexcan_priv *priv = netdev_priv(dev);
> +
> + if (netif_running(dev) && device_may_wakeup(device))
> + flexcan_enable_wakeup_irq(priv, true);
> +
> + return 0;
> +}
> +
> +static int __maybe_unused flexcan_noirq_resume(struct device *device) {
> + struct net_device *dev = dev_get_drvdata(device);
> + struct flexcan_priv *priv = netdev_priv(dev);
> +
> + if (netif_running(dev) && device_may_wakeup(device)) {
> + disable_irq_wake(dev->irq);
A bit more thinking:
Can we put flexcan_enable_wakeup_irq(priv, false) here and move disable_irq_wake
to resume function?
Then it looks better on pairs for those functions.
I'm not sure if irq will be lost or we may even not need wakeup irq.
Please help check it.
Regards
Dong Aisheng
> + flexcan_exit_stop_mode(priv);
> }
> +
> return 0;
> }
>
> -static SIMPLE_DEV_PM_OPS(flexcan_pm_ops, flexcan_suspend,
> flexcan_resume);
> +static const struct dev_pm_ops flexcan_pm_ops = {
> + SET_SYSTEM_SLEEP_PM_OPS(flexcan_suspend, flexcan_resume)
> + SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(flexcan_noirq_suspend,
> +flexcan_noirq_resume) };
>
> static struct platform_driver flexcan_driver = {
> .driver = {
> --
> 2.17.1
Powered by blists - more mailing lists