Commit ef40a685 authored by David S. Miller's avatar David S. Miller

Revert "ehea: fix mutex and spinlock use"

This reverts commit 2eefbd63.

On request by driver author and Jeff Garzik.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 630b25cd
...@@ -219,11 +219,9 @@ static void ehea_update_firmware_handles(void) ...@@ -219,11 +219,9 @@ static void ehea_update_firmware_handles(void)
} }
out_update: out_update:
mutex_lock(&ehea_fw_handles.lock);
kfree(ehea_fw_handles.arr); kfree(ehea_fw_handles.arr);
ehea_fw_handles.arr = arr; ehea_fw_handles.arr = arr;
ehea_fw_handles.num_entries = i; ehea_fw_handles.num_entries = i;
mutex_unlock(&ehea_fw_handles.lock);
} }
static void ehea_update_bcmc_registrations(void) static void ehea_update_bcmc_registrations(void)
...@@ -295,11 +293,9 @@ static void ehea_update_bcmc_registrations(void) ...@@ -295,11 +293,9 @@ static void ehea_update_bcmc_registrations(void)
} }
out_update: out_update:
spin_lock(&ehea_bcmc_regs.lock);
kfree(ehea_bcmc_regs.arr); kfree(ehea_bcmc_regs.arr);
ehea_bcmc_regs.arr = arr; ehea_bcmc_regs.arr = arr;
ehea_bcmc_regs.num_entries = i; ehea_bcmc_regs.num_entries = i;
spin_unlock(&ehea_bcmc_regs.lock);
} }
static struct net_device_stats *ehea_get_stats(struct net_device *dev) 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,6 +1770,8 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len); memcpy(dev->dev_addr, mac_addr->sa_data, dev->addr_len);
spin_lock(&ehea_bcmc_regs.lock);
/* Deregister old MAC in pHYP */ /* Deregister old MAC in pHYP */
if (port->state == EHEA_PORT_UP) { if (port->state == EHEA_PORT_UP) {
ret = ehea_broadcast_reg_helper(port, H_DEREG_BCMC); 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,6 +1792,7 @@ static int ehea_set_mac_addr(struct net_device *dev, void *sa)
out_upregs: out_upregs:
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
spin_unlock(&ehea_bcmc_regs.lock);
out_free: out_free:
kfree(cb0); kfree(cb0);
out: out:
...@@ -1955,6 +1954,8 @@ static void ehea_set_multicast_list(struct net_device *dev) ...@@ -1955,6 +1954,8 @@ static void ehea_set_multicast_list(struct net_device *dev)
} }
ehea_promiscuous(dev, 0); ehea_promiscuous(dev, 0);
spin_lock(&ehea_bcmc_regs.lock);
if (dev->flags & IFF_ALLMULTI) { if (dev->flags & IFF_ALLMULTI) {
ehea_allmulti(dev, 1); ehea_allmulti(dev, 1);
goto out; goto out;
...@@ -1984,6 +1985,7 @@ static void ehea_set_multicast_list(struct net_device *dev) ...@@ -1984,6 +1985,7 @@ static void ehea_set_multicast_list(struct net_device *dev)
} }
out: out:
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
spin_unlock(&ehea_bcmc_regs.lock);
return; return;
} }
...@@ -2464,6 +2466,8 @@ static int ehea_up(struct net_device *dev) ...@@ -2464,6 +2466,8 @@ static int ehea_up(struct net_device *dev)
if (port->state == EHEA_PORT_UP) if (port->state == EHEA_PORT_UP)
return 0; return 0;
mutex_lock(&ehea_fw_handles.lock);
ret = ehea_port_res_setup(port, port->num_def_qps, ret = ehea_port_res_setup(port, port->num_def_qps,
port->num_add_tx_qps); port->num_add_tx_qps);
if (ret) { if (ret) {
...@@ -2500,6 +2504,8 @@ static int ehea_up(struct net_device *dev) ...@@ -2500,6 +2504,8 @@ static int ehea_up(struct net_device *dev)
} }
} }
spin_lock(&ehea_bcmc_regs.lock);
ret = ehea_broadcast_reg_helper(port, H_REG_BCMC); ret = ehea_broadcast_reg_helper(port, H_REG_BCMC);
if (ret) { if (ret) {
ret = -EIO; ret = -EIO;
...@@ -2521,8 +2527,10 @@ static int ehea_up(struct net_device *dev) ...@@ -2521,8 +2527,10 @@ static int ehea_up(struct net_device *dev)
ehea_info("Failed starting %s. ret=%i", dev->name, ret); ehea_info("Failed starting %s. ret=%i", dev->name, ret);
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
spin_unlock(&ehea_bcmc_regs.lock);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -2572,6 +2580,9 @@ static int ehea_down(struct net_device *dev) ...@@ -2572,6 +2580,9 @@ static int ehea_down(struct net_device *dev)
if (port->state == EHEA_PORT_DOWN) if (port->state == EHEA_PORT_DOWN)
return 0; return 0;
mutex_lock(&ehea_fw_handles.lock);
spin_lock(&ehea_bcmc_regs.lock);
ehea_drop_multicast_list(dev); ehea_drop_multicast_list(dev);
ehea_broadcast_reg_helper(port, H_DEREG_BCMC); ehea_broadcast_reg_helper(port, H_DEREG_BCMC);
...@@ -2580,6 +2591,7 @@ static int ehea_down(struct net_device *dev) ...@@ -2580,6 +2591,7 @@ static int ehea_down(struct net_device *dev)
port->state = EHEA_PORT_DOWN; port->state = EHEA_PORT_DOWN;
ehea_update_bcmc_registrations(); ehea_update_bcmc_registrations();
spin_unlock(&ehea_bcmc_regs.lock);
ret = ehea_clean_all_portres(port); ret = ehea_clean_all_portres(port);
if (ret) if (ret)
...@@ -2587,6 +2599,7 @@ static int ehea_down(struct net_device *dev) ...@@ -2587,6 +2599,7 @@ static int ehea_down(struct net_device *dev)
dev->name, ret); dev->name, ret);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -3365,6 +3378,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ...@@ -3365,6 +3378,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
ehea_error("Invalid ibmebus device probed"); ehea_error("Invalid ibmebus device probed");
return -EINVAL; return -EINVAL;
} }
mutex_lock(&ehea_fw_handles.lock);
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) { if (!adapter) {
...@@ -3448,6 +3462,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev, ...@@ -3448,6 +3462,7 @@ static int __devinit ehea_probe_adapter(struct of_device *dev,
out: out:
ehea_update_firmware_handles(); ehea_update_firmware_handles();
mutex_unlock(&ehea_fw_handles.lock);
return ret; return ret;
} }
...@@ -3466,6 +3481,8 @@ static int __devexit ehea_remove(struct of_device *dev) ...@@ -3466,6 +3481,8 @@ static int __devexit ehea_remove(struct of_device *dev)
flush_scheduled_work(); flush_scheduled_work();
mutex_lock(&ehea_fw_handles.lock);
ibmebus_free_irq(adapter->neq->attr.ist1, adapter); ibmebus_free_irq(adapter->neq->attr.ist1, adapter);
tasklet_kill(&adapter->neq_tasklet); tasklet_kill(&adapter->neq_tasklet);
...@@ -3475,6 +3492,7 @@ static int __devexit ehea_remove(struct of_device *dev) ...@@ -3475,6 +3492,7 @@ static int __devexit ehea_remove(struct of_device *dev)
kfree(adapter); kfree(adapter);
ehea_update_firmware_handles(); ehea_update_firmware_handles();
mutex_unlock(&ehea_fw_handles.lock);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment