net: cosmetic: eth.c checkpatch compliance

Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Joe Hershberger 2012-05-15 08:59:07 +00:00
parent 3090b7e36c
commit 66c7385a5f

View File

@ -87,7 +87,7 @@ static struct {
int length; int length;
} eth_rcv_bufs[PKTBUFSRX]; } eth_rcv_bufs[PKTBUFSRX];
static unsigned int eth_rcv_current = 0, eth_rcv_last = 0; static unsigned int eth_rcv_current, eth_rcv_last;
#endif #endif
static struct eth_device *eth_devices, *eth_current; static struct eth_device *eth_devices, *eth_current;
@ -141,9 +141,8 @@ struct eth_device *eth_get_dev_by_index(int index)
int eth_get_dev_index(void) int eth_get_dev_index(void)
{ {
if (!eth_current) { if (!eth_current)
return -1; return -1;
}
return eth_current->index; return eth_current->index;
} }
@ -188,9 +187,8 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
if (dev->write_hwaddr && if (dev->write_hwaddr &&
!eth_mac_skip(eth_number) && !eth_mac_skip(eth_number) &&
is_valid_ether_addr(dev->enetaddr)) { is_valid_ether_addr(dev->enetaddr))
ret = dev->write_hwaddr(dev); ret = dev->write_hwaddr(dev);
}
return ret; return ret;
} }
@ -198,7 +196,7 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name,
int eth_register(struct eth_device *dev) int eth_register(struct eth_device *dev)
{ {
struct eth_device *d; struct eth_device *d;
static int index = 0; static int index;
assert(strlen(dev->name) < sizeof(dev->name)); assert(strlen(dev->name) < sizeof(dev->name));
@ -295,7 +293,8 @@ int eth_initialize(bd_t *bis)
} }
if (strchr(dev->name, ' ')) if (strchr(dev->name, ' '))
puts("\nWarning: eth device name has a space!\n"); puts("\nWarning: eth device name has a space!"
"\n");
if (eth_write_hwaddr(dev, "eth", dev->index)) if (eth_write_hwaddr(dev, "eth", dev->index))
puts("\nWarning: failed to set MAC address\n"); puts("\nWarning: failed to set MAC address\n");
@ -470,37 +469,35 @@ int eth_receive(void *packet, int length)
void eth_try_another(int first_restart) void eth_try_another(int first_restart)
{ {
static struct eth_device *first_failed = NULL; static struct eth_device *first_failed;
char *ethrotate; char *ethrotate;
/* /*
* Do not rotate between network interfaces when * Do not rotate between network interfaces when
* 'ethrotate' variable is set to 'no'. * 'ethrotate' variable is set to 'no'.
*/ */
if (((ethrotate = getenv ("ethrotate")) != NULL) && ethrotate = getenv("ethrotate");
(strcmp(ethrotate, "no") == 0)) if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
return; return;
if (!eth_current) if (!eth_current)
return; return;
if (first_restart) { if (first_restart)
first_failed = eth_current; first_failed = eth_current;
}
eth_current = eth_current->next; eth_current = eth_current->next;
eth_current_changed(); eth_current_changed();
if (first_failed == eth_current) { if (first_failed == eth_current)
NetRestartWrap = 1; NetRestartWrap = 1;
} }
}
void eth_set_current(void) void eth_set_current(void)
{ {
static char *act = NULL; static char *act;
static int env_changed_id = 0; static int env_changed_id;
struct eth_device *old_current; struct eth_device *old_current;
int env_id; int env_id;
@ -526,5 +523,5 @@ void eth_set_current(void)
char *eth_get_name(void) char *eth_get_name(void)
{ {
return (eth_current ? eth_current->name : "unknown"); return eth_current ? eth_current->name : "unknown";
} }