Skip to contentSkip to conversation

eHEA: Capability flag for DLPAR support

PATCH In review Jan-Bernd Themann 2 participants 3 messages Jul 4, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 eHEA: Capability flag for DLPAR support

This patch introduces a capability flag that is used by the DLPAR userspace tool to check which DLPAR features are supported by the eHEA driver.

---
 drivers/net/ehea/ehea.h      |    8 +++++++-
 drivers/net/ehea/ehea_main.c |   17 +++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)
drivers/net/ehea/ehea.h +7 -1
index abaf3ac..809e3f2 100644
@@ -39,7 +39,13 @@
 #include <asm/io.h>
 
 #define DRV_NAME	"ehea"
-#define DRV_VERSION	"EHEA_0065"
+#define DRV_VERSION	"EHEA_0066"
+
+/* EHEA capability flags */
+#define DLPAR_PORT_ADD_REM 1
+#define DLPAR_MEM_ADD 2
+#define DLPAR_MEM_REM 4
+#define EHEA_CAPABILITIES (DLPAR_PORT_ADD_REM)
 
 #define EHEA_MSG_DEFAULT (NETIF_MSG_LINK | NETIF_MSG_TIMER \
 	| NETIF_MSG_RX_ERR | NETIF_MSG_TX_ERR)
drivers/net/ehea/ehea_main.c +17 -0
index bdb5241..f8c0908 100644
@@ -2923,6 +2923,15 @@ static int check_module_parm(void)
 	return ret;
 }
 
+static ssize_t ehea_show_capabilities(struct device_driver *drv,
+				      char *buf)
+{
+	return sprintf(buf, "%d", EHEA_CAPABILITIES);
+}
+
+static DRIVER_ATTR(capabilities, S_IRUSR | S_IRGRP | S_IROTH,
+		   ehea_show_capabilities, NULL);
+
 int __init ehea_module_init(void)
 {
 	int ret;
@@ -2937,12 +2946,20 @@ int __init ehea_module_init(void)
 	if (ret)
 		ehea_error("failed registering eHEA device driver on ebus");
 
+	ret = driver_create_file(&ehea_driver.driver, &driver_attr_capabilities);
+	if (ret) {
+		ehea_error("failed to register capabilities attribute, ret=%d", ret);
+		ibmebus_unregister_driver(&ehea_driver);
+		goto out;
+	}
+
 out:
 	return ret;
 }
 
 static void __exit ehea_module_exit(void)
 {
+	driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
 	ibmebus_unregister_driver(&ehea_driver);
 }
 
Signature · 1 line
1.5.2
#1 lore raw

2007/7/4, Jan-Bernd Themann <[email protected]>:

Quoted 21 lines
drivers/net/ehea/ehea_main.c +9 -0
index bdb5241..f8c0908 100644
@@ -2923,6 +2923,15 @@ static int check_module_parm(void)
        return ret;
 }
 
+static ssize_t ehea_show_capabilities(struct device_driver *drv,
+                                     char *buf)
+{
+       return sprintf(buf, "%d", EHEA_CAPABILITIES);
+}
+
+static DRIVER_ATTR(capabilities, S_IRUSR | S_IRGRP | S_IROTH,
+                  ehea_show_capabilities, NULL);
+
 int __init ehea_module_init(void)
 {
        int ret;

drivers/net/ehea/ehea_main.c int __init ehea_module_init(void) · line 2948

Quoted 3 lines
drivers/net/ehea/ehea_main.c +0 -0
@@ -2937,12 +2946,20 @@ int __init ehea_module_init(void)
        if (ret)
                ehea_error("failed registering eHEA device driver on ebus");
 

You forgot to put:

               return ret;
or
               goto out;
Quoted 11 lines
drivers/net/ehea/ehea_main.c +7 -0
+       ret = driver_create_file(&ehea_driver.driver, &driver_attr_capabilities);
+       if (ret) {
+               ehea_error("failed to register capabilities attribute, ret=%d", ret);
+               ibmebus_unregister_driver(&ehea_driver);
+               goto out;
+       }
+
 out:
        return ret;
 }
 
#2 lore raw

Hi,

good catch.

Thanks

Quoted 44 lines · Akinobu Mita

2007/7/4, Jan-Bernd Themann <[email protected]>:

Quoted 21 lines
drivers/net/ehea/ehea_main.c +9 -0
index bdb5241..f8c0908 100644
@@ -2923,6 +2923,15 @@ static int check_module_parm(void)
        return ret;
 }
 
+static ssize_t ehea_show_capabilities(struct device_driver *drv,
+                                     char *buf)
+{
+       return sprintf(buf, "%d", EHEA_CAPABILITIES);
+}
+
+static DRIVER_ATTR(capabilities, S_IRUSR | S_IRGRP | S_IROTH,
+                  ehea_show_capabilities, NULL);
+
 int __init ehea_module_init(void)
 {
        int ret;

drivers/net/ehea/ehea_main.c int __init ehea_module_init(void) · line 2948

Quoted 3 lines
drivers/net/ehea/ehea_main.c +0 -0
@@ -2937,12 +2946,20 @@ int __init ehea_module_init(void)
        if (ret)
                ehea_error("failed registering eHEA device driver on ebus");
 

You forgot to put:

                return ret;
or
                goto out;
Quoted 11 lines
drivers/net/ehea/ehea_main.c +7 -0
+       ret = driver_create_file(&ehea_driver.driver, &driver_attr_capabilities);
+       if (ret) {
+               ehea_error("failed to register capabilities attribute, ret=%d", ret);
+               ibmebus_unregister_driver(&ehea_driver);
+               goto out;
+       }
+
 out:
        return ret;
 }