eHEA: Capability flag for DLPAR support
authorJan-Bernd Themann <ossthema@de.ibm.com>
Thu, 5 Jul 2007 07:26:25 +0000 (09:26 +0200)
committerJeff Garzik <jeff@garzik.org>
Tue, 10 Jul 2007 16:59:41 +0000 (12:59 -0400)
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.

Missing goto has been included.

Signed-off-by: Jan-Bernd Themann <themann@de.ibm.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c

index abaf3ac949363bcbaad77af8d3caebf8ad384d74..f03f070451dee57f51120566bb5fae7aa30c33cc 100644 (file)
 #include <asm/io.h>
 
 #define DRV_NAME       "ehea"
-#define DRV_VERSION    "EHEA_0065"
+#define DRV_VERSION    "EHEA_0067"
+
+/* 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)
index bdb52419dbf5d8cc672ca30e597a5860a9d9cd69..383144db4d18df1187749dfb98138251dff66b46 100644 (file)
@@ -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;
@@ -2934,8 +2943,19 @@ int __init ehea_module_init(void)
        if (ret)
                goto out;
        ret = ibmebus_register_driver(&ehea_driver);
-       if (ret)
+       if (ret) {
                ehea_error("failed registering eHEA device driver on ebus");
+               goto out;
+       }
+
+       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;
@@ -2943,6 +2963,7 @@ out:
 
 static void __exit ehea_module_exit(void)
 {
+       driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
        ibmebus_unregister_driver(&ehea_driver);
 }