linux-mips
[Top] [All Lists]

[PATCH 2.4] inlines in au1000_eth.c

To: linux-mips <linux-mips@linux-mips.org>
Subject: [PATCH 2.4] inlines in au1000_eth.c
From: Kevin Turner <kevin.m.turner@pobox.com>
Date: Fri, 10 Jun 2005 14:22:04 -0700
Original-recipient: rfc822;linux-mips@linux-mips.org
Sender: linux-mips-bounce@linux-mips.org
The following patch against linux_2_4 fixes this sort of compilation
error with gcc 3.4:

au1000_eth.c: In function `au1000_init_module':
au1000_eth.c:97: sorry, unimplemented: inlining failed in call to 'str2eaddr': 
function body not available
au1000_eth.c:1219: sorry, unimplemented: called from here

I'm not wholly sure it's the Right Thing, as I define str2eaddr in
au1000_eth.c, which makes for more code duplication.

Index: drivers/net/au1000_eth.c
===================================================================
RCS file: /home/kevint/whdd/linux-mips-cvs/linux/drivers/net/au1000_eth.c,v
retrieving revision 1.5.2.33
diff -u -r1.5.2.33 au1000_eth.c
--- drivers/net/au1000_eth.c    26 Nov 2004 08:40:13 -0000      1.5.2.33
+++ drivers/net/au1000_eth.c    10 Jun 2005 20:56:19 -0000
@@ -90,12 +90,12 @@
 static int mdio_read(struct net_device *, int, int);
 static void mdio_write(struct net_device *, int, int, u16);
 static void dump_mii(struct net_device *dev, int phy_id);
+static inline void str2eaddr(unsigned char *ea, unsigned char *str);
+static inline unsigned char str2hexnum(unsigned char c);
 
 // externs
 extern  void ack_rise_edge_irq(unsigned int);
 extern int get_ethernet_addr(char *ethernet_addr);
-extern inline void str2eaddr(unsigned char *ea, unsigned char *str);
-extern inline unsigned char str2hexnum(unsigned char c);
 extern char * __init prom_getcmdline(void);
 
 /*
@@ -146,6 +146,32 @@
        "100BaseT", "100BaseTX", "100BaseFX"
        };
 
+static inline void str2eaddr(unsigned char *ea, unsigned char *str)
+{
+       int i;
+
+       for (i = 0; i < 6; i++) {
+               unsigned char num;
+
+               if ((*str == '.') || (*str == ':'))
+                       str++;
+               num = str2hexnum(*str++) << 4;
+               num |= (str2hexnum(*str++));
+               ea[i] = num;
+       }
+}
+
+static inline unsigned char str2hexnum(unsigned char c)
+{
+       if(c >= '0' && c <= '9')
+               return c - '0';
+       if(c >= 'a' && c <= 'f')
+               return c - 'a' + 10;
+       if(c >= 'A' && c <= 'F')
+               return c - 'A' + 10;
+       return 0; /* foo */
+}
+
 int bcm_5201_init(struct net_device *dev, int phy_addr)
 {
        s16 data;



-- 
The moon is waxing crescent, 12.3% illuminated, 3.4 days old.


<Prev in Thread] Current Thread [Next in Thread>