linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings
@ 2004-12-26 21:13 Jesper Juhl
  2004-12-27 17:21 ` Jörn Engel
  2005-01-05  0:26 ` Greg Ungerer
  0 siblings, 2 replies; 4+ messages in thread
From: Jesper Juhl @ 2004-12-26 21:13 UTC (permalink / raw)
  To: linux-mtd; +Cc: David Woodhouse, Jörn Engel, Greg Ungerer, linux-kernel


I took a look at the cause for these warnings in the 2.6.10 kernel,

drivers/mtd/maps/nettel.c:361: warning: assignment makes pointer from integer without a cast
drivers/mtd/maps/nettel.c:395: warning: assignment makes pointer from integer without a cast

and as far as I can see the casts in there (to unsigned long and back to 
void*) are completely unnessesary ('virt' in 'struct map_info' is a void 
__iomem *), and getting rid of those casts buys us a warning free build.

Are there any reasons not to apply the patch below?
Unfortunately I don't have hardware to test this patch, so it has been 
compile tested only.

Please keep me on CC since I'm not subscribed to linux-mtd.


Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>

diff -up linux-2.6.10-orig/drivers/mtd/maps/nettel.c linux-2.6.10/drivers/mtd/maps/nettel.c
--- linux-2.6.10-orig/drivers/mtd/maps/nettel.c	2004-12-24 22:34:27.000000000 +0100
+++ linux-2.6.10/drivers/mtd/maps/nettel.c	2004-12-26 22:00:07.000000000 +0100
@@ -332,8 +332,8 @@ int __init nettel_init(void)
 
 		/* Destroy useless AMD MTD mapping */
 		amd_mtd = NULL;
-		iounmap((void *) nettel_amd_map.virt);
-		nettel_amd_map.virt = (unsigned long) NULL;
+		iounmap(nettel_amd_map.virt);
+		nettel_amd_map.virt = NULL;
 #else
 		/* Only AMD flash supported */
 		return(-ENXIO);
@@ -357,8 +357,7 @@ int __init nettel_init(void)
 	/* Probe for the the size of the first Intel flash */
 	nettel_intel_map.size = maxsize;
 	nettel_intel_map.phys = intel0addr;
