Subject: Re: [PATCH 1/1] netdev: DM9000: Added typecasting to supress some warnings on Blackfin

From: Stephen Hemminger <[email-masked]>
Date: Mon, 13 Oct 2008 05:41:19 -0700

On Mon, 13 Oct 2008 17:10:09 +0800
Bryan Wu <[email-masked]> wrote:

> From: Javier Herrero <[email-masked]>
> 
> Signed-off-by: Javier Herrero <[email-masked]>
> Signed-off-by: Bryan Wu <[email-masked]>
> ---
>  drivers/net/dm9000.c |   12 ++++++------
>  1 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/dm9000.c b/drivers/net/dm9000.c
> index f42c23f..c4737ca 100644
> --- a/drivers/net/dm9000.c
> +++ b/drivers/net/dm9000.c
> @@ -188,35 +188,35 @@ iow(board_info_t * db, int reg, int value)
>  
>  static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
>  {
> -	writesb(reg, data, count);
> +	writesb((int)reg, data, count);
>  }

You lose the sparse checking for misuse by doing this.

Why not this instead?

--- a/drivers/net/dm9000.c	2008-10-13 05:29:15.000000000 -0700
+++ b/drivers/net/dm9000.c	2008-10-13 05:40:13.000000000 -0700
@@ -47,14 +47,6 @@
 #define CARDNAME	"dm9000"
 #define DRV_VERSION	"1.31"
 
-#ifdef CONFIG_BLACKFIN
-#define readsb	insb
-#define readsw	insw
-#define readsl	insl
-#define writesb	outsb
-#define writesw	outsw
-#define writesl	outsl
-#endif
 
 /*
  * Transmit timeout, default 5 seconds.
@@ -185,7 +177,40 @@ iow(board_info_t * db, int reg, int valu
 }
 
 /* routines for sending block to chip */
+#ifdef CONFIG_BLACKFIN
+static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
+{
+	outsb((unsigned long)reg, data, count);
+}
 
+static void dm9000_outblk_16bit(void __iomem *reg, void *data, int count)
+{
+	outsw((unsigned long)reg, data, (count+1) >> 1);
+}
+
+static void dm9000_outblk_32bit(void __iomem *reg, void *data, int count)
+{
+	outsl((unsigned long)reg, data, (count+3) >> 2);
+}
+
+/* input block from chip to memory */
+
+static void dm9000_inblk_8bit(void __iomem *reg, void *data, int count)
+{
+	insb((unsigned long)reg, data, count);
+}
+
+
+static void dm9000_inblk_16bit(void __iomem *reg, void *data, int count)
+{
+	insw((unsigned long)reg, data, (count+1) >> 1);
+}
+
+static void dm9000_inblk_32bit(void __iomem *reg, void *data, int count)
+{
+	insl((unsigned long)reg, data, (count+3) >> 2);
+}
+#else
 static void dm9000_outblk_8bit(void __iomem *reg, void *data, int count)
 {
 	writesb(reg, data, count);
@@ -218,6 +243,7 @@ static void dm9000_inblk_32bit(void __io
 {
 	readsl(reg, data, (count+3) >> 2);
 }
+#endif
 
 /* dump block from chip to null */