fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / drivers / s390 / scsi / zfcp_sysfs_adapter.c
index 3890438..705c6d4 100644 (file)
@@ -1,15 +1,8 @@
 /*
- * linux/drivers/s390/scsi/zfcp_sysfs_adapter.c
+ * This file is part of the zfcp device driver for
+ * FCP adapters for IBM System z9 and zSeries.
  *
- * FCP adapter driver for IBM eServer zSeries
- *
- * sysfs adapter related routines
- *
- * (C) Copyright IBM Corp. 2003, 2004
- *
- * Authors:
- *      Martin Peschke <mpeschke@de.ibm.com>
- *     Heiko Carstens <heiko.carstens@de.ibm.com>
+ * (C) Copyright IBM Corp. 2002, 2006
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.32 $"
-
-#include <asm/ccwdev.h>
 #include "zfcp_ext.h"
-#include "zfcp_def.h"
 
 #define ZFCP_LOG_AREA                   ZFCP_LOG_AREA_CONFIG
 
-static const char fc_topologies[5][25] = {
-       {"<error>"},
-       {"point-to-point"},
-       {"fabric"},
-       {"arbitrated loop"},
-       {"fabric (virt. adapter)"}
-};
-
 /**
  * ZFCP_DEFINE_ADAPTER_ATTR
  * @_name:   name of show attribute
@@ -51,7 +32,7 @@ static const char fc_topologies[5][25] = {
  * Generates attributes for an adapter.
  */
 #define ZFCP_DEFINE_ADAPTER_ATTR(_name, _format, _value)                      \
-static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,          \
+static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev, struct device_attribute *attr,          \
                                                 char *buf)                   \
 {                                                                             \
        struct zfcp_adapter *adapter;                                         \
@@ -63,42 +44,15 @@ static ssize_t zfcp_sysfs_adapter_##_name##_show(struct device *dev,          \
 static DEVICE_ATTR(_name, S_IRUGO, zfcp_sysfs_adapter_##_name##_show, NULL);
 
 ZFCP_DEFINE_ADAPTER_ATTR(status, "0x%08x\n", atomic_read(&adapter->status));
-ZFCP_DEFINE_ADAPTER_ATTR(wwnn, "0x%016llx\n", adapter->wwnn);
-ZFCP_DEFINE_ADAPTER_ATTR(wwpn, "0x%016llx\n", adapter->wwpn);
-ZFCP_DEFINE_ADAPTER_ATTR(s_id, "0x%06x\n", adapter->s_id);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_wwnn, "0x%016llx\n", adapter->peer_wwnn);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_wwpn, "0x%016llx\n", adapter->peer_wwpn);
+ZFCP_DEFINE_ADAPTER_ATTR(peer_d_id, "0x%06x\n", adapter->peer_d_id);
 ZFCP_DEFINE_ADAPTER_ATTR(card_version, "0x%04x\n", adapter->hydra_version);
 ZFCP_DEFINE_ADAPTER_ATTR(lic_version, "0x%08x\n", adapter->fsf_lic_version);
-ZFCP_DEFINE_ADAPTER_ATTR(fc_link_speed, "%d Gb/s\n", adapter->fc_link_speed);
-ZFCP_DEFINE_ADAPTER_ATTR(fc_service_class, "%d\n", adapter->fc_service_class);
-ZFCP_DEFINE_ADAPTER_ATTR(fc_topology, "%s\n",
-                        fc_topologies[adapter->fc_topology]);
 ZFCP_DEFINE_ADAPTER_ATTR(hardware_version, "0x%08x\n",
                         adapter->hardware_version);
-ZFCP_DEFINE_ADAPTER_ATTR(serial_number, "%17s\n", adapter->serial_number);
-ZFCP_DEFINE_ADAPTER_ATTR(scsi_host_no, "0x%x\n", adapter->scsi_host_no);
-
-/**
- * zfcp_sysfs_adapter_in_recovery_show - recovery state of adapter
- * @dev: pointer to belonging device
- * @buf: pointer to input buffer
- *
- * Show function of "in_recovery" attribute of adapter. Will be
- * "0" if no error recovery is pending for adapter, otherwise "1".
- */
-static ssize_t
-zfcp_sysfs_adapter_in_recovery_show(struct device *dev, char *buf)
-{
-       struct zfcp_adapter *adapter;
-
-       adapter = dev_get_drvdata(dev);
-       if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status))
-               return sprintf(buf, "1\n");
-       else
-               return sprintf(buf, "0\n");
-}
-
-static DEVICE_ATTR(in_recovery, S_IRUGO,
-                  zfcp_sysfs_adapter_in_recovery_show, NULL);
+ZFCP_DEFINE_ADAPTER_ATTR(in_recovery, "%d\n", atomic_test_mask
+                        (ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status));
 
 /**
  * zfcp_sysfs_port_add_store - add a port to sysfs tree
@@ -109,7 +63,7 @@ static DEVICE_ATTR(in_recovery, S_IRUGO,
  * Store function of the "port_add" attribute of an adapter.
  */
 static ssize_t
-zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count)
+zfcp_sysfs_port_add_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        wwn_t wwpn;
        char *endp;
@@ -129,7 +83,7 @@ zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count)
        if ((endp + 1) < (buf + count))
                goto out;
 
-       port = zfcp_port_enqueue(adapter, wwpn, 0);
+       port = zfcp_port_enqueue(adapter, wwpn, 0, 0);
        if (!port)
                goto out;
 
@@ -140,7 +94,7 @@ zfcp_sysfs_port_add_store(struct device *dev, const char *buf, size_t count)
        zfcp_port_put(port);
  out:
        up(&zfcp_data.config_sema);
-       return retval ? retval : count;
+       return retval ? retval : (ssize_t) count;
 }
 
 static DEVICE_ATTR(port_add, S_IWUSR, NULL, zfcp_sysfs_port_add_store);
@@ -154,7 +108,7 @@ static DEVICE_ATTR(port_add, S_IWUSR, NULL, zfcp_sysfs_port_add_store);
  * Store function of the "port_remove" attribute of an adapter.
  */
 static ssize_t
-zfcp_sysfs_port_remove_store(struct device *dev, const char *buf, size_t count)
+zfcp_sysfs_port_remove_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        struct zfcp_adapter *adapter;
        struct zfcp_port *port;
@@ -199,7 +153,7 @@ zfcp_sysfs_port_remove_store(struct device *dev, const char *buf, size_t count)
        zfcp_port_dequeue(port);
  out:
        up(&zfcp_data.config_sema);
-       return retval ? retval : count;
+       return retval ? retval : (ssize_t) count;
 }
 
 static DEVICE_ATTR(port_remove, S_IWUSR, NULL, zfcp_sysfs_port_remove_store);
@@ -215,7 +169,7 @@ static DEVICE_ATTR(port_remove, S_IWUSR, NULL, zfcp_sysfs_port_remove_store);
  * started for the belonging adapter.
  */
 static ssize_t
-zfcp_sysfs_adapter_failed_store(struct device *dev,
+zfcp_sysfs_adapter_failed_store(struct device *dev, struct device_attribute *attr,
                                const char *buf, size_t count)
 {
        struct zfcp_adapter *adapter;
@@ -243,7 +197,7 @@ zfcp_sysfs_adapter_failed_store(struct device *dev,
        zfcp_erp_wait(adapter);
  out:
        up(&zfcp_data.config_sema);
-       return retval ? retval : count;
+       return retval ? retval : (ssize_t) count;
 }
 
 /**
@@ -255,7 +209,7 @@ zfcp_sysfs_adapter_failed_store(struct device *dev,
  * "0" if adapter is working, otherwise "1".
  */
 static ssize_t
-zfcp_sysfs_adapter_failed_show(struct device *dev, char *buf)
+zfcp_sysfs_adapter_failed_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct zfcp_adapter *adapter;
 
@@ -274,18 +228,13 @@ static struct attribute *zfcp_adapter_attrs[] = {
        &dev_attr_in_recovery.attr,
        &dev_attr_port_remove.attr,
        &dev_attr_port_add.attr,
-       &dev_attr_wwnn.attr,
-       &dev_attr_wwpn.attr,
-       &dev_attr_s_id.attr,
+       &dev_attr_peer_wwnn.attr,
+       &dev_attr_peer_wwpn.attr,
+       &dev_attr_peer_d_id.attr,
        &dev_attr_card_version.attr,
        &dev_attr_lic_version.attr,
-       &dev_attr_fc_link_speed.attr,
-       &dev_attr_fc_service_class.attr,
-       &dev_attr_fc_topology.attr,
-       &dev_attr_scsi_host_no.attr,
        &dev_attr_status.attr,
        &dev_attr_hardware_version.attr,
-       &dev_attr_serial_number.attr,
        NULL
 };