mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-12-04 21:24:05 +02:00
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
This commit is contained in:
parent
b5e9c6c090
commit
a2e617077c
@ -353,7 +353,7 @@ swconfig_get_dev(struct genl_info *info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dev)
|
if (dev)
|
||||||
spin_lock(&dev->lock);
|
mutex_lock(&dev->sw_mutex);
|
||||||
else
|
else
|
||||||
DPRINTF("device %d not found\n", id);
|
DPRINTF("device %d not found\n", id);
|
||||||
swconfig_unlock();
|
swconfig_unlock();
|
||||||
@ -364,7 +364,7 @@ done:
|
|||||||
static inline void
|
static inline void
|
||||||
swconfig_put_dev(struct switch_dev *dev)
|
swconfig_put_dev(struct switch_dev *dev)
|
||||||
{
|
{
|
||||||
spin_unlock(&dev->lock);
|
mutex_unlock(&dev->sw_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -962,7 +962,7 @@ register_switch(struct switch_dev *dev, struct net_device *netdev)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
swconfig_defaults_init(dev);
|
swconfig_defaults_init(dev);
|
||||||
spin_lock_init(&dev->lock);
|
mutex_init(&dev->sw_mutex);
|
||||||
swconfig_lock();
|
swconfig_lock();
|
||||||
dev->id = ++swdev_id;
|
dev->id = ++swdev_id;
|
||||||
|
|
||||||
@ -1000,11 +1000,11 @@ unregister_switch(struct switch_dev *dev)
|
|||||||
{
|
{
|
||||||
swconfig_destroy_led_trigger(dev);
|
swconfig_destroy_led_trigger(dev);
|
||||||
kfree(dev->portbuf);
|
kfree(dev->portbuf);
|
||||||
spin_lock(&dev->lock);
|
mutex_lock(&dev->sw_mutex);
|
||||||
swconfig_lock();
|
swconfig_lock();
|
||||||
list_del(&dev->dev_list);
|
list_del(&dev->dev_list);
|
||||||
swconfig_unlock();
|
swconfig_unlock();
|
||||||
spin_unlock(&dev->lock);
|
mutex_unlock(&dev->sw_mutex);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(unregister_switch);
|
EXPORT_SYMBOL_GPL(unregister_switch);
|
||||||
|
|
||||||
|
@ -191,7 +191,7 @@ struct switch_dev {
|
|||||||
struct list_head dev_list;
|
struct list_head dev_list;
|
||||||
unsigned long def_global, def_port, def_vlan;
|
unsigned long def_global, def_port, def_vlan;
|
||||||
|
|
||||||
spinlock_t lock;
|
struct mutex sw_mutex;
|
||||||
struct switch_port *portbuf;
|
struct switch_port *portbuf;
|
||||||
|
|
||||||
char buf[128];
|
char buf[128];
|
||||||
|
Loading…
Reference in New Issue
Block a user