[SCSI] srp_transport: convert to use supported_mode attribute

srp transport works for target drivers without supported_mode
attribute but it would be better to use it explicitly.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
This commit is contained in:
FUJITA Tomonori 2007-09-01 02:03:39 +09:00 committed by James Bottomley
parent 7525236d0b
commit 72e39ea7e0
2 changed files with 7 additions and 4 deletions

View File

@ -820,6 +820,7 @@ static struct scsi_host_template ibmvstgt_sht = {
.eh_abort_handler = ibmvstgt_eh_abort_handler, .eh_abort_handler = ibmvstgt_eh_abort_handler,
.shost_attrs = ibmvstgt_attrs, .shost_attrs = ibmvstgt_attrs,
.proc_name = TGT_NAME, .proc_name = TGT_NAME,
.supported_mode = MODE_TARGET,
}; };
static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id) static int ibmvstgt_probe(struct vio_dev *dev, const struct vio_device_id *id)

View File

@ -222,7 +222,8 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
if (ids->roles == SRP_RPORT_ROLE_INITIATOR) { if (shost->active_mode & MODE_TARGET &&
ids->roles == SRP_RPORT_ROLE_INITIATOR) {
ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport, ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport,
rport->port_id); rport->port_id);
if (ret) { if (ret) {
@ -249,10 +250,11 @@ EXPORT_SYMBOL_GPL(srp_rport_add);
void srp_rport_del(struct srp_rport *rport) void srp_rport_del(struct srp_rport *rport)
{ {
struct device *dev = &rport->dev; struct device *dev = &rport->dev;
struct Scsi_Host *shost = dev_to_shost(dev->parent);
if (rport->roles == SRP_RPORT_ROLE_INITIATOR) if (shost->active_mode & MODE_TARGET &&
srp_tgt_it_nexus_destroy(dev_to_shost(dev->parent), rport->roles == SRP_RPORT_ROLE_INITIATOR)
(unsigned long)rport); srp_tgt_it_nexus_destroy(shost, (unsigned long)rport);
transport_remove_device(dev); transport_remove_device(dev);
device_del(dev); device_del(dev);