Re: [PATCH] PCI: mediatek-gen3: Print LTSSM state when PCIe link down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2022-03-28 at 16:39 +0200, AngeloGioacchino Del Regno wrote:
> Il 24/03/22 08:25, Jianjun Wang ha scritto:
> > Print current LTSSM state when PCIe link down instead of the
> > register
> > value, make it easier to get the link status.
> > 
> > Signed-off-by: Jianjun Wang <jianjun.wang@xxxxxxxxxxxx>
> 
> Hello Jianjun,
> this patch is really helpful when comes to understand the source of
> an issue,
> so I agree with it - and thank you for that.
> 
> Though, I think that you should still print the hex number along with
> the
> meaning of it, check below:
> 
> > ---
> >   drivers/pci/controller/pcie-mediatek-gen3.c | 40
> > ++++++++++++++++++++-
> >   1 file changed, 39 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/pci/controller/pcie-mediatek-gen3.c
> > b/drivers/pci/controller/pcie-mediatek-gen3.c
> > index 7705d61fba4c..54663f025e27 100644
> > --- a/drivers/pci/controller/pcie-mediatek-gen3.c
> > +++ b/drivers/pci/controller/pcie-mediatek-gen3.c
> 
> ..snip..
> 
> > @@ -327,8 +358,15 @@ static int mtk_pcie_startup_port(struct
> > mtk_gen3_pcie *pcie)
> >   				 !!(val & PCIE_PORT_LINKUP), 20,
> >   				 PCI_PM_D3COLD_WAIT * USEC_PER_MSEC);
> >   	if (err) {
> > +		const char *ltssm_state;
> > +		int ltssm_index;
> > +
> >   		val = readl_relaxed(pcie->base +
> > PCIE_LTSSM_STATUS_REG);
> > -		dev_err(pcie->dev, "PCIe link down, ltssm reg val:
> > %#x\n", val);
> > +		ltssm_index = PCIE_LTSSM_STATE(val);
> > +		ltssm_state = ltssm_index >= ARRAY_SIZE(ltssm_str) ?
> > +			      "Unknown state" : ltssm_str[ltssm_index];
> > +		dev_err(pcie->dev, "PCIe link down, current ltssm
> > state: %s\n",
> 
> There, I think that you should do:
> 
> dev_err(pcie->dev, "PCIe link down, current LTSSM state: %s (%#x)\n",
> 	ltssm_state, val);
> 
> this will be extremely useful in the "Unknown state" case.
> 
> After fixing that,
> 
> Reviewed-by: AngeloGioacchino Del Regno <
> angelogioacchino.delregno@xxxxxxxxxxxxx>

Thanks!

> 
> Regards,
> Angelo




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux