From: Jan-Bernd Themann <ossthema@de.ibm.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Thomas Klein <tklein@de.ibm.com>,
Jan-Bernd Themann <themann@de.ibm.com>,
netdev <netdev@vger.kernel.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
linux-ppc <linuxppc-dev@ozlabs.org>,
Christoph Raisch <raisch@de.ibm.com>,
Marcus Eder <meder@de.ibm.com>,
Stefan Roscher <stefan.roscher@de.ibm.com>
Subject: [PATCH 1/2] ehea: fix for dynamic lpar support
Date: Thu, 22 Mar 2007 17:49:42 +0100 [thread overview]
Message-ID: <200703221749.42876.ossthema@de.ibm.com> (raw)
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>
---
This patch applies on top of the netdev upstream branch for 2.6.22
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h
index d593513..1fefb2d 100644
--- a/drivers/net/ehea/ehea.h
+++ b/drivers/net/ehea/ehea.h
@@ -39,7 +39,7 @@ #include <asm/abs_addr.h>
#include <asm/io.h>
#define DRV_NAME "ehea"
-#define DRV_VERSION "EHEA_0052"
+#define DRV_VERSION "EHEA_0053"
#define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
| 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 a3c235e..8d94a85 100644
--- a/drivers/net/ehea/ehea_main.c
+++ b/drivers/net/ehea/ehea_main.c
@@ -2556,11 +2556,8 @@ static int ehea_setup_ports(struct ehea_
int i = 0;
lhea_dn = adapter->ebus_dev->ofdev.node;
- do {
- eth_dn = of_get_next_child(lhea_dn, eth_dn);
- if (!eth_dn)
- break;
-
+ while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
+
dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
NULL);
if (!dn_log_port_id) {
@@ -2577,9 +2574,7 @@ static int ehea_setup_ports(struct ehea_
adapter->port[i]->netdev->name,
*dn_log_port_id);
i++;
- } while (eth_dn);
-
- of_node_put(lhea_dn);
+ };
/* Check for succesfully set up ports */
for (i = 0; i < EHEA_MAX_PORTS; i++)
@@ -2600,21 +2595,14 @@ static struct device_node *ehea_get_eth_
u32 *dn_log_port_id;
lhea_dn = adapter->ebus_dev->ofdev.node;
- do {
- eth_dn = of_get_next_child(lhea_dn, eth_dn);
- if (!eth_dn)
- break;
-
+ while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) {
+
dn_log_port_id = (u32*)get_property(eth_dn, "ibm,hea-port-no",
NULL);
-
if (dn_log_port_id)
if (*dn_log_port_id == logical_port_id)
return eth_dn;
-
- } while (eth_dn);
-
- of_node_put(lhea_dn);
+ };
return NULL;
}
@@ -2650,6 +2638,8 @@ static ssize_t ehea_probe_port(struct de
port = ehea_setup_single_port(adapter, logical_port_id, eth_dn);
+ of_node_put(eth_dn);
+
if (port) {
for (i=0; i < EHEA_MAX_PORTS; i++)
if (!adapter->port[i]) {
@@ -2725,6 +2715,11 @@ static int __devinit ehea_probe_adapter(
u64 *adapter_handle;
int ret;
+ if (!dev || !dev->ofdev.node) {
+ ehea_error("Invalid ibmebus device probed");
+ return -EINVAL;
+ }
+
adapter = kzalloc(sizeof(*adapter), GFP_KERNEL);
if (!adapter) {
ret = -ENOMEM;
@@ -2767,6 +2762,7 @@ static int __devinit ehea_probe_adapter(
adapter->neq = ehea_create_eq(adapter,
EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1);
if (!adapter->neq) {
+ ret = -EIO;
dev_err(&dev->ofdev.dev, "NEQ creation failed");
goto out_free_res;
}
@@ -2783,10 +2779,13 @@ static int __devinit ehea_probe_adapter(
}
adapter->ehea_wq = create_workqueue("ehea_wq");
- if (!adapter->ehea_wq)
+ if (!adapter->ehea_wq) {
+ ret = -EIO;
goto out_free_irq;
+ }
- if (ehea_create_device_sysfs(dev))
+ ret = ehea_create_device_sysfs(dev);
+ if (ret)
goto out_kill_wq;
ret = ehea_setup_ports(adapter);
next reply other threads:[~2007-03-22 16:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-22 16:49 Jan-Bernd Themann [this message]
2007-03-23 5:58 ` [PATCH 1/2] ehea: fix for dynamic lpar support Jeff Garzik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200703221749.42876.ossthema@de.ibm.com \
--to=ossthema@de.ibm.com \
--cc=jeff@garzik.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=meder@de.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=raisch@de.ibm.com \
--cc=stefan.roscher@de.ibm.com \
--cc=themann@de.ibm.com \
--cc=tklein@de.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).