From: Manivannan Sadhasivam <mani@kernel.org>
To: Johan Hovold <johan+linaro@kernel.org>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Andy Gross" <agross@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Rob Herring" <robh@kernel.org>,
"Nirmal Patel" <nirmal.patel@linux.intel.com>,
"Jonathan Derrick" <jonathan.derrick@linux.dev>,
linux-arm-msm@vger.kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/6] PCI/ASPM: Clean up disable link state parameter
Date: Fri, 17 Nov 2023 16:05:14 +0530 [thread overview]
Message-ID: <20231117103514.GN250770@thinkpad> (raw)
In-Reply-To: <20231114135553.32301-6-johan+linaro@kernel.org>
On Tue, Nov 14, 2023 at 02:55:52PM +0100, Johan Hovold wrote:
> Replace the current 'sem' parameter to the __pci_disable_link_state()
> helper with a more descriptive 'locked' parameter, which indicates
> whether a pci_bus_sem read lock is already held.
>
> Signed-off-by: Johan Hovold <johan+linaro@kernel.org>
> ---
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> drivers/pci/pcie/aspm.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
> index 8cf8cc2d6bba..19b7256d2dc9 100644
> --- a/drivers/pci/pcie/aspm.c
> +++ b/drivers/pci/pcie/aspm.c
> @@ -1041,7 +1041,7 @@ static struct pcie_link_state *pcie_aspm_get_link(struct pci_dev *pdev)
> return bridge->link_state;
> }
>
> -static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
> +static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool locked)
> {
> struct pcie_link_state *link = pcie_aspm_get_link(pdev);
>
> @@ -1060,7 +1060,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
> return -EPERM;
> }
>
> - if (sem)
> + if (!locked)
> down_read(&pci_bus_sem);
> mutex_lock(&aspm_lock);
> if (state & PCIE_LINK_STATE_L0S)
> @@ -1082,7 +1082,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
> link->clkpm_disable = 1;
> pcie_set_clkpm(link, policy_to_clkpm_state(link));
> mutex_unlock(&aspm_lock);
> - if (sem)
> + if (!locked)
> up_read(&pci_bus_sem);
>
> return 0;
> @@ -1090,7 +1090,7 @@ static int __pci_disable_link_state(struct pci_dev *pdev, int state, bool sem)
>
> int pci_disable_link_state_locked(struct pci_dev *pdev, int state)
> {
> - return __pci_disable_link_state(pdev, state, false);
> + return __pci_disable_link_state(pdev, state, true);
> }
> EXPORT_SYMBOL(pci_disable_link_state_locked);
>
> @@ -1105,7 +1105,7 @@ EXPORT_SYMBOL(pci_disable_link_state_locked);
> */
> int pci_disable_link_state(struct pci_dev *pdev, int state)
> {
> - return __pci_disable_link_state(pdev, state, true);
> + return __pci_disable_link_state(pdev, state, false);
> }
> EXPORT_SYMBOL(pci_disable_link_state);
>
> --
> 2.41.0
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2023-11-17 10:35 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 13:55 [PATCH 0/6] PCI: Fix deadlocks when enabling ASPM Johan Hovold
2023-11-14 13:55 ` [PATCH 1/6] PCI/ASPM: Add locked helper for enabling link state Johan Hovold
2023-11-15 14:26 ` kernel test robot
2023-11-15 16:06 ` Johan Hovold
2023-11-17 10:27 ` Manivannan Sadhasivam
2023-11-17 10:30 ` Johan Hovold
2023-11-17 10:50 ` Manivannan Sadhasivam
2023-11-17 10:28 ` Manivannan Sadhasivam
2023-11-18 0:00 ` David E. Box
2023-11-20 8:33 ` Johan Hovold
2023-11-14 13:55 ` [PATCH 2/6] PCI: vmd: Fix deadlock when enabling ASPM Johan Hovold
2023-11-17 10:28 ` Manivannan Sadhasivam
2023-11-14 13:55 ` [PATCH 3/6] PCI: qcom: " Johan Hovold
2023-11-17 10:28 ` Manivannan Sadhasivam
2023-11-14 13:55 ` [PATCH 4/6] PCI: qcom: Clean up ASPM comment Johan Hovold
2023-11-17 10:32 ` Manivannan Sadhasivam
2023-11-17 10:48 ` Johan Hovold
2023-11-17 10:54 ` Manivannan Sadhasivam
2023-11-17 11:00 ` Johan Hovold
2023-11-17 11:23 ` Manivannan Sadhasivam
2023-11-17 14:03 ` Johan Hovold
2023-11-14 13:55 ` [PATCH 5/6] PCI/ASPM: Clean up disable link state parameter Johan Hovold
2023-11-17 10:35 ` Manivannan Sadhasivam [this message]
2023-11-14 13:55 ` [PATCH 6/6] PCI/ASPM: Add lockdep assert to link state helper Johan Hovold
2023-11-17 10:36 ` Manivannan Sadhasivam
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=20231117103514.GN250770@thinkpad \
--to=mani@kernel.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=bhelgaas@google.com \
--cc=johan+linaro@kernel.org \
--cc=jonathan.derrick@linux.dev \
--cc=konrad.dybcio@linaro.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=nirmal.patel@linux.intel.com \
--cc=robh@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