linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
@ 2020-07-02  9:19 Wei Yongjun
  2020-07-02  9:36 ` Leon Romanovsky
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Wei Yongjun @ 2020-07-02  9:19 UTC (permalink / raw)
  To: Hulk Robot, Tariq Toukan, Jakub Kicinski, Vaibhav Gupta
  Cc: Wei Yongjun, netdev, linux-rdma

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@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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
--- a/drivers/net/ethernet/mellanox/mlx4/main.c
+++ 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)
 {
 	struct pci_dev *pdev = to_pci_dev(dev_d);
 	struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);
@@ -4385,7 +4385,7 @@ static int mlx4_suspend(struct device *dev_d)
 	return 0;
 }
 
-static int mlx4_resume(struct device *dev_d)
+static int __maybe_unused mlx4_resume(struct device *dev_d)
 {
 	struct pci_dev *pdev = to_pci_dev(dev_d);
 	struct mlx4_dev_persistent *persist = pci_get_drvdata(pdev);


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
  2020-07-02  9:19 [PATCH net-next] mlx4: Mark PM functions as __maybe_unused Wei Yongjun
@ 2020-07-02  9:36 ` Leon Romanovsky
  2020-07-02 10:27   ` Wei Yongjun
  2020-07-02 13:44 ` Jason Gunthorpe
  2020-07-02 21:24 ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Leon Romanovsky @ 2020-07-02  9:36 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Hulk Robot, Tariq Toukan, Jakub Kicinski, Vaibhav Gupta, netdev,
	linux-rdma

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")

I can't find this SHA-1, where did you get it?
And why doesn't mlx5 need this change?

Fixes: 86a3e5d02c20 ("net/mlx4_core: Add PCI calls for suspend/resume")

Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
  2020-07-02  9:36 ` Leon Romanovsky
@ 2020-07-02 10:27   ` Wei Yongjun
  2020-07-02 11:58     ` Leon Romanovsky
  0 siblings, 1 reply; 6+ messages in thread
From: Wei Yongjun @ 2020-07-02 10:27 UTC (permalink / raw)
  To: Leon Romanovsky
  Cc: Hulk Robot, Tariq Toukan, Jakub Kicinski, Vaibhav Gupta, netdev,
	linux-rdma



On 2020/7/2 17:36, Leon Romanovsky wrote:
> 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")
> 
> I can't find this SHA-1, where did you get it?

It is in the net-next tree.

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=0e3e206a3e12

> And why doesn't mlx5 need this change?
> 
> Fixes: 86a3e5d02c20 ("net/mlx4_core: Add PCI calls for suspend/resume")
> 
> Thanks
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
  2020-07-02 10:27   ` Wei Yongjun
@ 2020-07-02 11:58     ` Leon Romanovsky
  0 siblings, 0 replies; 6+ messages in thread
From: Leon Romanovsky @ 2020-07-02 11:58 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Hulk Robot, Tariq Toukan, Jakub Kicinski, Vaibhav Gupta, netdev,
	linux-rdma

On Thu, Jul 02, 2020 at 06:27:12PM +0800, Wei Yongjun wrote:
>
>
> On 2020/7/2 17:36, Leon Romanovsky wrote:
> > 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")
> >
> > I can't find this SHA-1, where did you get it?
>
> It is in the net-next tree.
>
> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=0e3e206a3e12

I see, thanks

>
> > And why doesn't mlx5 need this change?
> >
> > Fixes: 86a3e5d02c20 ("net/mlx4_core: Add PCI calls for suspend/resume")
> >
> > Thanks
> >

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
  2020-07-02  9:19 [PATCH net-next] mlx4: Mark PM functions as __maybe_unused Wei Yongjun
  2020-07-02  9:36 ` Leon Romanovsky
@ 2020-07-02 13:44 ` Jason Gunthorpe
  2020-07-02 21:24 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2020-07-02 13:44 UTC (permalink / raw)
  To: Wei Yongjun
  Cc: Hulk Robot, Tariq Toukan, Jakub Kicinski, Vaibhav Gupta, netdev,
	linux-rdma

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@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH net-next] mlx4: Mark PM functions as __maybe_unused
  2020-07-02  9:19 [PATCH net-next] mlx4: Mark PM functions as __maybe_unused Wei Yongjun
  2020-07-02  9:36 ` Leon Romanovsky
  2020-07-02 13:44 ` Jason Gunthorpe
@ 2020-07-02 21:24 ` David Miller
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2020-07-02 21:24 UTC (permalink / raw)
  To: weiyongjun1; +Cc: hulkci, tariqt, kuba, vaibhavgupta40, netdev, linux-rdma

From: Wei Yongjun <weiyongjun1@huawei.com>
Date: Thu, 2 Jul 2020 17:19:46 +0800

> 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@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-07-02 21:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-02  9:19 [PATCH net-next] mlx4: Mark PM functions as __maybe_unused Wei Yongjun
2020-07-02  9:36 ` Leon Romanovsky
2020-07-02 10:27   ` Wei Yongjun
2020-07-02 11:58     ` Leon Romanovsky
2020-07-02 13:44 ` Jason Gunthorpe
2020-07-02 21:24 ` David Miller

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).