* [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr()
@ 2007-10-15 10:06 Yoichi Yuasa
2007-10-15 18:38 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Yoichi Yuasa @ 2007-10-15 10:06 UTC (permalink / raw)
To: Ralf Baechle; +Cc: yoichi_yuasa, linux-mips, Jeff Garzik
Update AU1000 get_ethernet_addr().
Three functions were brought together in one.
Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
diff -pruN -X mips/Documentation/dontdiff mips-orig/arch/mips/au1000/common/prom.c mips/arch/mips/au1000/common/prom.c
--- mips-orig/arch/mips/au1000/common/prom.c 2007-10-14 16:30:32.472075500 +0900
+++ mips/arch/mips/au1000/common/prom.c 2007-10-14 16:31:58.797470500 +0900
@@ -98,7 +98,7 @@ char *prom_getenv(char *envname)
return NULL;
}
-inline unsigned char str2hexnum(unsigned char c)
+static inline unsigned char str2hexnum(unsigned char c)
{
if(c >= '0' && c <= '9')
return c - '0';
@@ -109,7 +109,7 @@ inline unsigned char str2hexnum(unsigned
return 0; /* foo */
}
-inline void str2eaddr(unsigned char *ea, unsigned char *str)
+static inline void str2eaddr(unsigned char *ea, unsigned char *str)
{
int i;
@@ -124,35 +124,29 @@ inline void str2eaddr(unsigned char *ea,
}
}
-int get_ethernet_addr(char *ethernet_addr)
+int prom_get_ethernet_addr(char *ethernet_addr)
{
- char *ethaddr_str;
+ char *ethaddr_str;
+ char *argptr;
- ethaddr_str = prom_getenv("ethaddr");
+ /* Check the environment variables first */
+ ethaddr_str = prom_getenv("ethaddr");
if (!ethaddr_str) {
- printk("ethaddr not set in boot prom\n");
- return -1;
- }
- str2eaddr(ethernet_addr, ethaddr_str);
+ /* Check command line */
+ argptr = prom_getcmdline();
+ ethaddr_str = strstr(argptr, "ethaddr=");
+ if (!ethaddr_str)
+ return -1;
-#if 0
- {
- int i;
-
- printk("get_ethernet_addr: ");
- for (i=0; i<5; i++)
- printk("%02x:", (unsigned char)*(ethernet_addr+i));
- printk("%02x\n", *(ethernet_addr+i));
+ ethaddr_str += strlen("ethaddr=");
}
-#endif
+
+ str2eaddr(ethernet_addr, ethaddr_str);
return 0;
}
+EXPORT_SYMBOL(prom_get_ethernet_addr);
void __init prom_free_prom_memory(void)
{
}
-
-EXPORT_SYMBOL(prom_getcmdline);
-EXPORT_SYMBOL(get_ethernet_addr);
-EXPORT_SYMBOL(str2eaddr);
diff -pruN -X mips/Documentation/dontdiff mips-orig/drivers/net/au1000_eth.c mips/drivers/net/au1000_eth.c
--- mips-orig/drivers/net/au1000_eth.c 2007-10-14 16:30:32.488076500 +0900
+++ mips/drivers/net/au1000_eth.c 2007-10-14 16:31:58.797470500 +0900
@@ -97,9 +97,7 @@ static void au1000_adjust_link(struct ne
static void enable_mac(struct net_device *, int);
// externs
-extern int get_ethernet_addr(char *ethernet_addr);
-extern void str2eaddr(unsigned char *ea, unsigned char *str);
-extern char * prom_getcmdline(void);
+extern int prom_get_ethernet_addr(char *ethernet_addr);
/*
* Theory of operation
@@ -619,7 +617,6 @@ static struct net_device * au1000_probe(
struct au1000_private *aup = NULL;
struct net_device *dev = NULL;
db_dest_t *pDB, *pDBfree;
- char *pmac, *argptr;
char ethaddr[6];
int irq, i, err;
u32 base, macen;
@@ -677,21 +674,12 @@ static struct net_device * au1000_probe(
au_macs[port_num] = aup;
if (port_num == 0) {
- /* Check the environment variables first */
- if (get_ethernet_addr(ethaddr) == 0)
+ if (prom_get_ethernet_addr(ethaddr) == 0)
memcpy(au1000_mac_addr, ethaddr, sizeof(au1000_mac_addr));
else {
- /* Check command line */
- argptr = prom_getcmdline();
- if ((pmac = strstr(argptr, "ethaddr=")) == NULL)
- printk(KERN_INFO "%s: No MAC address found\n",
- dev->name);
+ printk(KERN_INFO "%s: No MAC address found\n",
+ dev->name);
/* Use the hard coded MAC addresses */
- else {
- str2eaddr(ethaddr, pmac + strlen("ethaddr="));
- memcpy(au1000_mac_addr, ethaddr,
- sizeof(au1000_mac_addr));
- }
}
setup_hw_rings(aup, MAC0_RX_DMA_ADDR, MAC0_TX_DMA_ADDR);
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr()
2007-10-15 10:06 [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr() Yoichi Yuasa
@ 2007-10-15 18:38 ` Jeff Garzik
2007-10-15 19:02 ` Sergei Shtylyov
0 siblings, 1 reply; 4+ messages in thread
From: Jeff Garzik @ 2007-10-15 18:38 UTC (permalink / raw)
To: Yoichi Yuasa; +Cc: Ralf Baechle, linux-mips
Yoichi Yuasa wrote:
> Update AU1000 get_ethernet_addr().
> Three functions were brought together in one.
>
> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
applied 1-2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr()
2007-10-15 18:38 ` Jeff Garzik
@ 2007-10-15 19:02 ` Sergei Shtylyov
2007-10-15 19:05 ` Jeff Garzik
0 siblings, 1 reply; 4+ messages in thread
From: Sergei Shtylyov @ 2007-10-15 19:02 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Yoichi Yuasa, Ralf Baechle, linux-mips
Hello.
Jeff Garzik wrote:
>> Update AU1000 get_ethernet_addr().
>> Three functions were brought together in one.
>> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
> applied 1-2
Hm, the second patch was purely Linux/MIPS one, wasn't it?
WBR, Sergei
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr()
2007-10-15 19:02 ` Sergei Shtylyov
@ 2007-10-15 19:05 ` Jeff Garzik
0 siblings, 0 replies; 4+ messages in thread
From: Jeff Garzik @ 2007-10-15 19:05 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: Yoichi Yuasa, Ralf Baechle, linux-mips
Sergei Shtylyov wrote:
> Hello.
>
> Jeff Garzik wrote:
>
>>> Update AU1000 get_ethernet_addr().
>>> Three functions were brought together in one.
>
>>> Signed-off-by: Yoichi Yuasa <yoichi_yuasa@tripeaks.co.jp>
>
>> applied 1-2
>
> Hm, the second patch was purely Linux/MIPS one, wasn't it?
Yep. Ralf ack'd them via IRC, in this case.
Jeff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-10-15 19:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-15 10:06 [PATCH][1/2][MIPS] update AU1000 get_ethernet_addr() Yoichi Yuasa
2007-10-15 18:38 ` Jeff Garzik
2007-10-15 19:02 ` Sergei Shtylyov
2007-10-15 19:05 ` Jeff Garzik
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.