Skip to content

Commit 4e2ce40

Browse files
Yinghai Lujbarnes993
authored andcommitted
PCI: pciehp: make check_link_active more helpful
A few changes: - remove the 'inline' and let the complier decide - return a bool to indicate whether the link was active - add a debug message to indicate link state when it beocmes active Signed-off-by: Yinghai Lu <[email protected]> Signed-off-by: Jesse Barnes <[email protected]>
1 parent 2f5d8e4 commit 4e2ce40

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

drivers/pci/hotplug/pciehp_hpc.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,20 @@ static int pcie_write_cmd(struct controller *ctrl, u16 cmd, u16 mask)
241241
return retval;
242242
}
243243

244-
static inline int check_link_active(struct controller *ctrl)
244+
static bool check_link_active(struct controller *ctrl)
245245
{
246-
u16 link_status;
246+
bool ret = false;
247+
u16 lnk_status;
247248

248-
if (pciehp_readw(ctrl, PCI_EXP_LNKSTA, &link_status))
249-
return 0;
250-
return !!(link_status & PCI_EXP_LNKSTA_DLLLA);
249+
if (pciehp_readw(ctrl, PCI_EXP_LNKSTA, &lnk_status))
250+
return ret;
251+
252+
ret = !!(lnk_status & PCI_EXP_LNKSTA_DLLLA);
253+
254+
if (ret)
255+
ctrl_dbg(ctrl, "%s: lnk_status = %x\n", __func__, lnk_status);
256+
257+
return ret;
251258
}
252259

253260
static void pcie_wait_link_active(struct controller *ctrl)

0 commit comments

Comments
 (0)