public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] use named constants for pci_power_t values
@ 2014-01-02 23:40 Julia Lawall
  2014-01-02 23:40 ` [PATCH 1/3] mfd: sta2x11-mfd: " Julia Lawall
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Julia Lawall @ 2014-01-02 23:40 UTC (permalink / raw)
  To: alsa-devel; +Cc: kernel-janitors, linux-kernel, netdev

Replace numbers by named constants.  The complete semantic patch used is as
follows (http://coccinelle.lip6.fr/):

// <smpl>
@@
expression pdev;
@@

pci_set_power_state(pdev,
(
- 0
+ PCI_D0
|
- 1
+ PCI_D1
|
- 2
+ PCI_D2
|
- 3
+ PCI_D3hot
|
- 4
+ PCI_D3cold
|
- 5
+ PCI_UNKNOWN
|
- -1
+ PCI_POWER_ERROR
)
 )

@@
expression e1,e2;
@@

pci_enable_wake(e1,
(
- 0
+ PCI_D0
|
- 1
+ PCI_D1
|
- 2
+ PCI_D2
|
- 3
+ PCI_D3hot
|
- 4
+ PCI_D3cold
|
- 5
+ PCI_UNKNOWN
|
- -1
+ PCI_POWER_ERROR
)
,e2)
// </smpl>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH 1/3] mfd: sta2x11-mfd: use named constants for pci_power_t values
  2014-01-02 23:40 [PATCH 0/3] use named constants for pci_power_t values Julia Lawall
@ 2014-01-02 23:40 ` Julia Lawall
  2014-01-06 11:01   ` Lee Jones
  2014-01-02 23:40 ` [PATCH 2/3] ALSA: cs5535audio: " Julia Lawall
  2014-01-02 23:40 ` [PATCH 3/3] smsc9420: " Julia Lawall
  2 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2014-01-02 23:40 UTC (permalink / raw)
  To: Samuel Ortiz; +Cc: kernel-janitors, Lee Jones, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

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>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 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;


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 2/3] ALSA: cs5535audio: use named constants for pci_power_t values
  2014-01-02 23:40 [PATCH 0/3] use named constants for pci_power_t values Julia Lawall
  2014-01-02 23:40 ` [PATCH 1/3] mfd: sta2x11-mfd: " Julia Lawall
@ 2014-01-02 23:40 ` Julia Lawall
  2014-01-05 10:44   ` Takashi Iwai
  2014-01-02 23:40 ` [PATCH 3/3] smsc9420: " Julia Lawall
  2 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2014-01-02 23:40 UTC (permalink / raw)
  To: Jaya Kumar
  Cc: kernel-janitors, Jaroslav Kysela, Takashi Iwai, alsa-devel,
	linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression pdev;
@@

pci_set_power_state(pdev,
- 3
+ PCI_D3hot
 )
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 sound/pci/cs5535audio/cs5535audio.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 902bebd..c0d2835 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -253,7 +253,7 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id)
 static int snd_cs5535audio_free(struct cs5535audio *cs5535au)
 {
 	synchronize_irq(cs5535au->irq);
-	pci_set_power_state(cs5535au->pci, 3);
+	pci_set_power_state(cs5535au->pci, PCI_D3hot);
 
 	if (cs5535au->irq >= 0)
 		free_irq(cs5535au->irq, cs5535au);


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH 3/3] smsc9420: use named constants for pci_power_t values
  2014-01-02 23:40 [PATCH 0/3] use named constants for pci_power_t values Julia Lawall
  2014-01-02 23:40 ` [PATCH 1/3] mfd: sta2x11-mfd: " Julia Lawall
  2014-01-02 23:40 ` [PATCH 2/3] ALSA: cs5535audio: " Julia Lawall
@ 2014-01-02 23:40 ` Julia Lawall
  2014-01-04  0:59   ` David Miller
  2 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2014-01-02 23:40 UTC (permalink / raw)
  To: Steve Glendinning; +Cc: kernel-janitors, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression e1,e2;
@@

pci_enable_wake(e1,
- 0
+ PCI_D0
,e2)
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 drivers/net/ethernet/smsc/smsc9420.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/smsc/smsc9420.c b/drivers/net/ethernet/smsc/smsc9420.c
index 9d6effe..d3b967a 100644
--- a/drivers/net/ethernet/smsc/smsc9420.c
+++ b/drivers/net/ethernet/smsc/smsc9420.c
@@ -1540,7 +1540,7 @@ static int smsc9420_resume(struct pci_dev *pdev)
 
 	pci_set_master(pdev);
 
-	err = pci_enable_wake(pdev, 0, 0);
+	err = pci_enable_wake(pdev, PCI_D0, 0);
 	if (err)
 		netif_warn(pd, ifup, pd->dev, "pci_enable_wake failed: %d\n",
 			   err);


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 3/3] smsc9420: use named constants for pci_power_t values
  2014-01-02 23:40 ` [PATCH 3/3] smsc9420: " Julia Lawall
