From: Damien Le Moal <dlemoal@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>
Subject: Re: [PATCH] PCI: dw-rockchip: Add system PM support
Date: Fri, 11 Apr 2025 12:56:36 +0900 [thread overview]
Message-ID: <c9c68772-01ce-49a1-8fc2-02294209bbcc@kernel.org> (raw)
In-Reply-To: <b7c48a0e-650c-aa9b-3748-f8bd168984b3@rock-chips.com>
On 4/11/25 11:26, Shawn Lin wrote:
> 在 2025/04/11 星期五 10:02, Damien Le Moal 写道:
>> On 4/10/25 15:50, Shawn Lin wrote:
>>> +static int rockchip_pcie_suspend(struct device *dev)
>>> +{
>>> + struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
>>> + struct dw_pcie *pci = &rockchip->pci;
>>> + int ret;
>>> +
>>> + rockchip->intx = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_MASK_LEGACY);
>>> +
>>> + ret = dw_pcie_suspend_noirq(pci);
>>> + if (ret) {
>>> + dev_err(dev, "failed to suspend\n");
>>> + return ret;
>>> + }
>>> +
>>> + rockchip_pcie_phy_deinit(rockchip);
>>> + clk_bulk_disable_unprepare(rockchip->clk_cnt, rockchip->clks);
>>> + reset_control_assert(rockchip->rst);
>>> + if (rockchip->vpcie3v3)
>>> + regulator_disable(rockchip->vpcie3v3);
>>> + gpiod_set_value_cansleep(rockchip->rst_gpio, 0);
>>> +
>>> + return 0;
>>> +}
>>
>> This function needs a __maybe_unused in its declaration, otherwise, you get a
>> compilation warning when PM is not enabled.
>>
>> static int __maybe_unused rockchip_pcie_suspend(struct device *dev)
>>
>>
>
> Emm.. I don't see any host drivers with system PM support under
> drivers/pci/controller/ adds these :)
>
> #grep suspend drivers/pci/controller/ -rn | grep __maybe_unused | wc -l
> 0
>
> Anyway, will fix it.
If you do not add __maybe_unused, you get:
CC drivers/pci/controller/dwc/pcie-dw-rockchip.o
drivers/pci/controller/dwc/pcie-dw-rockchip.c:761:12: warning:
‘rockchip_pcie_resume’ defined but not used [-Wunused-function]
761 | static int rockchip_pcie_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~
drivers/pci/controller/dwc/pcie-dw-rockchip.c:737:12: warning:
‘rockchip_pcie_suspend’ defined but not used [-Wunused-function]
737 | static int rockchip_pcie_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
You do not get this for other controllers because they use
NOIRQ_SYSTEM_SLEEP_PM_OPS() to set the PM ops. Your patch uses
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() which is defined as:
#ifdef CONFIG_PM_SLEEP
#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#else
#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#endif
So unlike using directly NOIRQ_SYSTEM_SLEEP_PM_OPS(), the functions names are
actually never used when CONFIG_PM_SLEEP is not enabled.
So the fix is to do like other controllers and use NOIRQ_SYSTEM_SLEEP_PM_OPS()
or use __maybe_unused.
--
Damien Le Moal
Western Digital Research
WARNING: multiple messages have this Message-ID (diff)
From: Damien Le Moal <dlemoal@kernel.org>
To: Shawn Lin <shawn.lin@rock-chips.com>
Cc: linux-pci@vger.kernel.org, linux-rockchip@lists.infradead.org,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>
Subject: Re: [PATCH] PCI: dw-rockchip: Add system PM support
Date: Fri, 11 Apr 2025 12:56:36 +0900 [thread overview]
Message-ID: <c9c68772-01ce-49a1-8fc2-02294209bbcc@kernel.org> (raw)
In-Reply-To: <b7c48a0e-650c-aa9b-3748-f8bd168984b3@rock-chips.com>
On 4/11/25 11:26, Shawn Lin wrote:
> 在 2025/04/11 星期五 10:02, Damien Le Moal 写道:
>> On 4/10/25 15:50, Shawn Lin wrote:
>>> +static int rockchip_pcie_suspend(struct device *dev)
>>> +{
>>> + struct rockchip_pcie *rockchip = dev_get_drvdata(dev);
>>> + struct dw_pcie *pci = &rockchip->pci;
>>> + int ret;
>>> +
>>> + rockchip->intx = rockchip_pcie_readl_apb(rockchip, PCIE_CLIENT_INTR_MASK_LEGACY);
>>> +
>>> + ret = dw_pcie_suspend_noirq(pci);
>>> + if (ret) {
>>> + dev_err(dev, "failed to suspend\n");
>>> + return ret;
>>> + }
>>> +
>>> + rockchip_pcie_phy_deinit(rockchip);
>>> + clk_bulk_disable_unprepare(rockchip->clk_cnt, rockchip->clks);
>>> + reset_control_assert(rockchip->rst);
>>> + if (rockchip->vpcie3v3)
>>> + regulator_disable(rockchip->vpcie3v3);
>>> + gpiod_set_value_cansleep(rockchip->rst_gpio, 0);
>>> +
>>> + return 0;
>>> +}
>>
>> This function needs a __maybe_unused in its declaration, otherwise, you get a
>> compilation warning when PM is not enabled.
>>
>> static int __maybe_unused rockchip_pcie_suspend(struct device *dev)
>>
>>
>
> Emm.. I don't see any host drivers with system PM support under
> drivers/pci/controller/ adds these :)
>
> #grep suspend drivers/pci/controller/ -rn | grep __maybe_unused | wc -l
> 0
>
> Anyway, will fix it.
If you do not add __maybe_unused, you get:
CC drivers/pci/controller/dwc/pcie-dw-rockchip.o
drivers/pci/controller/dwc/pcie-dw-rockchip.c:761:12: warning:
‘rockchip_pcie_resume’ defined but not used [-Wunused-function]
761 | static int rockchip_pcie_resume(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~
drivers/pci/controller/dwc/pcie-dw-rockchip.c:737:12: warning:
‘rockchip_pcie_suspend’ defined but not used [-Wunused-function]
737 | static int rockchip_pcie_suspend(struct device *dev)
| ^~~~~~~~~~~~~~~~~~~~~
You do not get this for other controllers because they use
NOIRQ_SYSTEM_SLEEP_PM_OPS() to set the PM ops. Your patch uses
SET_NOIRQ_SYSTEM_SLEEP_PM_OPS() which is defined as:
#ifdef CONFIG_PM_SLEEP
#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \
NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#else
#define SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn)
#endif
So unlike using directly NOIRQ_SYSTEM_SLEEP_PM_OPS(), the functions names are
actually never used when CONFIG_PM_SLEEP is not enabled.
So the fix is to do like other controllers and use NOIRQ_SYSTEM_SLEEP_PM_OPS()
or use __maybe_unused.
--
Damien Le Moal
Western Digital Research
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
next prev parent reply other threads:[~2025-04-11 3:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-10 6:50 [PATCH] PCI: dw-rockchip: Add system PM support Shawn Lin
2025-04-10 6:50 ` Shawn Lin
2025-04-11 2:02 ` Damien Le Moal
2025-04-11 2:02 ` Damien Le Moal
2025-04-11 2:26 ` Shawn Lin
2025-04-11 2:26 ` Shawn Lin
2025-04-11 3:56 ` Damien Le Moal [this message]
2025-04-11 3:56 ` Damien Le Moal
2025-04-11 8:35 ` kernel test robot
2025-04-11 8:35 ` kernel test robot
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=c9c68772-01ce-49a1-8fc2-02294209bbcc@kernel.org \
--to=dlemoal@kernel.org \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=shawn.lin@rock-chips.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.