From: Hans Zhang <18255117159@163.com>
To: lpieralisi@kernel.org, kw@linux.com, bhelgaas@google.com,
jingoohan1@gmail.com, manivannan.sadhasivam@linaro.org
Cc: cassel@kernel.org, robh@kernel.org, linux-pci@vger.kernel.org,
linux-kernel@vger.kernel.org, Hans Zhang <18255117159@163.com>
Subject: [PATCH 2/3] PCI: mobiveil: Refactor link status check
Date: Tue, 29 Apr 2025 01:10:26 +0800 [thread overview]
Message-ID: <20250428171027.13237-3-18255117159@163.com> (raw)
In-Reply-To: <20250428171027.13237-1-18255117159@163.com>
Update ls_g4_pcie_link_up() to return bool and simplify the LTSSM state
check. Align function signature in pcie-mobiveil.h to match the change,
ensuring consistency across the Mobiveil PCIe driver.
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c | 9 ++-------
drivers/pci/controller/mobiveil/pcie-mobiveil.h | 2 +-
2 files changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
index 5af22bee913b..1cf014051296 100644
--- a/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
+++ b/drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
@@ -53,18 +53,13 @@ static inline void ls_g4_pcie_pf_writel(struct ls_g4_pcie *pcie,
iowrite32(val, pcie->pci.csr_axi_slave_base + PCIE_PF_OFF + off);
}
-static int ls_g4_pcie_link_up(struct mobiveil_pcie *pci)
+static bool ls_g4_pcie_link_up(struct mobiveil_pcie *pci)
{
struct ls_g4_pcie *pcie = to_ls_g4_pcie(pci);
u32 state;
state = ls_g4_pcie_pf_readl(pcie, PCIE_PF_DBG);
- state = state & PF_DBG_LTSSM_MASK;
-
- if (state == PF_DBG_LTSSM_L0)
- return 1;
-
- return 0;
+ return (state & PF_DBG_LTSSM_MASK) == PF_DBG_LTSSM_L0;
}
static void ls_g4_pcie_disable_interrupt(struct ls_g4_pcie *pcie)
diff --git a/drivers/pci/controller/mobiveil/pcie-mobiveil.h b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
index e63abb887ee3..662f17f9bf65 100644
--- a/drivers/pci/controller/mobiveil/pcie-mobiveil.h
+++ b/drivers/pci/controller/mobiveil/pcie-mobiveil.h
@@ -160,7 +160,7 @@ struct mobiveil_root_port {
};
struct mobiveil_pab_ops {
- int (*link_up)(struct mobiveil_pcie *pcie);
+ bool (*link_up)(struct mobiveil_pcie *pcie);
};
struct mobiveil_pcie {
--
2.25.1
next prev parent reply other threads:[~2025-04-28 17:11 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-28 17:10 [PATCH 0/3] Standardize link status check to return bool Hans Zhang
2025-04-28 17:10 ` [PATCH 1/3] PCI: dwc: " Hans Zhang
2025-04-29 8:05 ` Niklas Cassel
2025-04-29 8:21 ` Hans Zhang
2025-04-28 17:10 ` Hans Zhang [this message]
2025-04-28 17:10 ` [PATCH 3/3] PCI: cadence: Simplify j721e link status check Hans Zhang
2025-05-02 15:36 ` [PATCH 0/3] Standardize link status check to return bool Manivannan Sadhasivam
2025-05-02 16:10 ` Hans Zhang
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=20250428171027.13237-3-18255117159@163.com \
--to=18255117159@163.com \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=jingoohan1@gmail.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--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
all inboxes | Powered by JetHome®