diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2007-06-27 03:32:50 -0400 |
---|---|---|
committer | James Bottomley <jejb@mulgrave.localdomain> | 2007-10-12 14:37:39 -0400 |
commit | 4d68041907b150b07640b607c6c626391cf3fe8b (patch) | |
tree | 13672f3d6c86dd8ff7405650d6ef4d931eee3b90 | |
parent | 09345f65058bb927f3b3f4c33421f83ba8eeb5f8 (diff) |
[SCSI] ibmvscsi: convert to use the srp transport class
This converts ibmvscsi to use the srp transport class.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Acked-by: Brian King <brking@us.ibm.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
-rw-r--r-- | drivers/scsi/Kconfig | 1 | ||||
-rw-r--r-- | drivers/scsi/ibmvscsi/ibmvscsi.c | 34 |
2 files changed, 33 insertions, 2 deletions
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 50d3062577dc..778dc0fb1e4f 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -839,6 +839,7 @@ config SCSI_IPS | |||
839 | config SCSI_IBMVSCSI | 839 | config SCSI_IBMVSCSI |
840 | tristate "IBM Virtual SCSI support" | 840 | tristate "IBM Virtual SCSI support" |
841 | depends on PPC_PSERIES || PPC_ISERIES | 841 | depends on PPC_PSERIES || PPC_ISERIES |
842 | select SCSI_SRP_ATTRS | ||
842 | help | 843 | help |
843 | This is the IBM POWER Virtual SCSI Client | 844 | This is the IBM POWER Virtual SCSI Client |
844 | 845 | ||
diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c index 5ecc63d1b436..e6f937eeb78f 100644 --- a/drivers/scsi/ibmvscsi/ibmvscsi.c +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c | |||
@@ -75,6 +75,7 @@ | |||
75 | #include <scsi/scsi_cmnd.h> | 75 | #include <scsi/scsi_cmnd.h> |
76 | #include <scsi/scsi_host.h> | 76 | #include <scsi/scsi_host.h> |
77 | #include <scsi/scsi_device.h> | 77 | #include <scsi/scsi_device.h> |
78 | #include <scsi/scsi_transport_srp.h> | ||
78 | #include "ibmvscsi.h" | 79 | #include "ibmvscsi.h" |
79 | 80 | ||
80 | /* The values below are somewhat arbitrary default values, but | 81 | /* The values below are somewhat arbitrary default values, but |
@@ -87,6 +88,8 @@ static int max_channel = 3; | |||
87 | static int init_timeout = 5; | 88 | static int init_timeout = 5; |
88 | static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; | 89 | static int max_requests = IBMVSCSI_MAX_REQUESTS_DEFAULT; |
89 | 90 | ||
91 | static struct scsi_transport_template *ibmvscsi_transport_template; | ||
92 | |||
90 | #define IBMVSCSI_VERSION "1.5.8" | 93 | #define IBMVSCSI_VERSION "1.5.8" |
91 | 94 | ||
92 | MODULE_DESCRIPTION("IBM Virtual SCSI"); | 95 | MODULE_DESCRIPTION("IBM Virtual SCSI"); |
@@ -1553,6 +1556,8 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1553 | struct ibmvscsi_host_data *hostdata; | 1556 | struct ibmvscsi_host_data *hostdata; |
1554 | struct Scsi_Host *host; | 1557 | struct Scsi_Host *host; |
1555 | struct device *dev = &vdev->dev; | 1558 | struct device *dev = &vdev->dev; |
1559 | struct srp_rport_identifiers ids; | ||
1560 | struct srp_rport *rport; | ||
1556 | unsigned long wait_switch = 0; | 1561 | unsigned long wait_switch = 0; |
1557 | int rc; | 1562 | int rc; |
1558 | 1563 | ||
@@ -1565,6 +1570,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1565 | goto scsi_host_alloc_failed; | 1570 | goto scsi_host_alloc_failed; |
1566 | } | 1571 | } |
1567 | 1572 | ||
1573 | host->transportt = ibmvscsi_transport_template; | ||
1568 | hostdata = shost_priv(host); | 1574 | hostdata = shost_priv(host); |
1569 | memset(hostdata, 0x00, sizeof(*hostdata)); | 1575 | memset(hostdata, 0x00, sizeof(*hostdata)); |
1570 | INIT_LIST_HEAD(&hostdata->sent); | 1576 | INIT_LIST_HEAD(&hostdata->sent); |
@@ -1590,6 +1596,13 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1590 | if (scsi_add_host(hostdata->host, hostdata->dev)) | 1596 | if (scsi_add_host(hostdata->host, hostdata->dev)) |
1591 | goto add_host_failed; | 1597 | goto add_host_failed; |
1592 | 1598 | ||
1599 | /* we don't have a proper target_port_id so let's use the fake one */ | ||
1600 | memcpy(ids.port_id, hostdata->madapter_info.partition_name, | ||
1601 | sizeof(ids.port_id)); | ||
1602 | rport = srp_rport_add(host, &ids); | ||
1603 | if (IS_ERR(rport)) | ||
1604 | goto add_srp_port_failed; | ||
1605 | |||
1593 | /* Try to send an initialization message. Note that this is allowed | 1606 | /* Try to send an initialization message. Note that this is allowed |
1594 | * to fail if the other end is not acive. In that case we don't | 1607 | * to fail if the other end is not acive. In that case we don't |
1595 | * want to scan | 1608 | * want to scan |
@@ -1617,6 +1630,8 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id) | |||
1617 | vdev->dev.driver_data = hostdata; | 1630 | vdev->dev.driver_data = hostdata; |
1618 | return 0; | 1631 | return 0; |
1619 | 1632 | ||
1633 | add_srp_port_failed: | ||
1634 | scsi_remove_host(hostdata->host); | ||
1620 | add_host_failed: | 1635 | add_host_failed: |
1621 | release_event_pool(&hostdata->pool, hostdata); | 1636 | release_event_pool(&hostdata->pool, hostdata); |
1622 | init_pool_failed: | 1637 | init_pool_failed: |
@@ -1633,7 +1648,8 @@ static int ibmvscsi_remove(struct vio_dev *vdev) | |||
1633 | release_event_pool(&hostdata->pool, hostdata); | 1648 | release_event_pool(&hostdata->pool, hostdata); |
1634 | ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, | 1649 | ibmvscsi_release_crq_queue(&hostdata->queue, hostdata, |
1635 | max_requests); | 1650 | max_requests); |
1636 | 1651 | ||
1652 | srp_remove_host(hostdata->host); | ||
1637 | scsi_remove_host(hostdata->host); | 1653 | scsi_remove_host(hostdata->host); |
1638 | scsi_host_put(hostdata->host); | 1654 | scsi_host_put(hostdata->host); |
1639 | 1655 | ||
@@ -1660,14 +1676,28 @@ static struct vio_driver ibmvscsi_driver = { | |||
1660 | } | 1676 | } |
1661 | }; | 1677 | }; |
1662 | 1678 | ||
1679 | static struct srp_function_template ibmvscsi_transport_functions = { | ||
1680 | }; | ||
1681 | |||
1663 | int __init ibmvscsi_module_init(void) | 1682 | int __init ibmvscsi_module_init(void) |
1664 | { | 1683 | { |
1665 | return vio_register_driver(&ibmvscsi_driver); | 1684 | int ret; |
1685 | |||
1686 | ibmvscsi_transport_template = | ||
1687 | srp_attach_transport(&ibmvscsi_transport_functions); | ||
1688 | if (!ibmvscsi_transport_template) | ||
1689 | return -ENOMEM; | ||
1690 | |||
1691 | ret = vio_register_driver(&ibmvscsi_driver); | ||
1692 | if (ret) | ||
1693 | srp_release_transport(ibmvscsi_transport_template); | ||
1694 | return ret; | ||
1666 | } | 1695 | } |
1667 | 1696 | ||
1668 | void __exit ibmvscsi_module_exit(void) | 1697 | void __exit ibmvscsi_module_exit(void) |
1669 | { | 1698 | { |
1670 | vio_unregister_driver(&ibmvscsi_driver); | 1699 | vio_unregister_driver(&ibmvscsi_driver); |
1700 | srp_release_transport(ibmvscsi_transport_template); | ||
1671 | } | 1701 | } |
1672 | 1702 | ||
1673 | module_init(ibmvscsi_module_init); | 1703 | module_init(ibmvscsi_module_init); |