[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1F615B5A909C3342A3B7B4843796B9151C35E2A4@dggemi502-mbs.china.huawei.com>
Date: Fri, 11 May 2018 08:30:59 +0000
From: "chenyao (F)" <chenyao11@...wei.com>
To: Bjorn Helgaas <helgaas@...nel.org>
CC: songxiaowei <songxiaowei@...ilicon.com>,
Wangbinghui <wangbinghui@...ilicon.com>,
"lorenzo.pieralisi@....com" <lorenzo.pieralisi@....com>,
"bhelgaas@...gle.com" <bhelgaas@...gle.com>,
"xuwei (O)" <xuwei5@...wei.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"catalin.marinas@....com" <catalin.marinas@....com>,
"will.deacon@....com" <will.deacon@....com>,
"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
Suzhuangluan <suzhuangluan@...ilicon.com>,
Kongfei <kongfei@...ilicon.com>,
"dimitrysh@...gle.com" <dimitrysh@...gle.com>,
"guodong.xu@...aro.org" <guodong.xu@...aro.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Tejun Heo <tj@...nel.org>
Subject: RE: [PATCH v2 1/2] PCI: kirin: Add MSI support
Hi Bjorn,
>
> [+cc Tejun, Wolfram]
>
> On Wed, May 09, 2018 at 04:20:11PM +0800, Yao Chen wrote:
> > Add support for MSI.
> > ...
>
> > @@ -448,6 +467,26 @@ static int kirin_pcie_host_init(struct pcie_port
> > *pp) static int __init kirin_add_pcie_port(struct dw_pcie *pci,
> > struct platform_device *pdev) {
> > + int ret;
> > +
> > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> > + pci->pp.msi_irq = platform_get_irq(pdev, 0);
> > + if (!pci->pp.msi_irq) {
>
> I think this test is incorrect. platform_get_irq() returns a negative errno
> value when it fails. Most calls test "irq < 0" to check for failure.
>
> There's a lot of duplicated code like this, so maybe we should consider
> putting that check into devm_request_irq(), similar to what
> devm_ioremap_resource() does, so the driver code could look like this:
>
> pci->pp.msi_irq = platform_get_irq(pdev, 0);
> ret = devm_request_irq(&pdev->dev, pci->pp.msi_irq, ...);
> if (ret) {
> dev_err(&pdev->dev, "failed to request MSI IRQ\n");
> return ret;
> }
>
> The basic devm_ioremap_resource() motivation is here: 72f8c0bfa0de ("lib:
> devres: add convenience function to remap a resource") and the same
> considerations seem to apply here.
>
> But that's more than you need to do for *this* series. So for now, I would
> simply fix the test to check for "irq < 0" and update the messages as I
> mention below.
Thank you for pointing out my mistake. I'll fix it.
>
> > + dev_err(&pdev->dev, "failed to get msi irq[%d]\n",
> > + pci->pp.msi_irq);
> > + return -ENODEV;
> > + }
> > + ret = devm_request_irq(&pdev->dev, pci->pp.msi_irq,
> > + kirin_pcie_msi_irq_handler,
> > + IRQF_SHARED | IRQF_NO_THREAD,
> > + "kirin_pcie_msi", &pci->pp);
> > + if (ret) {
> > + dev_err(&pdev->dev, "failed to request msi
> irq[%d]\n",
>
> s/msi irq/MSI IRQ/ in both dev_err() messages above. This is because the
> message is English text (not code), and the convention is that non-words like
> these initialisms written in all caps.
>
> I would style the first one as "failed to get MSI IRQ (%d)" because the %d
> there is a return code, probably -ENXIO.
>
> The second one should be "failed to request MSI IRQ %d" because here
> the %d is the actual IRQ.
>
I'll fix it. Thanks again.
> > + pci->pp.msi_irq);
> > + return ret;
> > + }
> > + }
> > +
> > pci->pp.ops = &kirin_pcie_host_ops;
> >
> > return dw_pcie_host_init(&pci->pp);
> > --
> > 1.9.1
> >
Best regards,
Yao
Powered by blists - more mailing lists