linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <jdelvare@suse.de>
To: Anders Roxell <anders.roxell@linaro.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: i801: mark PM functions as __maybe_unused
Date: Wed, 9 May 2018 19:00:55 +0200	[thread overview]
Message-ID: <20180509190055.61ad929b@endymion> (raw)
In-Reply-To: <20180508073852.16840-1-anders.roxell@linaro.org>

Hi Anders,

On Tue,  8 May 2018 09:38:52 +0200, Anders Roxell wrote:
> With CONFIG_PM, we get a harmless build warning:
> drivers/i2c/busses/i2c-i801.c:1723:12: warning: ‘i801_resume’ defined but not used [-Wunused-function]
>  static int i801_resume(struct device *dev)
>             ^~~~~~~~~~~
> drivers/i2c/busses/i2c-i801.c:1714:12: warning: ‘i801_suspend’ defined but not used [-Wunused-function]
>  static int i801_suspend(struct device *dev)
>             ^~~~~~~~~~~~

I have CONFIG_PM=y and I don't get this warning, even with W=1. Which
gcc version are you using, which exact kernel version are you building,
and what is the value of all the CONFIG_PM_* options?

> This marks the affected functions as __maybe_unused.

I'm not a big fan of __maybe_unused, at least not in this specific
situation. We should be able to know exactly when these functions are
needed, and only include them when this is the case. Building unused
code just to discard it later (hopefully?) is a waste of CPU time.

> 
> Fixes: a9c8088c7988 ("i2c: i801: Don't restore config registers on runtime PM")

If SIMPLE_DEV_PM_OPS causes it but UNIVERSAL_DEV_PM_OPS did not, I
suppose that what matters is CONFIG_PM_SLEEP.

So maybe we can just replace "#ifdef CONFIG_PM" with "ifdef
CONFIG_PM_SLEEP" in the code below?

> Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
> ---
>  drivers/i2c/busses/i2c-i801.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
> index ed07f9002710..ff18c6ed2bec 100644
> --- a/drivers/i2c/busses/i2c-i801.c
> +++ b/drivers/i2c/busses/i2c-i801.c
> @@ -1711,7 +1711,7 @@ static void i801_shutdown(struct pci_dev *dev)
>  }
>  
>  #ifdef CONFIG_PM
> -static int i801_suspend(struct device *dev)
> +static int __maybe_unused i801_suspend(struct device *dev)
>  {
>  	struct pci_dev *pci_dev = to_pci_dev(dev);
>  	struct i801_priv *priv = pci_get_drvdata(pci_dev);
> @@ -1720,7 +1720,7 @@ static int i801_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int i801_resume(struct device *dev)
> +static int __maybe_unused i801_resume(struct device *dev)
>  {
>  	struct pci_dev *pci_dev = to_pci_dev(dev);
>  	struct i801_priv *priv = pci_get_drvdata(pci_dev);


-- 
Jean Delvare
SUSE L3 Support

  reply	other threads:[~2018-05-09 17:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-08  7:38 [PATCH] i2c: i801: mark PM functions as __maybe_unused Anders Roxell
2018-05-09 17:00 ` Jean Delvare [this message]
2018-05-10 13:27   ` Jean Delvare
2018-05-14  9:33     ` [PATCH v2] i2c: i801: fix unused-function warning Anders Roxell
2018-05-14 15:02       ` Jean Delvare
2018-05-14 17:18       ` Andy Shevchenko
2018-05-15  8:16         ` Jean Delvare
2018-05-17 13:54       ` Wolfram Sang
2018-05-25 21:09 [PATCH] i2c: i801: mark PM functions as __maybe_unused Arnd Bergmann
2018-05-25 21:57 ` Wolfram Sang

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=20180509190055.61ad929b@endymion \
    --to=jdelvare@suse.de \
    --cc=anders.roxell@linaro.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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).