aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJan-Bernd Themann <ossthema@de.ibm.com>2007-03-22 12:49:42 -0400
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:01:01 -0400
commit1eef4e04c95fb52a1a3885c8f53a822206fc9aa5 (patch)
tree3040eda40a0f5ab5a51be4ffff82ae5703c9c6ed /drivers/net
parentd68300182828596016d7a6c0f23a912f07d9d0df (diff)
ehea: fix for dynamic lpar support
The patch fixes bugs related to the probe / remove adapter functionality (handling of OFDT nodes) Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ehea/ehea.h2
-rw-r--r--drivers/net/ehea/ehea_main.c39
2 files changed, 20 insertions, 21 deletions
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index d593513f82d0..1fefb2dddc12 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@
39#include <asm/io.h> 39#include <asm/io.h>
40 40
41#define DRV_NAME "ehea" 41#define DRV_NAME "ehea"
42#define DRV_VERSION "EHEA_0052" 42#define DRV_VERSION "EHEA_0053"
43 43
44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \ 44#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR) 45 | NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c
index 8d65eb772b28..db0d79ebae81 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2559,11 +2559,8 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
2559 int i = 0; 2559 int i = 0;
2560 2560
2561 lhea_dn = adapter->ebus_dev->ofdev.node; 2561 lhea_dn = adapter->ebus_dev->ofdev.node;
2562 do { 2562 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
2563 eth_dn = of_get_next_child(lhea_dn, eth_dn); 2563
2564 if (!eth_dn)
2565 break;
2566
2567 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no", 2564 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
2568 NULL); 2565 NULL);
2569 if (!dn_log_port_id) { 2566 if (!dn_log_port_id) {
@@ -2580,9 +2577,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter)
2580 adapter->port[i]->netdev->name, 2577 adapter->port[i]->netdev->name,
2581 *dn_log_port_id); 2578 *dn_log_port_id);
2582 i++; 2579 i++;
2583 } while (eth_dn); 2580 };
2584
2585 of_node_put(lhea_dn);
2586 2581
2587 /* Check for succesfully set up ports */ 2582 /* Check for succesfully set up ports */
2588 for (i = 0; i < EHEA_MAX_PORTS; i++) 2583 for (i = 0; i < EHEA_MAX_PORTS; i++)
@@ -2603,21 +2598,14 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter,
2603 u32 *dn_log_port_id; 2598 u32 *dn_log_port_id;
2604 2599
2605 lhea_dn = adapter->ebus_dev->ofdev.node; 2600 lhea_dn = adapter->ebus_dev->ofdev.node;
2606 do { 2601 while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
2607 eth_dn = of_get_next_child(lhea_dn, eth_dn); 2602
2608 if (!eth_dn)
2609 break;
2610
2611 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no", 2603 dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
2612 NULL); 2604 NULL);
2613
2614 if (dn_log_port_id) 2605 if (dn_log_port_id)
2615 if (*dn_log_port_id == logical_port_id) 2606 if (*dn_log_port_id == logical_port_id)
2616 return eth_dn; 2607 return eth_dn;
2617 2608 };
2618 } while (eth_dn);
2619
2620 of_node_put(lhea_dn);
2621 2609
2622 return NULL; 2610 return NULL;
2623} 2611}
@@ -2653,6 +2641,8 @@ static ssize_t ehea_probe_port(struct device *dev,
2653 2641
2654 port = ehea_setup_single_port(adapter, logical_port_id, eth_dn); 2642 port = ehea_setup_single_port(adapter, logical_port_id, eth_dn);
2655 2643
2644 of_node_put(eth_dn);
2645
2656 if (port) { 2646 if (port) {
2657 for (i=0; i < EHEA_MAX_PORTS; i++) 2647 for (i=0; i < EHEA_MAX_PORTS; i++)
2658 if (!adapter->port[i]) { 2648 if (!adapter->port[i]) {
@@ -2728,6 +2718,11 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
2728 u64 *adapter_handle; 2718 u64 *adapter_handle;
2729 int ret; 2719 int ret;
2730 2720
2721 if (!dev || !dev->ofdev.node) {
2722 ehea_error("Invalid ibmebus device probed");
2723 return -EINVAL;
2724 }
2725
2731 adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); 2726 adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
2732 if (!adapter) { 2727 if (!adapter) {
2733 ret = -ENOMEM; 2728 ret = -ENOMEM;
@@ -2770,6 +2765,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
2770 adapter->neq = ehea_create_eq(adapter, 2765 adapter->neq = ehea_create_eq(adapter,
2771 EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); 2766 EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1);
2772 if (!adapter->neq) { 2767 if (!adapter->neq) {
2768 ret = -EIO;
2773 dev_err(&dev->ofdev.dev, "NEQ creation failed"); 2769 dev_err(&dev->ofdev.dev, "NEQ creation failed");
2774 goto out_free_res; 2770 goto out_free_res;
2775 } 2771 }
@@ -2786,10 +2782,13 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev,
2786 } 2782 }
2787 2783
2788 adapter->ehea_wq = create_workqueue("ehea_wq"); 2784 adapter->ehea_wq = create_workqueue("ehea_wq");
2789 if (!adapter->ehea_wq) 2785 if (!adapter->ehea_wq) {
2786 ret = -EIO;
2790 goto out_free_irq; 2787 goto out_free_irq;
2788 }
2791 2789
2792 if (ehea_create_device_sysfs(dev)) 2790 ret = ehea_create_device_sysfs(dev);
2791 if (ret)
2793 goto out_kill_wq; 2792 goto out_kill_wq;
2794 2793
2795 ret = ehea_setup_ports(adapter); 2794 ret = ehea_setup_ports(adapter);