2004-09-12 11:38:50

by Mikael Pettersson

[permalink] [raw]
Subject: [PATCH][2.4.28-pre3] MTD drivers gcc-3.4 fixes

This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3
kernel's MTD drivers. The elan-104nc.c and sbc_gxx.c changes are
backports from the 2.6 kernel. The cfi_cmdset_0001.c and cfi_cmdset_0020.c
changes are new since the 2.6 code is different.

/Mikael

--- linux-2.4.28-pre3/drivers/mtd/chips/cfi_cmdset_0001.c.~1~ 2003-06-14 13:30:22.000000000 +0200
+++ linux-2.4.28-pre3/drivers/mtd/chips/cfi_cmdset_0001.c 2004-09-12 01:56:20.000000000 +0200
@@ -1201,13 +1201,17 @@
/* Write data */
for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
if (cfi_buswidth_is_1()) {
- map->write8 (map, *((__u8*)buf)++, adr+z);
+ map->write8 (map, *(__u8*)buf, adr+z);
+ buf += sizeof(__u8);
} else if (cfi_buswidth_is_2()) {
- map->write16 (map, *((__u16*)buf)++, adr+z);
+ map->write16 (map, *(__u16*)buf, adr+z);
+ buf += sizeof(__u16);
} else if (cfi_buswidth_is_4()) {
- map->write32 (map, *((__u32*)buf)++, adr+z);
+ map->write32 (map, *(__u32*)buf, adr+z);
+ buf += sizeof(__u32);
} else if (cfi_buswidth_is_8()) {
- map->write64 (map, *((__u64*)buf)++, adr+z);
+ map->write64 (map, *(__u64*)buf, adr+z);
+ buf += sizeof(__u64);
} else {
DISABLE_VPP(map);
ret = -EINVAL;
--- linux-2.4.28-pre3/drivers/mtd/chips/cfi_cmdset_0020.c.~1~ 2003-06-14 13:30:22.000000000 +0200
+++ linux-2.4.28-pre3/drivers/mtd/chips/cfi_cmdset_0020.c 2004-09-12 01:56:20.000000000 +0200
@@ -540,11 +540,14 @@
/* Write data */
for (z = 0; z < len; z += CFIDEV_BUSWIDTH) {
if (cfi_buswidth_is_1()) {
- map->write8 (map, *((__u8*)buf)++, adr+z);
+ map->write8 (map, *(__u8*)buf, adr+z);
+ buf += sizeof(__u8);
} else if (cfi_buswidth_is_2()) {
- map->write16 (map, *((__u16*)buf)++, adr+z);
+ map->write16 (map, *(__u16*)buf, adr+z);
+ buf += sizeof(__u16);
} else if (cfi_buswidth_is_4()) {
- map->write32 (map, *((__u32*)buf)++, adr+z);
+ map->write32 (map, *(__u32*)buf, adr+z);
+ buf += sizeof(__u32);
} else {
DISABLE_VPP(map);
return -EINVAL;
--- linux-2.4.28-pre3/drivers/mtd/maps/elan-104nc.c.~1~ 2002-08-07 00:52:20.000000000 +0200
+++ linux-2.4.28-pre3/drivers/mtd/maps/elan-104nc.c 2004-09-12 01:56:20.000000000 +0200
@@ -147,7 +147,7 @@
elan_104nc_page(map, from);
memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen);
spin_unlock(&elan_104nc_spin);
- (__u8*)to += thislen;
+ to += thislen;
from += thislen;
len -= thislen;
}
--- linux-2.4.28-pre3/drivers/mtd/maps/sbc_gxx.c.~1~ 2003-06-14 13:30:22.000000000 +0200
+++ linux-2.4.28-pre3/drivers/mtd/maps/sbc_gxx.c 2004-09-12 01:56:20.000000000 +0200
@@ -155,7 +155,7 @@
sbc_gxx_page(map, from);
memcpy_fromio(to, iomapadr + (from & WINDOW_MASK), thislen);
spin_unlock(&sbc_gxx_spin);
- (__u8*)to += thislen;
+ to += thislen;
from += thislen;
len -= thislen;
}


2004-09-12 12:09:20

by David Woodhouse

[permalink] [raw]
Subject: Re: [PATCH][2.4.28-pre3] MTD drivers gcc-3.4 fixes

On Sun, 2004-09-12 at 13:30 +0200, Mikael Pettersson wrote:
> This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3
> kernel's MTD drivers. The elan-104nc.c and sbc_gxx.c changes are
> backports from the 2.6 kernel. The cfi_cmdset_0001.c and cfi_cmdset_0020.c
> changes are new since the 2.6 code is different.

Looks good; thanks.

Signed-Off-By: David Woodhouse <[email protected]>

Btw, please don't use that other email address for me unless it's ultra-
secret company business which really has to be sent unencrypted via
their STARTTLS-incapable mail servers instead of via my secure ones. I
suppose I should fix MAINTAINERS accordingly...

===== MAINTAINERS 1.145 vs edited =====
--- 1.145/MAINTAINERS 2004-08-28 10:18:52 +01:00
+++ edited/MAINTAINERS 2004-09-12 12:54:35 +01:00
@@ -1200,9 +1200,9 @@

MEMORY TECHNOLOGY DEVICES
P: David Woodhouse
-M: [email protected]
+M: [email protected]
W: http://www.linux-mtd.infradead.org/
-L: [email protected]
+L: [email protected]
S: Maintained

MICROTEK X6 SCANNER


--
dwmw2