summaryrefslogtreecommitdiffstats
path: root/src/net/netdevice.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/netdevice.c')
-rw-r--r--src/net/netdevice.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/src/net/netdevice.c b/src/net/netdevice.c
index 9b42ad37f..6c91b4897 100644
--- a/src/net/netdevice.c
+++ b/src/net/netdevice.c
@@ -46,11 +46,13 @@ struct list_head net_devices = LIST_HEAD_INIT ( net_devices );
static struct list_head open_net_devices = LIST_HEAD_INIT ( open_net_devices );
/** Default link status code */
-#define EUNKNOWN_LINK_STATUS EINPROGRESS
+#define EUNKNOWN_LINK_STATUS __einfo_error ( EINFO_EUNKNOWN_LINK_STATUS )
+#define EINFO_EUNKNOWN_LINK_STATUS \
+ __einfo_uniqify ( EINFO_EINPROGRESS, 0x01, "Unknown" )
/** Human-readable message for the default link status */
struct errortab netdev_errors[] __errortab = {
- { EUNKNOWN_LINK_STATUS, "Unknown" },
+ __einfo_errortab ( EINFO_EUNKNOWN_LINK_STATUS ),
};
/**
@@ -60,16 +62,12 @@ struct errortab netdev_errors[] __errortab = {
*/
void netdev_link_down ( struct net_device *netdev ) {
- switch ( netdev->link_rc ) {
- case 0:
- case -EUNKNOWN_LINK_STATUS:
+ /* Avoid clobbering a more detailed link status code, if one
+ * is already set.
+ */
+ if ( ( netdev->link_rc == 0 ) ||
+ ( netdev->link_rc == -EUNKNOWN_LINK_STATUS ) ) {
netdev->link_rc = -ENOTCONN;
- break;
- default:
- /* Avoid clobbering a more detailed link status code,
- * if one is already set.
- */
- break;
}
}