[SCSI] scsi_transport_srp: remove tgt dependencies
authorFUJITA Tomonori <tomof@acm.org>
Wed, 1 Aug 2007 15:20:34 +0000 (00:20 +0900)
committerJames Bottomley <jejb@mulgrave.localdomain>
Fri, 12 Oct 2007 18:38:09 +0000 (14:38 -0400)
it's better to remove tgt dependencies in srp transport class since
most people want only initiator support.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/Kconfig
drivers/scsi/scsi_transport_srp.c
drivers/scsi/scsi_transport_srp_internal.h [new file with mode: 0644]

index 4562273dfad35242707f69d2a5f73197597958af..7877dfdd2322408b5940c3e6f101e3ced6821cff 100644 (file)
@@ -291,11 +291,18 @@ source "drivers/scsi/libsas/Kconfig"
 
 config SCSI_SRP_ATTRS
        tristate "SRP Transport Attributes"
-       depends on SCSI && SCSI_TGT
+       depends on SCSI
        help
          If you wish to export transport-specific information about
          each attached SRP device to sysfs, say Y.
 
+config SCSI_SRP_TGT_ATTRS
+       bool "SCSI target support for SRP Transport Attributes"
+       depends on SCSI_SRP_ATTRS
+       depends on SCSI_TGT = y || SCSI_TGT = SCSI_SRP_ATTRS
+       help
+               If you want to use SCSI target mode drivers enable this option.
+
 endmenu
 
 menuconfig SCSI_LOWLEVEL
@@ -848,7 +855,7 @@ config SCSI_IBMVSCSI
 
 config SCSI_IBMVSCSIS
        tristate "IBM Virtual SCSI Server support"
-       depends on PPC_PSERIES && SCSI_TGT && SCSI_SRP && SCSI_SRP_ATTRS
+       depends on PPC_PSERIES && SCSI_SRP && SCSI_SRP_TGT_ATTRS
        help
          This is the SRP target driver for IBM pSeries virtual environments.
 
index cdd001a6639cc70990f62ac5ac0407868d9dabfb..430501ef9f02fed890705ec698f6a9915fcf4715 100644 (file)
@@ -30,7 +30,7 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
 #include <scsi/scsi_transport_srp.h>
-#include <scsi/scsi_tgt.h>
+#include "scsi_transport_srp_internal.h"
 
 struct srp_host_attrs {
        atomic_t next_port_id;
@@ -223,8 +223,8 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost,
        }
 
        if (ids->roles == SRP_RPORT_ROLE_INITIATOR) {
-               ret = scsi_tgt_it_nexus_create(shost, (unsigned long)rport,
-                                              rport->port_id);
+               ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport,
+                                             rport->port_id);
                if (ret) {
                        device_del(&rport->dev);
                        transport_destroy_device(&rport->dev);
@@ -251,8 +251,8 @@ void srp_rport_del(struct srp_rport *rport)
        struct device *dev = &rport->dev;
 
        if (rport->roles == SRP_RPORT_ROLE_INITIATOR)
-               scsi_tgt_it_nexus_destroy(dev_to_shost(dev->parent),
-                                         (unsigned long)rport);
+               srp_tgt_it_nexus_destroy(dev_to_shost(dev->parent),
+                                        (unsigned long)rport);
 
        transport_remove_device(dev);
        device_del(dev);
diff --git a/drivers/scsi/scsi_transport_srp_internal.h b/drivers/scsi/scsi_transport_srp_internal.h
new file mode 100644 (file)
index 0000000..8a79747
--- /dev/null
@@ -0,0 +1,25 @@
+#include <scsi/scsi_tgt.h>
+
+#ifdef CONFIG_SCSI_SRP_TGT_ATTRS
+static inline int srp_tgt_it_nexus_create(struct Scsi_Host *shost, u64 itn_id,
+                                         char *initiator)
+{
+       return scsi_tgt_it_nexus_create(shost, itn_id, initiator);
+}
+
+static inline int srp_tgt_it_nexus_destroy(struct Scsi_Host *shost, u64 itn_id)
+{
+       return scsi_tgt_it_nexus_destroy(shost, itn_id);
+}
+
+#else
+static inline int srp_tgt_it_nexus_create(struct Scsi_Host *shost, u64 itn_id,
+                                         char *initiator)
+{
+       return 0;
+}
+static inline int srp_tgt_it_nexus_destroy(struct Scsi_Host *shost, u64 itn_id)
+{
+       return 0;
+}
+#endif