netdev: DM9000: Added typecasting to supress some warnings on Blackfin
Subsystems (2)
PATCH 1/1 netdev: DM9000: Added typecasting to supress some warnings on Blackfin
From: Javier Herrero <[email protected]>
--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/dm9000.c +6 -6
@@ -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); }static void dm9000_outblk_16bit (void __iomem *reg,void *data,int count) { -writesw (reg, data, (count+1 ) >>1 ); +writesw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_outblk_32bit (void __iomem *reg,void *data,int count) { -writesl (reg, data, (count+3 ) >>2 ); +writesl ((int )reg, data, (count+3 ) >>2 ); }/* input block from chip to memory */ static void dm9000_inblk_8bit (void __iomem *reg,void *data,int count) { -readsb (reg, data, count); +readsb ((int )reg, data, count); }static void dm9000_inblk_16bit (void __iomem *reg,void *data,int count) { -readsw (reg, data, (count+1 ) >>1 ); +readsw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_inblk_32bit (void __iomem *reg,void *data,int count) { -readsl (reg, data, (count+3 ) >>2 ); +readsl ((int )reg, data, (count+3 ) >>2 ); }/* dump block from chip to null */
Signature · 1 line
1.5.6
Quoted 1 line · Bryan Wu
From: Javier Herrero <[email protected]>
No, your arch definitions of writesb and co are wrong if they are not taking 'void __iomem *' arguments.
Quoted 54 lines
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +6
-6@@ -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); }static void dm9000_outblk_16bit (void __iomem *reg,void *data,int count) { -writesw (reg, data, (count+1 ) >>1 ); +writesw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_outblk_32bit (void __iomem *reg,void *data,int count) { -writesl (reg, data, (count+3 ) >>2 ); +writesl ((int )reg, data, (count+3 ) >>2 ); }/* input block from chip to memory */ static void dm9000_inblk_8bit (void __iomem *reg,void *data,int count) { -readsb (reg, data, count); +readsb ((int )reg, data, count); }static void dm9000_inblk_16bit (void __iomem *reg,void *data,int count) { -readsw (reg, data, (count+1 ) >>1 ); +readsw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_inblk_32bit (void __iomem *reg,void *data,int count) { -readsl (reg, data, (count+3 ) >>2 ); +readsl ((int )reg, data, (count+3 ) >>2 ); }/* dump block from chip to null */ Signature · 1 line
1.5.6
Signature · 5 lines
-- Ben Q: What's a light-year? A: One-third less calories than a regular year.
Hi, Bryan,
So it seems that we must correct that in other place?
Regards,
Javier
Quoted 61 lines · Ben Dooks
Quoted 1 line · Bryan Wu
From: Javier Herrero <[email protected]>
No, your arch definitions of writesb and co are wrong if they are not taking 'void
__iomem*' arguments.Quoted 54 lines
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +6
-6@@ -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); }static void dm9000_outblk_16bit (void __iomem *reg,void *data,int count) { -writesw (reg, data, (count+1 ) >>1 ); +writesw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_outblk_32bit (void __iomem *reg,void *data,int count) { -writesl (reg, data, (count+3 ) >>2 ); +writesl ((int )reg, data, (count+3 ) >>2 ); }/* input block from chip to memory */ static void dm9000_inblk_8bit (void __iomem *reg,void *data,int count) { -readsb (reg, data, count); +readsb ((int )reg, data, count); }static void dm9000_inblk_16bit (void __iomem *reg,void *data,int count) { -readsw (reg, data, (count+1 ) >>1 ); +readsw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_inblk_32bit (void __iomem *reg,void *data,int count) { -readsl (reg, data, (count+3 ) >>2 ); +readsl ((int )reg, data, (count+3 ) >>2 ); }/* dump block from chip to null */ Signature · 1 line
1.5.6
Signature · 5 lines
------------------------------------------------------------------------ Javier Herrero EMAIL: [email protected] HV Sistemas S.L. PHONE: +34 949 336 806 Los Charcones, 17A FAX: +34 949 336 792 19170 El Casar - Guadalajara - Spain WEB: http://www.hvsistemas.com
Quoted 4 lines · Javier Herrero
Hi, Bryan,
So it seems that we must correct that in other place?
Yes, we need to check the I/O read_write functions.
-Bryan
Quoted 74 lines
Regards,
Javier
Quoted 51 lines · Ben Dooks
Quoted 2 lines · Bryan Wu
From: Javier Herrero <[email protected]>
No, your arch definitions of writesb and co are wrong if they are not taking 'void
__iomem*' arguments.Quoted 43 lines
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +5
-5@@ -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); }static void dm9000_outblk_16bit (void __iomem *reg,void *data,int count) { -writesw (reg, data, (count+1 ) >>1 ); +writesw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_outblk_32bit (void __iomem *reg,void *data,int count) { -writesl (reg, data, (count+3 ) >>2 ); +writesl ((int )reg, data, (count+3 ) >>2 ); }/* input block from chip to memory */ static void dm9000_inblk_8bit (void __iomem *reg,void *data,int count) { -readsb (reg, data, count); +readsb ((int )reg, data, count); }static void dm9000_inblk_16bit (void __iomem *reg,void *data,int count) { -readsw (reg, data, (count+1 ) >>1 ); +readsw ((int )reg, data, (count+1 ) >>1 ); } static void dm9000_inblk_32bit(void __iomem *reg, void *data, intQuoted 9 lines
Quoted 8 lines
drivers/net/dm9000.c +1
-2count) { -readsl (reg, data, (count+3 ) >>2 ); +readsl ((int )reg, data, (count+3 ) >>2 ); }/* dump block from chip to null */ --1.5.6
--
------------------------------------------------------------------------Javier Herrero EMAIL: [email protected] HV Sistemas S.L. PHONE: +34 949 336 806 Los Charcones, 17A FAX: +34 949 336 792 19170 El Casar - Guadalajara - Spain WEB: http://www.hvsistemas.com
Quoted 4 lines · Bryan Wu
Quoted 1 line · Javier Herrero
So it seems that we must correct that in other place?
Yes, we need to check the I/O
read_writefunctions.
and drop the CONFIG_BLACKFIN hacks in the dm90000 driver ... we rewrite the write* functions to out* ... probably because we dont provide any write* functions in our headers
-mike
Quoted 11 lines · Mike Frysinger
Quoted 4 lines · Bryan Wu
Quoted 1 line · Javier Herrero
So it seems that we must correct that in other place?
Yes, we need to check the I/O
read_writefunctions.and drop the
CONFIG_BLACKFINhacks in the dm90000 driver ... we rewrite the write* functions to out* ... probably because we dont provide any write* functions in our headers
-mike
No problem, I will take care of that.
-Bryan
Quoted 6 lines · Ben Dooks
Quoted 1 line · Bryan Wu
From: Javier Herrero <[email protected]>
No, your arch definitions of writesb and co are wrong if they are not taking 'void
__iomem*' arguments.
Right, we should check the I/O functions and make them support "void __iomem *" arguments.
Thanks
-Bryan
Quoted 63 lines
Quoted 53 lines
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +6
-7@@ -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); }static void dm9000_outblk_16bit (void __iomem *reg,void *data,int count) { -writesw (reg, data, (count+1 ) >>1 ); +writesw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_outblk_32bit (void __iomem *reg,void *data,int count) { -writesl (reg, data, (count+3 ) >>2 ); +writesl ((int )reg, data, (count+3 ) >>2 ); }/* input block from chip to memory */ static void dm9000_inblk_8bit (void __iomem *reg,void *data,int count) { -readsb (reg, data, count); +readsb ((int )reg, data, count); }static void dm9000_inblk_16bit (void __iomem *reg,void *data,int count) { -readsw (reg, data, (count+1 ) >>1 ); +readsw ((int )reg, data, (count+1 ) >>1 ); }static void dm9000_inblk_32bit (void __iomem *reg,void *data,int count) { -readsl (reg, data, (count+3 ) >>2 ); +readsl ((int )reg, data, (count+3 ) >>2 ); }/* dump block from chip to null */ --Quoted 1 line
1.5.6
--
--
BenQ: What's a light-year? A: One-third less calories than a regular year.
David Miller
maintainerFrom: Bryan Wu <[email protected]>
Date: Mon, 13 Oct 2008 17:10:09 +0800
Quoted 4 lines
From: Javier Herrero <[email protected]>
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>
This is not only inelegant, it'll likely break things on 64-bit MIPS or any other case where the upper 32-bit matter.
I'd rather see Blackfin fix it's I/O accessor prototypes to take a proper __iomem pointer.
This patch won't be applied.
Quoted 5 lines · David Miller
From: Bryan Wu <[email protected]>
Date: Mon, 13 Oct 2008 17:10:09 +0800Quoted 2 lines
From: Javier Herrero <[email protected]>
Quoted 8 lines
Quoted 2 lines
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>This is not only inelegant, it'll likely break things on 64-bit MIPS or any other case where the upper 32-bit matter.
I'd rather see Blackfin fix it's I/O accessor prototypes to take a proper
__iomempointer.
How much would it hurt to provide blackfin wide readsb and friends with the correct prototype and remove the nasty blackfin hack in the dm9000.c driver for good?
Signature · 4 lines
Ben Q: What's a light-year? A: One-third less calories than a regular year.
Quoted 13 lines · On Mon, 13 Oct 2008 17:10:09 +0800 Bryan Wu <[email protected]> wrote:
From: Javier Herrero <[email protected]>
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +0
-0
drivers/net/dm9000.c iow(board_info_t * db, int reg, int value) · line 192
Quoted 6 lines
drivers/net/dm9000.c +1
-1@@ -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?
drivers/net/dm9000.c +34 -8
@@ -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 */
Quoted 46 lines · Stephen Hemminger
Quoted 13 lines · On Mon, 13 Oct 2008 17:10:09 +0800 Bryan Wu <[email protected]> wrote:
From: Javier Herrero <[email protected]>
Signed-off-by Javier Herrero <[email protected]>Signed-off-by Bryan Wu <[email protected]>--- drivers/net/dm9000.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)drivers/net/dm9000.c +0
-0drivers/net/dm9000.c iow(board_info_t * db, int reg, int value) · line 192
Quoted 6 lines
drivers/net/dm9000.c +1
-1@@ -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?
drivers/net/dm9000.c 2008-10-13 05:40:13.000000000 -0700 renamed from drivers/net/dm9000.c 2008-10-13 05:29:15.000000000 -0700 +0
-8@@ -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.
drivers/net/dm9000.c 2008-10-13 05:40:13.000000000 -0700 iow(board_info_t * db, int reg, int valu · line 185
Quoted 9 lines
drivers/net/dm9000.c 2008-10-13 05:40:13.000000000 -0700 renamed from drivers/net/dm9000.c 2008-10-13 05:29:15.000000000 -0700 +5
-0@@ -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); +}
I added readsl/writesl to blackfin arch, so we don't need to mess up the common DM9000 netdev driver here.
-Bryan
Quoted 44 lines
drivers/net/dm9000.c 2008-10-13 05:40:13.000000000 -0700 renamed from drivers/net/dm9000.c 2008-10-13 05:29:15.000000000 -0700 +29
-1+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 */ --To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html