diff options
author | David S. Miller <davem@davemloft.net> | 2008-09-25 16:06:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-09-25 16:06:59 -0400 |
commit | ef40a685311bef053dedd833a72dffaf25669dda (patch) | |
tree | ac4bc8a07a0e896c9c09438ccabf4fcd627bf5a7 | |
parent | 630b25cdf4e3f8c0a11eb04fc8436cc36653cd58 (diff) |
Revert "ehea: fix mutex and spinlock use"
This reverts commit 2eefbd63d0c85daa1317636474c226e236beba81.
On request by driver author and Jeff Garzik.
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ehea/ehea_main.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index c765ec609462..b70c5314f537 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -219,11 +219,9 @@ static void ehea_update_firmware_handles(void) | |||
219 | } | 219 | } |
220 | 220 | ||
221 | out_update: | 221 | out_update: |
222 | mutex_lock(&ehea_fw_handles.lock); | ||
223 | kfree(ehea_fw_handles.arr); | 222 | kfree(ehea_fw_handles.arr); |
224 | ehea_fw_handles.arr = arr; | 223 | ehea_fw_handles.arr = arr; |
225 | ehea_fw_handles.num_entries = i; | 224 | ehea_fw_handles.num_entries = i; |
226 | mutex_unlock(&ehea_fw_handles.lock); | ||
227 | } | 225 | } |
228 | 226 | ||
229 | static void ehea_update_bcmc_registrations(void) | 227 | static void ehea_update_bcmc_registrations(void) |
@@ -295,11 +293,9 @@ static void ehea_update_bcmc_registrations(void) | |||
295 | } | 293 | } |
296 | 294 | ||
297 | out_update: | 295 | out_update: |
298 | spin_lock(&ehea_bcmc_regs.lock); | ||
299 | kfree(ehea_bcmc_regs.arr); | 296 | kfree(ehea_bcmc_regs.arr); |
300 | ehea_bcmc_regs.arr = arr; | 297 | ehea_bcmc_regs.arr = arr; |
301 | ehea_bcmc_regs.num_entries = i; | 298 | ehea_bcmc_regs.num_entries = i; |
302 | spin_unlock(&ehea_bcmc_regs.lock); | ||
303 | } | 299 | } |
304 | 300 | ||
305 | static struct net_device_stats *ehea_get_stats(struct net_device *dev) | 301 | static struct net_device_stats *ehea_get_stats(struct net_device *dev) |
@@ -1774,6 +1770,8 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1774 | 1770 | ||
1775 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); | 1771 | memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); |
1776 | 1772 | ||
1773 | spin_lock(&ehea_bcmc_regs.lock); | ||
1774 | |||
1777 | /* Deregister old MAC in pHYP */ | 1775 | /* Deregister old MAC in pHYP */ |
1778 | if (port->state == EHEA_PORT_UP) { | 1776 | if (port->state == EHEA_PORT_UP) { |
1779 | ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 1777 | ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
@@ -1794,6 +1792,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa) | |||
1794 | 1792 | ||
1795 | out_upregs: | 1793 | out_upregs: |
1796 | ehea_update_bcmc_registrations(); | 1794 | ehea_update_bcmc_registrations(); |
1795 | spin_unlock(&ehea_bcmc_regs.lock); | ||
1797 | out_free: | 1796 | out_free: |
1798 | kfree(cb0); | 1797 | kfree(cb0); |
1799 | out: | 1798 | out: |
@@ -1955,6 +1954,8 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1955 | } | 1954 | } |
1956 | ehea_promiscuous(dev, 0); | 1955 | ehea_promiscuous(dev, 0); |
1957 | 1956 | ||
1957 | spin_lock(&ehea_bcmc_regs.lock); | ||
1958 | |||
1958 | if (dev->flags & IFF_ALLMULTI) { | 1959 | if (dev->flags & IFF_ALLMULTI) { |
1959 | ehea_allmulti(dev, 1); | 1960 | ehea_allmulti(dev, 1); |
1960 | goto out; | 1961 | goto out; |
@@ -1984,6 +1985,7 @@ static void ehea_set_multicast_list(struct net_device *dev) | |||
1984 | } | 1985 | } |
1985 | out: | 1986 | out: |
1986 | ehea_update_bcmc_registrations(); | 1987 | ehea_update_bcmc_registrations(); |
1988 | spin_unlock(&ehea_bcmc_regs.lock); | ||
1987 | return; | 1989 | return; |
1988 | } | 1990 | } |
1989 | 1991 | ||
@@ -2464,6 +2466,8 @@ static int ehea_up(struct net_device *dev) | |||
2464 | if (port->state == EHEA_PORT_UP) | 2466 | if (port->state == EHEA_PORT_UP) |
2465 | return 0; | 2467 | return 0; |
2466 | 2468 | ||
2469 | mutex_lock(&ehea_fw_handles.lock); | ||
2470 | |||
2467 | ret = ehea_port_res_setup(port, port->num_def_qps, | 2471 | ret = ehea_port_res_setup(port, port->num_def_qps, |
2468 | port->num_add_tx_qps); | 2472 | port->num_add_tx_qps); |
2469 | if (ret) { | 2473 | if (ret) { |
@@ -2500,6 +2504,8 @@ static int ehea_up(struct net_device *dev) | |||
2500 | } | 2504 | } |
2501 | } | 2505 | } |
2502 | 2506 | ||
2507 | spin_lock(&ehea_bcmc_regs.lock); | ||
2508 | |||
2503 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); | 2509 | ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); |
2504 | if (ret) { | 2510 | if (ret) { |
2505 | ret = -EIO; | 2511 | ret = -EIO; |
@@ -2521,8 +2527,10 @@ out: | |||
2521 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); | 2527 | ehea_info("Failed starting %s. ret=%i", dev->name, ret); |
2522 | 2528 | ||
2523 | ehea_update_bcmc_registrations(); | 2529 | ehea_update_bcmc_registrations(); |
2530 | spin_unlock(&ehea_bcmc_regs.lock); | ||
2524 | 2531 | ||
2525 | ehea_update_firmware_handles(); | 2532 | ehea_update_firmware_handles(); |
2533 | mutex_unlock(&ehea_fw_handles.lock); | ||
2526 | 2534 | ||
2527 | return ret; | 2535 | return ret; |
2528 | } | 2536 | } |
@@ -2572,6 +2580,9 @@ static int ehea_down(struct net_device *dev) | |||
2572 | if (port->state == EHEA_PORT_DOWN) | 2580 | if (port->state == EHEA_PORT_DOWN) |
2573 | return 0; | 2581 | return 0; |
2574 | 2582 | ||
2583 | mutex_lock(&ehea_fw_handles.lock); | ||
2584 | |||
2585 | spin_lock(&ehea_bcmc_regs.lock); | ||
2575 | ehea_drop_multicast_list(dev); | 2586 | ehea_drop_multicast_list(dev); |
2576 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); | 2587 | ehea_broadcast_reg_helper(port, H_DEREG_BCMC); |
2577 | 2588 | ||
@@ -2580,6 +2591,7 @@ static int ehea_down(struct net_device *dev) | |||
2580 | port->state = EHEA_PORT_DOWN; | 2591 | port->state = EHEA_PORT_DOWN; |
2581 | 2592 | ||
2582 | ehea_update_bcmc_registrations(); | 2593 | ehea_update_bcmc_registrations(); |
2594 | spin_unlock(&ehea_bcmc_regs.lock); | ||
2583 | 2595 | ||
2584 | ret = ehea_clean_all_portres(port); | 2596 | ret = ehea_clean_all_portres(port); |
2585 | if (ret) | 2597 | if (ret) |
@@ -2587,6 +2599,7 @@ static int ehea_down(struct net_device *dev) | |||
2587 | dev->name, ret); | 2599 | dev->name, ret); |
2588 | 2600 | ||
2589 | ehea_update_firmware_handles(); | 2601 | ehea_update_firmware_handles(); |
2602 | mutex_unlock(&ehea_fw_handles.lock); | ||
2590 | 2603 | ||
2591 | return ret; | 2604 | return ret; |
2592 | } | 2605 | } |
@@ -3365,6 +3378,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, | |||
3365 | ehea_error("Invalid ibmebus device probed"); | 3378 | ehea_error("Invalid ibmebus device probed"); |
3366 | return -EINVAL; | 3379 | return -EINVAL; |
3367 | } | 3380 | } |
3381 | mutex_lock(&ehea_fw_handles.lock); | ||
3368 | 3382 | ||
3369 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 3383 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
3370 | if (!adapter) { | 3384 | if (!adapter) { |
@@ -3448,6 +3462,7 @@ out_free_ad: | |||
3448 | 3462 | ||
3449 | out: | 3463 | out: |
3450 | ehea_update_firmware_handles(); | 3464 | ehea_update_firmware_handles(); |
3465 | mutex_unlock(&ehea_fw_handles.lock); | ||
3451 | return ret; | 3466 | return ret; |
3452 | } | 3467 | } |
3453 | 3468 | ||
@@ -3466,6 +3481,8 @@ static int __devexit ehea_remove(struct of_device *dev) | |||
3466 | 3481 | ||
3467 | flush_scheduled_work(); | 3482 | flush_scheduled_work(); |
3468 | 3483 | ||
3484 | mutex_lock(&ehea_fw_handles.lock); | ||
3485 | |||
3469 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); | 3486 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3470 | tasklet_kill(&adapter->neq_tasklet); | 3487 | tasklet_kill(&adapter->neq_tasklet); |
3471 | 3488 | ||
@@ -3475,6 +3492,7 @@ static int __devexit ehea_remove(struct of_device *dev) | |||
3475 | kfree(adapter); | 3492 | kfree(adapter); |
3476 | 3493 | ||
3477 | ehea_update_firmware_handles(); | 3494 | ehea_update_firmware_handles(); |
3495 | mutex_unlock(&ehea_fw_handles.lock); | ||
3478 | 3496 | ||
3479 | return 0; | 3497 | return 0; |
3480 | } | 3498 | } |