RE: [PATCH V2 1/4] PCI: imx6: Add pci host wakeup support on imx platforms.

From: Sherry Sun
Date: Wed Dec 13 2023 - 23:08:22 EST




> -----Original Message-----
> From: Bjorn Helgaas <helgaas@xxxxxxxxxx>
> Sent: 2023年12月14日 3:58
> To: Sherry Sun <sherry.sun@xxxxxxx>
> Cc: Hongxing Zhu <hongxing.zhu@xxxxxxx>; l.stach@xxxxxxxxxxxxxx;
> lpieralisi@xxxxxxxxxx; kw@xxxxxxxxx; robh@xxxxxxxxxx;
> bhelgaas@xxxxxxxxxx; krzysztof.kozlowski+dt@xxxxxxxxxx;
> conor+dt@xxxxxxxxxx; shawnguo@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx;
> kernel@xxxxxxxxxxxxxx; festevam@xxxxxxxxx; dl-linux-imx <linux-
> imx@xxxxxxx>; linux-pci@xxxxxxxxxxxxxxx; linux-arm-
> kernel@xxxxxxxxxxxxxxxxxxx; devicetree@xxxxxxxxxxxxxxx; linux-
> kernel@xxxxxxxxxxxxxxx
> Subject: Re: [PATCH V2 1/4] PCI: imx6: Add pci host wakeup support on imx
> platforms.
>
> Drop period at the end of subject line. It only adds the possibility of
> unnecessary line wrapping in git log.

Hi Bjorn, thanks for the comments, will do in V3.

>
> On Wed, Dec 13, 2023 at 05:28:47PM +0800, Sherry Sun wrote:
> > Add pci host wakeup feature for imx platforms.
>
> s/pci/PCI/
> s/imx/i.MX/ (based on how nxp.com web pages refer to it)
>

Will do.

> > Example of configuring the corresponding dts property under the PCI
> > node:
> > wake-gpios = <&gpio5 21 GPIO_ACTIVE_LOW>;
>
> Add newline between paragraphs or wrap into a single paragraph.

Will do.

>
> > + /* host wakeup support */
> > + imx6_pcie->host_wake_irq = -1;
>
> AFAIK, 0 is an invalid IRQ value. So why not drop this assignment since
> imx6_pcie->host_wake_irq is 0 by default since it was allocated with
> devm_kzalloc(), and test like this elsewhere:
>
> if (imx6_pcie->host_wake_irq) {
> enable_irq_wake(imx6_pcie->host_wake_irq)

I plan to change the host_wake_irq to unsigned int type, and add following codes, then "if (imx6_pcie->host_wake_irq)" condition seems more reasonable, let me know if you have any further suggestions. thanks!
- imx6_pcie->host_wake_irq = gpiod_to_irq(host_wake_gpio);
+ ret = gpiod_to_irq(host_wake_gpio);
+ if (ret < 0)
+ return dev_err_probe(dev, ret, "Failed to get IRQ for WAKE gpio\n");
+
+ imx6_pcie->host_wake_irq = (unsigned int)ret;

>
> > + host_wake_gpio = devm_gpiod_get_optional(dev, "wake",
> GPIOD_IN);
> > + if (IS_ERR(host_wake_gpio))
> > + return PTR_ERR(host_wake_gpio);
> > +
> > + if (host_wake_gpio != NULL) {
>
> if (host_wake_gpio)

Will do.

Best Regards
Sherry