[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200702134417.GA689088@nvidia.com>
Date: Thu, 2 Jul 2020 10:44:17 -0300
From: Jason Gunthorpe <jgg@...dia.com>
To: Wei Yongjun <weiyongjun1@...wei.com>
CC: Hulk Robot <hulkci@...wei.com>, Tariq Toukan <tariqt@...lanox.com>,
"Jakub Kicinski" <kuba@...nel.org>,
Vaibhav Gupta <vaibhavgupta40@...il.com>,
<netdev@...r.kernel.org>, <linux-rdma@...r.kernel.org>
Subject: Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
On Thu, Jul 02, 2020 at 05:19:46PM +0800, Wei Yongjun wrote:
> In certain configurations without power management support, the
> following warnings happen:
>
> drivers/net/ethernet/mellanox/mlx4/main.c:4388:12:
> warning: 'mlx4_resume' defined but not used [-Wunused-function]
> 4388 | static int mlx4_resume(struct device *dev_d)
> | ^~~~~~~~~~~
> drivers/net/ethernet/mellanox/mlx4/main.c:4373:12: warning:
> 'mlx4_suspend' defined but not used [-Wunused-function]
> 4373 | static int mlx4_suspend(struct device *dev_d)
> | ^~~~~~~~~~~~
>
> Mark these functions as __maybe_unused to make it clear to the
> compiler that this is going to happen based on the configuration,
> which is the standard for these types of functions.
>
> Fixes: 0e3e206a3e12 ("mlx4: use generic power management")
> Reported-by: Hulk Robot <hulkci@...wei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@...wei.com>
> drivers/net/ethernet/mellanox/mlx4/main.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c
> index 4cae7db8d49c..954c22c79f6b 100644
> +++ b/drivers/net/ethernet/mellanox/mlx4/main.c
> @@ -4370,7 +4370,7 @@ static const struct pci_error_handlers mlx4_err_handler = {
> .resume = mlx4_pci_resume,
> };
>
> -static int mlx4_suspend(struct device *dev_d)
> +static int __maybe_unused mlx4_suspend(struct device *dev_d)
> {
This seems like a poor idea, every place using SIMPLE_DEV_PM_OPS would
need this annotation.
Seems better to add something to the macro, IMHO
Jason
Powered by blists - more mailing lists