summaryrefslogtreecommitdiffstats
path: root/target/linux/generic
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-15 19:32:31 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-03-15 19:32:31 +0000
commita2e617077c8ad32460b343d7b88696a2c02fc239 (patch)
treee1b2f1fa1632d1ce781e0cd5534858c33f54dbb3 /target/linux/generic
parentb5e9c6c090f7cde79953d7ebdcd627e36d2fa838 (diff)
swconfig: use a mutex instead of a spinlock, many swconfig calls sleep
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30952 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/generic')
-rw-r--r--target/linux/generic/files/drivers/net/phy/swconfig.c10
-rw-r--r--target/linux/generic/files/include/linux/switch.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/target/linux/generic/files/drivers/net/phy/swconfig.c b/target/linux/generic/files/drivers/net/phy/swconfig.c
index 1baccb1ba..e772c9448 100644
--- a/target/linux/generic/files/drivers/net/phy/swconfig.c
+++ b/target/linux/generic/files/drivers/net/phy/swconfig.c
@@ -353,7 +353,7 @@ swconfig_get_dev(struct genl_info *info)
break;
}
if (dev)
- spin_lock(&dev->lock);
+ mutex_lock(&dev->sw_mutex);
else
DPRINTF("device %d not found\n", id);
swconfig_unlock();
@@ -364,7 +364,7 @@ done:
static inline void
swconfig_put_dev(struct switch_dev *dev)
{
- spin_unlock(&dev->lock);
+ mutex_unlock(&dev->sw_mutex);
}
static int
@@ -962,7 +962,7 @@ register_switch(struct switch_dev *dev, struct net_device *netdev)
return -ENOMEM;
}
swconfig_defaults_init(dev);
- spin_lock_init(&dev->lock);
+ mutex_init(&dev->sw_mutex);
swconfig_lock();
dev->id = ++swdev_id;
@@ -1000,11 +1000,11 @@ unregister_switch(struct switch_dev *dev)
{
swconfig_destroy_led_trigger(dev);
kfree(dev->portbuf);
- spin_lock(&dev->lock);
+ mutex_lock(&dev->sw_mutex);
swconfig_lock();
list_del(&dev->dev_list);
swconfig_unlock();
- spin_unlock(&dev->lock);
+ mutex_unlock(&dev->sw_mutex);
}
EXPORT_SYMBOL_GPL(unregister_switch);
diff --git a/target/linux/generic/files/include/linux/switch.h b/target/linux/generic/files/include/linux/switch.h
index 2c88bb327..4f4085ef8 100644
--- a/target/linux/generic/files/include/linux/switch.h
+++ b/target/linux/generic/files/include/linux/switch.h
@@ -191,7 +191,7 @@ struct switch_dev {
struct list_head dev_list;
unsigned long def_global, def_port, def_vlan;
- spinlock_t lock;
+ struct mutex sw_mutex;
struct switch_port *portbuf;
char buf[128];