[PATCH][2.4.28-pre3] I2C driver core gcc-3.4 fixes

From: Mikael Pettersson
Date: Sun Sep 12 2004 - 07:04:14 EST


This patch fixes gcc-3.4 cast-as-lvalue warnings in the 2.4.28-pre3
kernel's I2C driver core. The i2c-core.c change is from the 2.6 kernel,
the i2c-proc.c changes are new since the 2.6 code is different.

/Mikael

--- linux-2.4.28-pre3/drivers/i2c/i2c-core.c.~1~ 2004-02-18 15:16:22.000000000 +0100
+++ linux-2.4.28-pre3/drivers/i2c/i2c-core.c 2004-09-12 01:56:20.000000000 +0200
@@ -750,7 +750,7 @@
msg.addr = client->addr;
msg.flags = client->flags & I2C_M_TEN;
msg.len = count;
- (const char *)msg.buf = buf;
+ msg.buf = (char *)buf;

DEB2(printk(KERN_DEBUG "i2c-core.o: master_send: writing %d bytes on %s.\n",
count,client->adapter->name));
--- linux-2.4.28-pre3/drivers/i2c/i2c-proc.c.~1~ 2004-02-18 15:16:22.000000000 +0100
+++ linux-2.4.28-pre3/drivers/i2c/i2c-proc.c 2004-09-12 01:56:20.000000000 +0200
@@ -205,7 +205,7 @@
table = i2c_entries[id]->ctl_table;
unregister_sysctl_table(i2c_entries[id]);
/* 2-step kfree needed to keep gcc happy about const points */
- (const char *) temp = table[4].procname;
+ temp = (char *) table[4].procname;
kfree(temp);
kfree(table);
i2c_entries[id] = NULL;
@@ -287,7 +287,7 @@
if(copy_to_user(buffer, BUF, buflen))
return -EFAULT;
curbufsize += buflen;
- (char *) buffer += buflen;
+ buffer += buflen;
}
*lenp = curbufsize;
filp->f_pos += curbufsize;
@@ -318,7 +318,7 @@
sizeof(struct
i2c_chips_data)))
return -EFAULT;
- (char *) oldval +=
+ oldval +=
sizeof(struct i2c_chips_data);
nrels++;
}
@@ -473,7 +473,7 @@
!((ret=get_user(nextchar, (char *) buffer))) &&
isspace((int) nextchar)) {
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}

if (ret)
@@ -492,7 +492,7 @@
&& (nextchar == '-')) {
min = 1;
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -503,7 +503,7 @@
isdigit((int) nextchar)) {
res = res * 10 + nextchar - '0';
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -517,7 +517,7 @@
if (bufsize && (nextchar == '.')) {
/* Skip the dot */
bufsize--;
- ((char *) buffer)++;
+ buffer++;

/* Read digits while they are significant */
while (bufsize && (mag > 0) &&
@@ -526,7 +526,7 @@
res = res * 10 + nextchar - '0';
mag--;
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -542,7 +542,7 @@
!((ret=get_user(nextchar, (char *) buffer))) &&
isspace((int) nextchar)) {
bufsize--;
- ((char *) buffer)++;
+ buffer++;
}
if (ret)
return -EFAULT;
@@ -574,7 +574,7 @@
if(put_user(' ', (char *) buffer))
return -EFAULT;
curbufsize++;
- ((char *) buffer)++;
+ buffer++;
}

/* Fill BUF with the representation of the next string */
@@ -615,7 +615,7 @@
if(copy_to_user(buffer, BUF, buflen))
return -EFAULT;
curbufsize += buflen;
- (char *) buffer += buflen;
+ buffer += buflen;

nr++;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/