aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ehea
diff options
context:
space:
mode:
authorJan-Bernd Themann <ossthema@de.ibm.com>2008-07-03 10:18:45 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-07-04 08:10:06 -0400
commit5c2cec143ac54c1960e54bc320fa7d13ac8e0f4a (patch)
treecbb2fa3d146543d116f60611330e97dc62346307 /drivers/net/ehea
parent97bff0953dd45a633fa69e1a650d612f5610a60b (diff)
ehea: fix might sleep problem
A mutex has to be replaced by spinlocks as it can be called from a context which does not allow sleeping. The kzalloc flag GFP_KERNEL has to be replaced by GFP_ATOMIC for the same reason. Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/ehea')
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c22
2 files changed, 12 insertions, 12 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index fe872fbd671e..bf57e1532f5e 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -452,7 +452,7 @@ struct ehea_bcmc_reg_entry {
452struct ehea_bcmc_reg_array { 452struct ehea_bcmc_reg_array {
453 struct ehea_bcmc_reg_entry *arr; 453 struct ehea_bcmc_reg_entry *arr;
454 int num_entries; 454 int num_entries;
455 struct mutex lock; 455 spinlock_t lock;
456}; 456};
457 457
458#define EHEA_PORT_UP 1 458#define EHEA_PORT_UP 1
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 075fd547421e..489de9ba5fc0 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -241,7 +241,7 @@ static void ehea_update_bcmc_registrations(void)
241 } 241 }
242 242
243 if (num_registrations) { 243 if (num_registrations) {
244 arr = kzalloc(num_registrations * sizeof(*arr), GFP_KERNEL); 244 arr = kzalloc(num_registrations * sizeof(*arr), GFP_ATOMIC);
245 if (!arr) 245 if (!arr)
246 return; /* Keep the existing array */ 246 return; /* Keep the existing array */
247 } else 247 } else
@@ -301,7 +301,7 @@ static struct net_device_stats *ehea_get_stats(struct net_device *dev)
301 301
302 memset(stats, 0, sizeof(*stats)); 302 memset(stats, 0, sizeof(*stats));
303 303
304 cb2 = kzalloc(PAGE_SIZE, GFP_KERNEL); 304 cb2 = kzalloc(PAGE_SIZE, GFP_ATOMIC);
305 if (!cb2) { 305 if (!cb2) {
306 ehea_error("no mem for cb2"); 306 ehea_error("no mem for cb2");
307 goto out; 307 goto out;
@@ -1763,7 +1763,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
1763 1763
1764 memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); 1764 memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len);
1765 1765
1766 mutex_lock(&ehea_bcmc_regs.lock); 1766 spin_lock(&ehea_bcmc_regs.lock);
1767 1767
1768 /* Deregister old MAC in pHYP */ 1768 /* Deregister old MAC in pHYP */
1769 if (port->state == EHEA_PORT_UP) { 1769 if (port->state == EHEA_PORT_UP) {
@@ -1785,7 +1785,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
1785 1785
1786out_upregs: 1786out_upregs:
1787 ehea_update_bcmc_registrations(); 1787 ehea_update_bcmc_registrations();
1788 mutex_unlock(&ehea_bcmc_regs.lock); 1788 spin_unlock(&ehea_bcmc_regs.lock);
1789out_free: 1789out_free:
1790 kfree(cb0); 1790 kfree(cb0);
1791out: 1791out:
@@ -1947,7 +1947,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1947 } 1947 }
1948 ehea_promiscuous(dev, 0); 1948 ehea_promiscuous(dev, 0);
1949 1949
1950 mutex_lock(&ehea_bcmc_regs.lock); 1950 spin_lock(&ehea_bcmc_regs.lock);
1951 1951
1952 if (dev->flags & IFF_ALLMULTI) { 1952 if (dev->flags & IFF_ALLMULTI) {
1953 ehea_allmulti(dev, 1); 1953 ehea_allmulti(dev, 1);
@@ -1978,7 +1978,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
1978 } 1978 }
1979out: 1979out:
1980 ehea_update_bcmc_registrations(); 1980 ehea_update_bcmc_registrations();
1981 mutex_unlock(&ehea_bcmc_regs.lock); 1981 spin_unlock(&ehea_bcmc_regs.lock);
1982 return; 1982 return;
1983} 1983}
1984 1984
@@ -2497,7 +2497,7 @@ static int ehea_up(struct net_device *dev)
2497 } 2497 }
2498 } 2498 }
2499 2499
2500 mutex_lock(&ehea_bcmc_regs.lock); 2500 spin_lock(&ehea_bcmc_regs.lock);
2501 2501
2502 ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); 2502 ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
2503 if (ret) { 2503 if (ret) {
@@ -2520,7 +2520,7 @@ out:
2520 ehea_info("Failed starting %s. ret=%i", dev->name, ret); 2520 ehea_info("Failed starting %s. ret=%i", dev->name, ret);
2521 2521
2522 ehea_update_bcmc_registrations(); 2522 ehea_update_bcmc_registrations();
2523 mutex_unlock(&ehea_bcmc_regs.lock); 2523 spin_unlock(&ehea_bcmc_regs.lock);
2524 2524
2525 ehea_update_firmware_handles(); 2525 ehea_update_firmware_handles();
2526 mutex_unlock(&ehea_fw_handles.lock); 2526 mutex_unlock(&ehea_fw_handles.lock);
@@ -2575,7 +2575,7 @@ static int ehea_down(struct net_device *dev)
2575 2575
2576 mutex_lock(&ehea_fw_handles.lock); 2576 mutex_lock(&ehea_fw_handles.lock);
2577 2577
2578 mutex_lock(&ehea_bcmc_regs.lock); 2578 spin_lock(&ehea_bcmc_regs.lock);
2579 ehea_drop_multicast_list(dev); 2579 ehea_drop_multicast_list(dev);
2580 ehea_broadcast_reg_helper(port, H_DEREG_BCMC); 2580 ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
2581 2581
@@ -2584,7 +2584,7 @@ static int ehea_down(struct net_device *dev)
2584 port->state = EHEA_PORT_DOWN; 2584 port->state = EHEA_PORT_DOWN;
2585 2585
2586 ehea_update_bcmc_registrations(); 2586 ehea_update_bcmc_registrations();
2587 mutex_unlock(&ehea_bcmc_regs.lock); 2587 spin_unlock(&ehea_bcmc_regs.lock);
2588 2588
2589 ret = ehea_clean_all_portres(port); 2589 ret = ehea_clean_all_portres(port);
2590 if (ret) 2590 if (ret)
@@ -3590,7 +3590,7 @@ int __init ehea_module_init(void)
3590 memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs)); 3590 memset(&ehea_bcmc_regs, 0, sizeof(ehea_bcmc_regs));
3591 3591
3592 mutex_init(&ehea_fw_handles.lock); 3592 mutex_init(&ehea_fw_handles.lock);
3593 mutex_init(&ehea_bcmc_regs.lock); 3593 spin_lock_init(&ehea_bcmc_regs.lock);
3594 3594
3595 ret = check_module_parm(); 3595 ret = check_module_parm();
3596 if (ret) 3596 if (ret)