linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aisheng DONG <aisheng.dong@nxp.com>
To: Joakim Zhang <qiangqing.zhang@nxp.com>,
	"linux-can@vger.kernel.org" <linux-can@vger.kernel.org>,
	"mkl@pengutronix.de" <mkl@pengutronix.de>
Cc: "wg@grandegger.com" <wg@grandegger.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	dl-linux-imx <linux-imx@nxp.com>
Subject: RE: [PATCH V4 1/1] can: flexcan: add self wakeup support
Date: Thu, 22 Nov 2018 02:30:46 +0000	[thread overview]
Message-ID: <AM0PR04MB4211B8283948F8DB63115DD580DB0@AM0PR04MB4211.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <20181121122957.2684-2-qiangqing.zhang@nxp.com>

[...]

> +
> +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


  parent reply	other threads:[~2018-11-22  2:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-21 12:32 [PATCH V4 0/1] can: flexcan: add self wakeup support Joakim Zhang
2018-11-21 12:32 ` [PATCH V4 1/1] " Joakim Zhang
2018-11-21 13:00   ` Aisheng DONG
2018-11-21 13:01     ` Aisheng DONG
2018-11-22  1:28       ` Joakim Zhang
2018-11-22  1:20     ` Joakim Zhang
2018-11-22  2:30   ` Aisheng DONG [this message]
2018-11-22  5:08     ` Joakim Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AM0PR04MB4211B8283948F8DB63115DD580DB0@AM0PR04MB4211.eurprd04.prod.outlook.com \
    --to=aisheng.dong@nxp.com \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=qiangqing.zhang@nxp.com \
    --cc=wg@grandegger.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).