@ 2014-01-04  0:59   ` David Miller
  0 siblings, 0 replies; 9+ messages in thread
From: David Miller @ 2014-01-04  0:59 UTC (permalink / raw)
  To: Julia.Lawall; +Cc: steve.glendinning, kernel-janitors, netdev, linux-kernel

From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Fri,  3 Jan 2014 00:40:31 +0100

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
 ...
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Applied, thanks Julia.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/3] ALSA: cs5535audio: use named constants for pci_power_t values
  2014-01-02 23:40 ` [PATCH 2/3] ALSA: cs5535audio: " Julia Lawall
@ 2014-01-05 10:44   ` Takashi Iwai
  0 siblings, 0 replies; 9+ messages in thread
From: Takashi Iwai @ 2014-01-05 10:44 UTC (permalink / raw)
  To: Julia Lawall
  Cc: Jaya Kumar, kernel-janitors, Jaroslav Kysela, alsa-devel,
	linux-kernel

At Fri,  3 Jan 2014 00:40:30 +0100,
Julia Lawall wrote:
> 
> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> The semantic patch that makes this change is as follows:
> (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression pdev;
> @@
> 
> pci_set_power_state(pdev,
> - 3
> + PCI_D3hot
>  )
> // </smpl>
> 
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

Thanks, applied.


Takashi

> 
> ---
>  sound/pci/cs5535audio/cs5535audio.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
> index 902bebd..c0d2835 100644
> --- a/sound/pci/cs5535audio/cs5535audio.c
> +++ b/sound/pci/cs5535audio/cs5535audio.c
> @@ -253,7 +253,7 @@ static irqreturn_t snd_cs5535audio_interrupt(int irq, void *dev_id)
>  static int snd_cs5535audio_free(struct cs5535audio *cs5535au)
>  {
>  	synchronize_irq(cs5535au->irq);
> -	pci_set_power_state(cs5535au->pci, 3);
> +	pci_set_power_state(cs5535au->pci, PCI_D3hot);
>  
>  	if (cs5535au->irq >= 0)
>  		free_irq(cs5535au->irq, cs5535au);
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] mfd: sta2x11-mfd: use named constants for pci_power_t values
  2014-01-02 23:40 ` [PATCH 1/3] mfd: sta2x11-mfd: " Julia Lawall
@ 2014-01-06 11:01   ` Lee Jones
  2014-01-06 11:17     ` Julia Lawall
  0 siblings, 1 reply; 9+ messages in thread
From: Lee Jones @ 2014-01-06 11:01 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Samuel Ortiz, kernel-janitors, linux-kernel

On Fri, 03 Jan 2014, Julia Lawall wrote:

> From: Julia Lawall <Julia.Lawall@lip6.fr>
> 
> 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@lip6.fr>
> 
> ---
>  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] mfd: sta2x11-mfd: use named constants for pci_power_t values
  2014-01-06 11:01   ` Lee Jones
@ 2014-01-06 11:17     ` Julia Lawall
  2014-01-06 11:49       ` Lee Jones
  0 siblings, 1 reply; 9+ messages in thread
From: Julia Lawall @ 2014-01-06 11:17 UTC (permalink / raw)
  To: Lee Jones; +Cc: Julia Lawall, Samuel Ortiz, kernel-janitors, linux-kernel

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1689 bytes --]

On Mon, 6 Jan 2014, Lee Jones wrote:

> On Fri, 03 Jan 2014, Julia Lawall wrote:
>
> > From: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > 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?

I wasn't particularly attached to the cast, and I don't know if it is an
issue.  But in trying to understand the code, I found PCI_D0 more
understandable than 0.

julia

> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> >  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 kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 1/3] mfd: sta2x11-mfd: use named constants for pci_power_t values
  2014-01-06 11:17     ` Julia Lawall
@ 2014-01-06 11:49       ` Lee Jones
  0 siblings, 0 replies; 9+ messages in thread
From: Lee Jones @ 2014-01-06 11:49 UTC (permalink / raw)
  To: Julia Lawall; +Cc: Samuel Ortiz, kernel-janitors, linux-kernel

> > > From: Julia Lawall <Julia.Lawall@lip6.fr>
> > >
> > > 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?
> 
> I wasn't particularly attached to the cast, and I don't know if it is an
> issue.  But in trying to understand the code, I found PCI_D0 more
> understandable than 0.

Well I don't want to waste any of your or my time, so I'll apply the
patch and add something along those lines to the commit message.

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-01-06 11:49 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-02 23:40 [PATCH 0/3] use named constants for pci_power_t values Julia Lawall
2014-01-02 23:40 ` [PATCH 1/3] mfd: sta2x11-mfd: " Julia Lawall
2014-01-06 11:01   ` Lee Jones
2014-01-06 11:17     ` Julia Lawall
2014-01-06 11:49       ` Lee Jones
2014-01-02 23:40 ` [PATCH 2/3] ALSA: cs5535audio: " Julia Lawall
2014-01-05 10:44   ` Takashi Iwai
2014-01-02 23:40 ` [PATCH 3/3] smsc9420: " Julia Lawall
2014-01-04  0:59   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox