Add a few casts to silence warnings in drivers/net/tulip/dmfe.c (and change a single pointer variable type to match what it points to).

From: Jesper Juhl
Date: Sun Dec 26 2004 - 17:56:19 EST



Hi,

I noticed these warnings when doing a allyesconfig build of 2.6.10 :

drivers/net/tulip/dmfe.c:1809: warning: passing arg 1 of `__le16_to_cpup' from incompatible pointer type
drivers/net/tulip/dmfe.c:1821: warning: passing arg 1 of `__le32_to_cpup' from incompatible pointer type
drivers/net/tulip/dmfe.c:1821: warning: passing arg 1 of `__le32_to_cpup' from incompatible pointer type

the expected types are __le16* and __le32*, but the passed types are
char*. I think it should be fine to just explicitly cast to the expected
types, so that's what the patch below does. The patch also changes the
type of the srom variable from char* to unsigned char* since the srom
member of struct dmfe_board_info that it is initialized to point to is an
array of unsigned char.

Patch is compile tested only as I have no hardware to do a proper test.
Please review, comment and apply (hopefully) :)


Signed-off-by: Jesper Juhl <juhl-lkml@xxxxxx>

diff -up linux-2.6.10-orig/drivers/net/tulip/dmfe.c linux-2.6.10/drivers/net/tulip/dmfe.c
--- linux-2.6.10-orig/drivers/net/tulip/dmfe.c 2004-12-24 22:35:27.000000000 +0100
+++ linux-2.6.10/drivers/net/tulip/dmfe.c 2004-12-27 00:00:02.000000000 +0100
@@ -1794,7 +1794,7 @@ static u16 phy_read_1bit(unsigned long i

static void dmfe_parse_srom(struct dmfe_board_info * db)
{
- char * srom = db->srom;
+ unsigned char *srom = db->srom;
int dmfe_mode, tmp_reg;

DMFE_DBUG(0, "dmfe_parse_srom() ", 0);
@@ -1806,7 +1806,7 @@ static void dmfe_parse_srom(struct dmfe_
if ( ( (int) srom[18] & 0xff) == SROM_V41_CODE) {
/* SROM V4.01 */
/* Get NIC support media mode */
- db->NIC_capability = le16_to_cpup(srom + 34);
+ db->NIC_capability = le16_to_cpup((__le16 *)(srom + 34));
db->PHY_reg4 = 0;
for (tmp_reg = 1; tmp_reg < 0x10; tmp_reg <<= 1) {
switch( db->NIC_capability & tmp_reg ) {
@@ -1818,7 +1818,7 @@ static void dmfe_parse_srom(struct dmfe_
}

/* Media Mode Force or not check */
- dmfe_mode = le32_to_cpup(srom + 34) & le32_to_cpup(srom + 36);
+ dmfe_mode = le32_to_cpup((__le32 *)(srom + 34)) & le32_to_cpup((__le32 *)(srom + 36));
switch(dmfe_mode) {
case 0x4: dmfe_media_mode = DMFE_100MHF; break; /* 100MHF */
case 0x2: dmfe_media_mode = DMFE_10MFD; break; /* 10MFD */



Please keep me in the CC loop on replies.


--
Jesper Juhl



-
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/