linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] PCI: imx6: Fix build error unused-function
@ 2022-07-24 10:13 Ren Zhijie
  2022-07-24 15:40 ` Arnd Bergmann
  0 siblings, 1 reply; 3+ messages in thread
From: Ren Zhijie @ 2022-07-24 10:13 UTC (permalink / raw)
  To: hongxing.zhu, l.stach, lpieralisi, robh, kw, bhelgaas
  Cc: linux-pci, linux-arm-kernel, linux-kernel, Ren Zhijie

If CONFIG_PM_SLEEP is not set,
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:

drivers/pci/controller/dwc/pci-imx6.c:973:13: error: ‘imx6_pcie_host_exit’ defined but not used [-Werror=unused-function]
 static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)
             ^~~~~~~~~~~~~~~~~~~
drivers/pci/controller/dwc/pci-imx6.c:904:13: error: ‘imx6_pcie_stop_link’ defined but not used [-Werror=unused-function]
 static void imx6_pcie_stop_link(struct dw_pcie *pci)
             ^~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [drivers/pci/controller/dwc/pci-imx6.o] Error 1

These two functions imx6_pcie_host_exit() and imx6_pcie_stop_link() only be called by imx6_pcie_suspend_noirq(), which was warpped by CONFIG_PM_SLEEP.
To fix build error unused-function, use __maybe_unused to attach them.

Fixes: 25ae5434c3de ("PCI: imx6: Reformat suspend callback to keep symmetric with resume")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 drivers/pci/controller/dwc/pci-imx6.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pci-imx6.c b/drivers/pci/controller/dwc/pci-imx6.c
index 55e109d1ab27..533f5ef68e94 100644
--- a/drivers/pci/controller/dwc/pci-imx6.c
+++ b/drivers/pci/controller/dwc/pci-imx6.c
@@ -901,7 +901,7 @@ static int imx6_pcie_start_link(struct dw_pcie *pci)
 	return 0;
 }
 
-static void imx6_pcie_stop_link(struct dw_pcie *pci)
+static void __maybe_unused imx6_pcie_stop_link(struct dw_pcie *pci)
 {
 	struct device *dev = pci->dev;
 
@@ -970,7 +970,7 @@ static int imx6_pcie_host_init(struct dw_pcie_rp *pp)
 	return ret;
 }
 
-static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)
+static void __maybe_unused imx6_pcie_host_exit(struct dw_pcie_rp *pp)
 {
 	struct dw_pcie *pci = to_dw_pcie_from_pp(pp);
 	struct imx6_pcie *imx6_pcie = to_imx6_pcie(pci);
-- 
2.17.1


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

* Re: [PATCH -next] PCI: imx6: Fix build error unused-function
  2022-07-24 10:13 [PATCH -next] PCI: imx6: Fix build error unused-function Ren Zhijie
@ 2022-07-24 15:40 ` Arnd Bergmann
  2022-07-25  2:45   ` Ren Zhijie
  0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2022-07-24 15:40 UTC (permalink / raw)
  To: Ren Zhijie
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci, Linux ARM,
	Linux Kernel Mailing List

On Sun, Jul 24, 2022 at 12:13 PM Ren Zhijie <renzhijie2@huawei.com> wrote:
>
> If CONFIG_PM_SLEEP is not set,
> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:
>
> drivers/pci/controller/dwc/pci-imx6.c:973:13: error: ‘imx6_pcie_host_exit’ defined but not used [-Werror=unused-function]
>  static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)
>              ^~~~~~~~~~~~~~~~~~~
> drivers/pci/controller/dwc/pci-imx6.c:904:13: error: ‘imx6_pcie_stop_link’ defined but not used [-Werror=unused-function]
>  static void imx6_pcie_stop_link(struct dw_pcie *pci)
>              ^~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[4]: *** [drivers/pci/controller/dwc/pci-imx6.o] Error 1
>
> These two functions imx6_pcie_host_exit() and imx6_pcie_stop_link() only be called by imx6_pcie_suspend_noirq(), which was warpped by CONFIG_PM_SLEEP.
> To fix build error unused-function, use __maybe_unused to attach them.
>
> Fixes: 25ae5434c3de ("PCI: imx6: Reformat suspend callback to keep symmetric with resume")
> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>

There is already a better fix for this, see
https://lore.kernel.org/all/20220719210427.GA1568454@bhelgaas/

If you come across other suspend/resume functions that trigger the
unused-function
warning, please use the same method there instead of adding __maybe_unused
or #ifdef annotations.

      Arnd

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

* Re: [PATCH -next] PCI: imx6: Fix build error unused-function
  2022-07-24 15:40 ` Arnd Bergmann
@ 2022-07-25  2:45   ` Ren Zhijie
  0 siblings, 0 replies; 3+ messages in thread
From: Ren Zhijie @ 2022-07-25  2:45 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Richard Zhu, Lucas Stach, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas, linux-pci, Linux ARM,
	Linux Kernel Mailing List

在 2022/7/24 23:40, Arnd Bergmann 写道:
> On Sun, Jul 24, 2022 at 12:13 PM Ren Zhijie <renzhijie2@huawei.com> wrote:
>> If CONFIG_PM_SLEEP is not set,
>> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:
>>
>> drivers/pci/controller/dwc/pci-imx6.c:973:13: error: ‘imx6_pcie_host_exit’ defined but not used [-Werror=unused-function]
>>   static void imx6_pcie_host_exit(struct dw_pcie_rp *pp)
>>               ^~~~~~~~~~~~~~~~~~~
>> drivers/pci/controller/dwc/pci-imx6.c:904:13: error: ‘imx6_pcie_stop_link’ defined but not used [-Werror=unused-function]
>>   static void imx6_pcie_stop_link(struct dw_pcie *pci)
>>               ^~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>> make[4]: *** [drivers/pci/controller/dwc/pci-imx6.o] Error 1
>>
>> These two functions imx6_pcie_host_exit() and imx6_pcie_stop_link() only be called by imx6_pcie_suspend_noirq(), which was warpped by CONFIG_PM_SLEEP.
>> To fix build error unused-function, use __maybe_unused to attach them.
>>
>> Fixes: 25ae5434c3de ("PCI: imx6: Reformat suspend callback to keep symmetric with resume")
>> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
> There is already a better fix for this, see
> https://lore.kernel.org/all/20220719210427.GA1568454@bhelgaas/
>
> If you come across other suspend/resume functions that trigger the
> unused-function
> warning, please use the same method there instead of adding __maybe_unused
> or #ifdef annotations.
>
>        Arnd

Hi, Arnd

Thanks for your reply. I have actually met the other warning, and I use 
the new  marco RUNTIME_PM_OPS to replace the old one,see

https://lore.kernel.org/all/20220725023611.57055-1-renzhijie2@huawei.com/


Thanks,

Ren Zhijie

> .


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

end of thread, other threads:[~2022-07-25  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-24 10:13 [PATCH -next] PCI: imx6: Fix build error unused-function Ren Zhijie
2022-07-24 15:40 ` Arnd Bergmann
2022-07-25  2:45   ` Ren Zhijie

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