LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] SMC91x: delete unused local variable "lp"
@ 2008-10-29 13:56 Mike Frysinger
  2008-10-29 14:57 ` Nicolas Pitre
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Mike Frysinger @ 2008-10-29 13:56 UTC (permalink / raw)
  To: nico, netdev; +Cc: linux-kernel

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/net/smc91x.c |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index c70870e..6f9895d 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2060,7 +2060,6 @@ static int smc_request_attrib(struct platform_device *pdev,
 			      struct net_device *ndev)
 {
 	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
-	struct smc_local *lp = netdev_priv(ndev);
 
 	if (!res)
 		return 0;
@@ -2075,7 +2074,6 @@ static void smc_release_attrib(struct platform_device *pdev,
 			       struct net_device *ndev)
 {
 	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
-	struct smc_local *lp = netdev_priv(ndev);
 
 	if (res)
 		release_mem_region(res->start, ATTRIB_SIZE);
-- 
1.6.0.2


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

* Re: [PATCH] SMC91x: delete unused local variable "lp"
  2008-10-29 13:56 [PATCH] SMC91x: delete unused local variable "lp" Mike Frysinger
@ 2008-10-29 14:57 ` Nicolas Pitre
  2008-10-31  4:48 ` Jeff Garzik
  2008-11-03 16:45 ` Atsushi Nemoto
  2 siblings, 0 replies; 6+ messages in thread
From: Nicolas Pitre @ 2008-10-29 14:57 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: netdev, linux-kernel

On Wed, 29 Oct 2008, Mike Frysinger wrote:

> Signed-off-by: Mike Frysinger <vapier@gentoo.org>

Acked-by: Nicolas Pitre <nico@cam.org>