-	nettel_intel_map.virt = (unsigned long)
-		ioremap_nocache(intel0addr, maxsize);
+	nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
 	if (!nettel_intel_map.virt) {
 		printk("SNAPGEAR: failed to ioremap() ROMCS1\n");
 		return(-EIO);
@@ -366,8 +365,8 @@ int __init nettel_init(void)
 	simple_map_init(&nettel_intel_map);
 
 	intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
-	if (! intel_mtd) {
-		iounmap((void *) nettel_intel_map.virt);
+	if (!intel_mtd) {
+		iounmap(nettel_intel_map.virt);
 		return(-ENXIO);
 	}
 
@@ -388,11 +387,10 @@ int __init nettel_init(void)
 	/* Delete the old map and probe again to do both chips */
 	map_destroy(intel_mtd);
 	intel_mtd = NULL;
-	iounmap((void *) nettel_intel_map.virt);
+	iounmap(nettel_intel_map.virt);
 
 	nettel_intel_map.size = maxsize;
-	nettel_intel_map.virt = (unsigned long)
-		ioremap_nocache(intel0addr, maxsize);
+	nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
 	if (!nettel_intel_map.virt) {
 		printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n");
 		return(-EIO);
@@ -480,7 +478,7 @@ void __exit nettel_cleanup(void)
 		map_destroy(intel_mtd);
 	}
 	if (nettel_intel_map.virt) {
-		iounmap((void *)nettel_intel_map.virt);
+		iounmap(nettel_intel_map.virt);
 		nettel_intel_map.virt = 0;
 	}
 #endif




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

* Re: [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings
  2004-12-26 21:13 [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings Jesper Juhl
@ 2004-12-27 17:21 ` Jörn Engel
  2005-01-05  0:26 ` Greg Ungerer
  1 sibling, 0 replies; 4+ messages in thread
From: Jörn Engel @ 2004-12-27 17:21 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: linux-mtd, David Woodhouse, Jörn Engel, Greg Ungerer, linux-kernel

On Sun, 26 December 2004 22:13:48 +0100, Jesper Juhl wrote:
> 
> I took a look at the cause for these warnings in the 2.6.10 kernel,
> 
> drivers/mtd/maps/nettel.c:361: warning: assignment makes pointer from integer without a cast
> drivers/mtd/maps/nettel.c:395: warning: assignment makes pointer from integer without a cast
> 
> and as far as I can see the casts in there (to unsigned long and back to 
> void*) are completely unnessesary ('virt' in 'struct map_info' is a void 
> __iomem *), and getting rid of those casts buys us a warning free build.
> 
> Are there any reasons not to apply the patch below?
> Unfortunately I don't have hardware to test this patch, so it has been 
> compile tested only.

Neither do I, but the patch looks fine to me.  Give Greg a grace
period, in case he knows better.  And interpret this as a personal
opinion, not as dwmw2's final word.

If it helps:
Acked-by: Jörn Engel <joern@wh.fh-wedel.de>

Jörn

-- 
To recognize individual spam features you have to try to get into the
mind of the spammer, and frankly I want to spend as little time inside
the minds of spammers as possible.
-- Paul Graham

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

* Re: [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings
  2004-12-26 21:13 [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings Jesper Juhl
  2004-12-27 17:21 ` Jörn Engel
@ 2005-01-05  0:26 ` Greg Ungerer
  2005-01-05  9:45   ` Jesper Juhl
  1 sibling, 1 reply; 4+ messages in thread
From: Greg Ungerer @ 2005-01-05  0:26 UTC (permalink / raw)
  To: Jesper Juhl; +Cc: linux-mtd, David Woodhouse, Jörn Engel, linux-kernel

Hi Jesper,

Sorry for the slow response, I have been out on vacation the
last couple of weeks :-)


Jesper Juhl wrote:
> I took a look at the cause for these warnings in the 2.6.10 kernel,
> 
> drivers/mtd/maps/nettel.c:361: warning: assignment makes pointer from integer without a cast
> drivers/mtd/maps/nettel.c:395: warning: assignment makes pointer from integer without a cast
> 
> and as far as I can see the casts in there (to unsigned long and back to 
> void*) are completely unnessesary ('virt' in 'struct map_info' is a void 
> __iomem *), and getting rid of those casts buys us a warning free build.
> 
> Are there any reasons not to apply the patch below?
> Unfortunately I don't have hardware to test this patch, so it has been 
> compile tested only.

Looks good to me. I have applied it to my working tree.
Do you want me to send it to Linus?

Thanks
Greg




> Please keep me on CC since I'm not subscribed to linux-mtd.
> 
> 
> Signed-off-by: Jesper Juhl <juhl-lkml@dif.dk>
> 
> diff -up linux-2.6.10-orig/drivers/mtd/maps/nettel.c linux-2.6.10/drivers/mtd/maps/nettel.c
> --- linux-2.6.10-orig/drivers/mtd/maps/nettel.c	2004-12-24 22:34:27.000000000 +0100
> +++ linux-2.6.10/drivers/mtd/maps/nettel.c	2004-12-26 22:00:07.000000000 +0100
> @@ -332,8 +332,8 @@ int __init nettel_init(void)
>  
>  		/* Destroy useless AMD MTD mapping */
>  		amd_mtd = NULL;
> -		iounmap((void *) nettel_amd_map.virt);
> -		nettel_amd_map.virt = (unsigned long) NULL;
> +		iounmap(nettel_amd_map.virt);
> +		nettel_amd_map.virt = NULL;
>  #else
>  		/* Only AMD flash supported */
>  		return(-ENXIO);
> @@ -357,8 +357,7 @@ int __init nettel_init(void)
>  	/* Probe for the the size of the first Intel flash */
>  	nettel_intel_map.size = maxsize;
>  	nettel_intel_map.phys = intel0addr;
> -	nettel_intel_map.virt = (unsigned long)
> -		ioremap_nocache(intel0addr, maxsize);
> +	nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
>  	if (!nettel_intel_map.virt) {
>  		printk("SNAPGEAR: failed to ioremap() ROMCS1\n");
>  		return(-EIO);
> @@ -366,8 +365,8 @@ int __init nettel_init(void)
>  	simple_map_init(&nettel_intel_map);
>  
>  	intel_mtd = do_map_probe("cfi_probe", &nettel_intel_map);
> -	if (! intel_mtd) {
> -		iounmap((void *) nettel_intel_map.virt);
> +	if (!intel_mtd) {
> +		iounmap(nettel_intel_map.virt);
>  		return(-ENXIO);
>  	}
>  
> @@ -388,11 +387,10 @@ int __init nettel_init(void)
>  	/* Delete the old map and probe again to do both chips */
>  	map_destroy(intel_mtd);
>  	intel_mtd = NULL;
> -	iounmap((void *) nettel_intel_map.virt);
> +	iounmap(nettel_intel_map.virt);
>  
>  	nettel_intel_map.size = maxsize;
> -	nettel_intel_map.virt = (unsigned long)
> -		ioremap_nocache(intel0addr, maxsize);
> +	nettel_intel_map.virt = ioremap_nocache(intel0addr, maxsize);
>  	if (!nettel_intel_map.virt) {
>  		printk("SNAPGEAR: failed to ioremap() ROMCS1/2\n");
>  		return(-EIO);
> @@ -480,7 +478,7 @@ void __exit nettel_cleanup(void)
>  		map_destroy(intel_mtd);
>  	}
>  	if (nettel_intel_map.virt) {
> -		iounmap((void *)nettel_intel_map.virt);
> +		iounmap(nettel_intel_map.virt);
>  		nettel_intel_map.virt = 0;
>  	}
>  #endif
> 
> 
> 
> 

-- 
------------------------------------------------------------------------
Greg Ungerer  --  Chief Software Dude       EMAIL:     gerg@snapgear.com
SnapGear -- a CyberGuard Company            PHONE:       +61 7 3435 2888
825 Stanley St,                             FAX:         +61 7 3891 3630
Woolloongabba, QLD, 4102, Australia         WEB: http://www.SnapGear.com

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

* Re: [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings
  2005-01-05  0:26 ` Greg Ungerer
@ 2005-01-05  9:45   ` Jesper Juhl
  0 siblings, 0 replies; 4+ messages in thread
From: Jesper Juhl @ 2005-01-05  9:45 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Jesper Juhl, linux-mtd, David Woodhouse, Jörn Engel, linux-kernel

On Wed, 5 Jan 2005, Greg Ungerer wrote:

> 
> Sorry for the slow response, I have been out on vacation the
> last couple of weeks :-)
> 
I Hope you had a nice vacation. :)

> 
> Jesper Juhl wrote:
> > I took a look at the cause for these warnings in the 2.6.10 kernel,
> > 
> > drivers/mtd/maps/nettel.c:361: warning: assignment makes pointer from
> > integer without a cast
> > drivers/mtd/maps/nettel.c:395: warning: assignment makes pointer from
> > integer without a cast
> > 
> > and as far as I can see the casts in there (to unsigned long and back to
> > void*) are completely unnessesary ('virt' in 'struct map_info' is a void
> > __iomem *), and getting rid of those casts buys us a warning free build.
> > 
> > Are there any reasons not to apply the patch below?
> > Unfortunately I don't have hardware to test this patch, so it has been
> > compile tested only.
> 
> Looks good to me. I have applied it to my working tree.
> Do you want me to send it to Linus?
> 

I'd appreciate that.

-- 
Jesper Juhl


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

end of thread, other threads:[~2005-01-05  9:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-26 21:13 [patch] remove unnessesary casts from drivers/mtd/maps/nettel.c and kill two warnings Jesper Juhl
2004-12-27 17:21 ` Jörn Engel
2005-01-05  0:26 ` Greg Ungerer
2005-01-05  9:45   ` Jesper Juhl

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).