aboutsummaryrefslogtreecommitdiff
path: root/arch/um
diff options
context:
space:
mode:
Diffstat (limited to 'arch/um')
-rw-r--r--arch/um/drivers/net_kern.c9
-rw-r--r--arch/um/include/net_kern.h8
2 files changed, 9 insertions, 8 deletions
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 07e839e387d..b10154cc46b 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -498,10 +498,8 @@ struct eth_init {
int index;
};
-/* Filled in at boot time. Will need locking if the transports become
- * modular.
- */
-struct list_head transports = LIST_HEAD_INIT(transports);
+static DEFINE_SPINLOCK(transports_lock);
+static LIST_HEAD(transports);
/* Filled in during early boot */
struct list_head eth_cmd_line = LIST_HEAD_INIT(eth_cmd_line);
@@ -540,7 +538,10 @@ void register_transport(struct transport *new)
char *mac = NULL;
int match;
+ spin_lock(&transports_lock);
+ BUG_ON(!list_empty(&new->list));
list_add(&new->list, &transports);
+ spin_unlock(&transports_lock);
list_for_each_safe(ele, next, &eth_cmd_line){
eth = list_entry(ele, struct eth_init, list);
diff --git a/arch/um/include/net_kern.h b/arch/um/include/net_kern.h
index 218f8b47fdc..92f76d82a6e 100644
--- a/arch/um/include/net_kern.h
+++ b/arch/um/include/net_kern.h
@@ -52,12 +52,12 @@ struct net_kern_info {
struct transport {
struct list_head list;
- char *name;
- int (*setup)(char *, char **, void *);
+ const char *name;
+ int (* const setup)(char *, char **, void *);
const struct net_user_info *user;
const struct net_kern_info *kern;
- int private_size;
- int setup_size;
+ const int private_size;
+ const int setup_size;
};
extern struct net_device *ether_init(int);