> ---
>  drivers/net/smc91x.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> index c70870e..6f9895d 100644
> --- a/drivers/net/smc91x.c
> +++ b/drivers/net/smc91x.c
> @@ -2060,7 +2060,6 @@ static int smc_request_attrib(struct platform_device *pdev,
>  			      struct net_device *ndev)
>  {
>  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> -	struct smc_local *lp = netdev_priv(ndev);
>  
>  	if (!res)
>  		return 0;
> @@ -2075,7 +2074,6 @@ static void smc_release_attrib(struct platform_device *pdev,
>  			       struct net_device *ndev)
>  {
>  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> -	struct smc_local *lp = netdev_priv(ndev);
>  
>  	if (res)
>  		release_mem_region(res->start, ATTRIB_SIZE);
> -- 
> 1.6.0.2
> 


Nicolas

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

* Re: [PATCH] SMC91x: delete unused local variable "lp"
  2008-10-29 13:56 [PATCH] SMC91x: delete unused local variable "lp" Mike Frysinger
  2008-10-29 14:57 ` Nicolas Pitre
@ 2008-10-31  4:48 ` Jeff Garzik
  2008-11-03 16:45 ` Atsushi Nemoto
  2 siblings, 0 replies; 6+ messages in thread
From: Jeff Garzik @ 2008-10-31  4:48 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: nico, netdev, linux-kernel

Mike Frysinger wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  drivers/net/smc91x.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> index c70870e..6f9895d 100644
> --- a/drivers/net/smc91x.c
> +++ b/drivers/net/smc91x.c
> @@ -2060,7 +2060,6 @@ static int smc_request_attrib(struct platform_device *pdev,
>  			      struct net_device *ndev)
>  {
>  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> -	struct smc_local *lp = netdev_priv(ndev);
>  
>  	if (!res)
>  		return 0;
> @@ -2075,7 +2074,6 @@ static void smc_release_attrib(struct platform_device *pdev,
>  			       struct net_device *ndev)
>  {
>  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> -	struct smc_local *lp = netdev_priv(ndev);
>  

applied



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

* Re: [PATCH] SMC91x: delete unused local variable "lp"
  2008-10-29 13:56 [PATCH] SMC91x: delete unused local variable "lp" Mike Frysinger
  2008-10-29 14:57 ` Nicolas Pitre
  2008-10-31  4:48 ` Jeff Garzik
@ 2008-11-03 16:45 ` Atsushi Nemoto
  2008-11-03 17:15   ` Nicolas Pitre
  2 siblings, 1 reply; 6+ messages in thread
From: Atsushi Nemoto @ 2008-11-03 16:45 UTC (permalink / raw)
  To: vapier; +Cc: nico, netdev, linux-kernel

On Wed, 29 Oct 2008 09:56:06 -0400, Mike Frysinger <vapier@gentoo.org> wrote:
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  drivers/net/smc91x.c |    2 --
>  1 files changed, 0 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> index c70870e..6f9895d 100644
> --- a/drivers/net/smc91x.c
> +++ b/drivers/net/smc91x.c
> @@ -2060,7 +2060,6 @@ static int smc_request_attrib(struct platform_device *pdev,
>  			      struct net_device *ndev)
>  {
>  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> -	struct smc_local *lp = netdev_priv(ndev);
>  
>  	if (!res)
>  		return 0;

The local variable 'lp' is actually used on some platforms (via
SMC_IO_SHIFT).

Please revert this change and do another way ("unused" marker or
something) to fix the warnings.

---
Atsushi Nemoto

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

* Re: [PATCH] SMC91x: delete unused local variable "lp"
  2008-11-03 16:45 ` Atsushi Nemoto
@ 2008-11-03 17:15   ` Nicolas Pitre
  2008-11-03 17:35     ` Mike Frysinger
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Pitre @ 2008-11-03 17:15 UTC (permalink / raw)
  To: Atsushi Nemoto; +Cc: vapier, netdev, lkml

On Tue, 4 Nov 2008, Atsushi Nemoto wrote:

> On Wed, 29 Oct 2008 09:56:06 -0400, Mike Frysinger <vapier@gentoo.org> wrote:
> > Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> > ---
> >  drivers/net/smc91x.c |    2 --
> >  1 files changed, 0 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
> > index c70870e..6f9895d 100644
> > --- a/drivers/net/smc91x.c
> > +++ b/drivers/net/smc91x.c
> > @@ -2060,7 +2060,6 @@ static int smc_request_attrib(struct platform_device *pdev,
> >  			      struct net_device *ndev)
> >  {
> >  	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
> > -	struct smc_local *lp = netdev_priv(ndev);
> >  
> >  	if (!res)
> >  		return 0;
> 
> The local variable 'lp' is actually used on some platforms (via
> SMC_IO_SHIFT).

Oops, indeed.

> Please revert this change and do another way ("unused" marker or
> something) to fix the warnings.

There were no warnings AFAIK.

Actually, the best fix might be the following patch:

-----
From: Nicolas Pitre <nico@cam.org>

Commit 51ac3beffd removed an apparently unused local variable from 
smc_request_attrib(), but some platforms actually needs the lp variable 
to define SMC_IO_SHIFT which is used to define ATTRIB_SIZE.

Let's always add a reference to lp to avoid such mistakes in the future,
which in the constant case gets optimized away at compile time.

Signed-off-by: Nicolas Pitre <nico@cam.org>

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 6f9895d..a657321 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -2060,6 +2060,7 @@ static int smc_request_attrib(struct platform_device *pdev,
 			      struct net_device *ndev)
 {
 	struct resource * res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "smc91x-attrib");
+	struct smc_local *lp = netdev_priv(ndev);
 
 	if (!res)
 		return 0;
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h
index a07cc93..23fc21a 100644
--- a/drivers/net/smc91x.h
+++ b/drivers/net/smc91x.h
@@ -91,7 +91,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	0
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	1
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT      	1
 #define SMC_USE_BFIN_DMA	0
 
@@ -106,7 +105,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	0
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	0
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT      	1
 #define SMC_USE_BFIN_DMA	0
 
@@ -138,7 +136,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_32BIT	0
 #define SMC_NOWAIT		1
 
-#define SMC_IO_SHIFT		0
 
 #define SMC_inw(a, r)		in_be16((volatile u16 *)((a) + (r)))
 #define SMC_outw(v, a, r)	out_be16((volatile u16 *)((a) + (r)), v)
@@ -172,7 +169,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	1
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	0
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT		1
 
 #define SMC_inb(a, r)		readb((a) + (r))
@@ -197,7 +193,7 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_NOWAIT		1
 
 /* The first two address lines aren't connected... */
-#define SMC_IO_SHIFT		2
+#define SMC_IO_SHIFT		(lp, 2)
 
 #define SMC_inb(a, r)		readb((a) + (r))
 #define SMC_outb(v, a, r)	writeb(v, (a) + (r))
@@ -210,7 +206,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	0
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	0
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT		1
 
 #define SMC_inw(a, r)		readw((a) + (r))
@@ -226,7 +221,6 @@ static inline void SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	1
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	1
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT		1
 #define SMC_USE_PXA_DMA		1
 
@@ -258,7 +252,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 #define SMC_CAN_USE_8BIT	0
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	0
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT		1
 
 #define SMC_inw(a, r)		readw((a) + (r))
@@ -387,7 +380,6 @@ static inline void LPD7_SMC_outsw (unsigned char* a, int r,
 #define SMC_CAN_USE_8BIT	0
 #define SMC_CAN_USE_16BIT	1
 #define SMC_CAN_USE_32BIT	0
-#define SMC_IO_SHIFT		0
 #define SMC_NOWAIT		1
 
 #define SMC_inw(a, r)		au_readw((unsigned long)((a) + (r)))
@@ -682,7 +674,7 @@ smc_pxa_dma_irq(int dma, void *dummy)
 #endif
 
 #ifndef SMC_IO_SHIFT
-#define SMC_IO_SHIFT	0
+#define SMC_IO_SHIFT	(lp, 0)
 #endif
 
 #ifndef	SMC_IRQ_FLAGS

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

* Re: [PATCH] SMC91x: delete unused local variable "lp"
  2008-11-03 17:15   ` Nicolas Pitre
@ 2008-11-03 17:35     ` Mike Frysinger
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2008-11-03 17:35 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: Atsushi Nemoto, netdev, lkml

you need to revert both functions.  David Miller has already posted a
patch which adds warning markers instead.
-mike

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

end of thread, other threads:[~2008-11-03 17:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-10-29 13:56 [PATCH] SMC91x: delete unused local variable "lp" Mike Frysinger
2008-10-29 14:57 ` Nicolas Pitre
2008-10-31  4:48 ` Jeff Garzik
2008-11-03 16:45 ` Atsushi Nemoto
2008-11-03 17:15   ` Nicolas Pitre
2008-11-03 17:35     ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).