Re: [PATCH 1/3] mfd: sta2x11-mfd: use named constants forpci_power_t values

From: Lee Jones
Date: Mon Jan 06 2014 - 06:01:59 EST


On Fri, 03 Jan 2014, Julia Lawall wrote:

> From: Julia Lawall <Julia.Lawall@xxxxxxx>
>
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
>
> // <smpl>
> @@
> expression pdev;
> @@
>
> pci_set_power_state(pdev,
> - 0
> + PCI_D0
> )
> // </smpl>

I'm happy with the code and that you used Coccinelle to discover the
issue, but I feel a little more explanation would be helpful to
readers.

Why is (pci_power_t __force) 0 better than 0?

> Signed-off-by: Julia Lawall <Julia.Lawall@xxxxxxx>
>
> ---
> drivers/mfd/sta2x11-mfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mfd/sta2x11-mfd.c b/drivers/mfd/sta2x11-mfd.c
> index 0d42e40..5b72db0 100644
> --- a/drivers/mfd/sta2x11-mfd.c
> +++ b/drivers/mfd/sta2x11-mfd.c
> @@ -529,7 +529,7 @@ static int sta2x11_mfd_resume(struct pci_dev *pdev)
> {
> int err;
>
> - pci_set_power_state(pdev, 0);
> + pci_set_power_state(pdev, PCI_D0);
> err = pci_enable_device(pdev);
> if (err)
> return err;
>

--
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org â Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/