2018-05-14 01:11:48

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: reply: [PATCH v3 1/2] PCI: kirin: Add MSI support

Hi, Andy Shevchenko

Yao is on maternity leave, and I'll take over the job after discussing with her.

> -----邮件原件-----
> 发件人: Andy Shevchenko [mailto:[email protected]]
> 发送时间: 2018年5月14日 7:16
> 收件人: chenyao (F) <[email protected]>
> 抄送: songxiaowei <[email protected]>; Wangbinghui
> <[email protected]>; Lorenzo Pieralisi <[email protected]>;
> Bjorn Helgaas <[email protected]>; xuwei (O) <[email protected]>;
> Rob Herring <[email protected]>; Mark Rutland <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected]; Linux Kernel Mailing List
> <[email protected]>; linux-arm Mailing List
> <[email protected]>; devicetree
> <[email protected]>; [email protected];
> [email protected]; Suzhuangluan <[email protected]>; Kongfei
> <[email protected]>
> 主题: Re: [PATCH v3 1/2] PCI: kirin: Add MSI support
>
> On Fri, May 11, 2018 at 12:15 PM, Yao Chen <[email protected]> wrote:
> > Add support for MSI.
>
>
> > + int ret;
> > +
> > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
>
> > + pci->pp.msi_irq = platform_get_irq(pdev, 0);
> > + if (pci->pp.msi_irq < 0) {
> > + dev_err(&pdev->dev, "failed to get MSI IRQ
> (%d)\n",
> > + pci->pp.msi_irq);
>
> > + return -ENODEV;
>
> Why shadowing actual error code?
[songxiaowei] Sorry, I can't get your point about this, would you explain it for me.
>
> > + }
> > + 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",
> > + pci->pp.msi_irq);
> > + return ret;
> > + }
>
> It would be easy to read and maintain if this would be a separate function.
[songxiaowei] Yes, a separate function will be better, and I'll fix it.
>
> > + }
>
>
>
> --
> With Best Regards,
> Andy Shevchenko

Thanks a lot,

Best Regards,
Xiaowei Song


2018-05-14 07:18:33

by Andy Shevchenko

[permalink] [raw]
Subject: Re: reply: [PATCH v3 1/2] PCI: kirin: Add MSI support

On Mon, May 14, 2018 at 4:11 AM, songxiaowei <[email protected]> wrote:

>> > + int ret;
>> > +
>> > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
>>
>> > + pci->pp.msi_irq = platform_get_irq(pdev, 0);
>> > + if (pci->pp.msi_irq < 0) {
>> > + dev_err(&pdev->dev, "failed to get MSI IRQ
>> (%d)\n",
>> > + pci->pp.msi_irq);
>>
>> > + return -ENODEV;
>>
>> Why shadowing actual error code?
> [songxiaowei] Sorry, I can't get your point about this, would you explain it for me.

platform_get_irq() returns either correct IRQ number or negative error code.
In the code above you shadow the actual error (as returned by that
call) by -ENODEV. Any reason why?

--
With Best Regards,
Andy Shevchenko

2018-05-14 07:42:29

by Songxiaowei (Kirin_DRV)

[permalink] [raw]
Subject: 答复: reply: [PATCH v3 1/2] PCI: kirin: Add MSI support

Hi Andy Shevchenko

> -----邮件原件-----
> 发件人: Andy Shevchenko [mailto:[email protected]]
> 发送时间: 2018年5月14日 15:17
> 收件人: songxiaowei <[email protected]>
> 抄送: chenyao (F) <[email protected]>; Wangbinghui
> <[email protected]>; Lorenzo Pieralisi <[email protected]>;
> Bjorn Helgaas <[email protected]>; xuwei (O) <[email protected]>;
> Rob Herring <[email protected]>; Mark Rutland <[email protected]>;
> Catalin Marinas <[email protected]>; Will Deacon
> <[email protected]>; [email protected]; Linux Kernel Mailing List
> <[email protected]>; linux-arm Mailing List
> <[email protected]>; devicetree
> <[email protected]>; [email protected];
> [email protected]; Suzhuangluan <[email protected]>; Kongfei
> <[email protected]>
> 主题: Re: reply: [PATCH v3 1/2] PCI: kirin: Add MSI support
>
> On Mon, May 14, 2018 at 4:11 AM, songxiaowei <[email protected]>
> wrote:
>
> >> > + int ret;
> >> > +
> >> > + if (IS_ENABLED(CONFIG_PCI_MSI)) {
> >>
> >> > + pci->pp.msi_irq = platform_get_irq(pdev, 0);
> >> > + if (pci->pp.msi_irq < 0) {
> >> > + dev_err(&pdev->dev, "failed to get MSI IRQ
> >> (%d)\n",
> >> > + pci->pp.msi_irq);
> >>
> >> > + return -ENODEV;
> >>
> >> Why shadowing actual error code?
> > [songxiaowei] Sorry, I can't get your point about this, would you explain it
> for me.
>
> platform_get_irq() returns either correct IRQ number or negative error code.
> In the code above you shadow the actual error (as returned by that
> call) by -ENODEV. Any reason why?
>
[songxiaowei] I guess the reason is that she wanted to keep the same with other hosts,
So, you'd like to use "return pci->pp.msi_irq " instead of " return -ENODEV ".
> --
> With Best Regards,
> Andy Shevchenko

Thanks a lot,
Xiaowei.