]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: mobiveil: Return bool from link up check
authorHans Zhang <18255117159@163.com>
Sat, 10 May 2025 16:07:09 +0000 (00:07 +0800)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Tue, 13 May 2025 09:16:48 +0000 (10:16 +0100)
PCIe link status check is supposed to return a boolean to indicate whether
the link is up or not. So update ls_g4_pcie_link_up() to return bool and
also simplify the LTSSM state check.

Signed-off-by: Hans Zhang <18255117159@163.com>
[mani: commit message rewording]
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20250510160710.392122-3-18255117159@163.com
drivers/pci/controller/mobiveil/pcie-layerscape-gen4.c
drivers/pci/controller/mobiveil/pcie-mobiveil.h

index 5af22bee913bdc7e7cba4e123a202913d930f8f1..1cf014051296a90976c9f290df55c0d247ca286e 100644 (file)
@@ -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)
index e63abb887ee3c01e5f3da04a72b21e95ce51d471..662f17f9bf65c18f5e818fe3724e93dd9df08490 100644 (file)
@@ -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 {