diff options
Diffstat (limited to 'drivers/scsi/scsi_transport_sas.c')
-rw-r--r-- | drivers/scsi/scsi_transport_sas.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c index f3b16066387c..1fe6b2d01853 100644 --- a/drivers/scsi/scsi_transport_sas.c +++ b/drivers/scsi/scsi_transport_sas.c | |||
@@ -65,7 +65,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \ | |||
65 | ssize_t len = 0; \ | 65 | ssize_t len = 0; \ |
66 | int i; \ | 66 | int i; \ |
67 | \ | 67 | \ |
68 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 68 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
69 | if (table[i].value & table_key) { \ | 69 | if (table[i].value & table_key) { \ |
70 | len += sprintf(buf + len, "%s%s", \ | 70 | len += sprintf(buf + len, "%s%s", \ |
71 | prefix, table[i].name); \ | 71 | prefix, table[i].name); \ |
@@ -83,7 +83,7 @@ get_sas_##title##_names(u32 table_key, char *buf) \ | |||
83 | ssize_t len = 0; \ | 83 | ssize_t len = 0; \ |
84 | int i; \ | 84 | int i; \ |
85 | \ | 85 | \ |
86 | for (i = 0; i < sizeof(table)/sizeof(table[0]); i++) { \ | 86 | for (i = 0; i < ARRAY_SIZE(table); i++) { \ |
87 | if (table[i].value == table_key) { \ | 87 | if (table[i].value == table_key) { \ |
88 | len += sprintf(buf + len, "%s", \ | 88 | len += sprintf(buf + len, "%s", \ |
89 | table[i].name); \ | 89 | table[i].name); \ |
@@ -748,6 +748,18 @@ static void sas_end_device_release(struct device *dev) | |||
748 | } | 748 | } |
749 | 749 | ||
750 | /** | 750 | /** |
751 | * sas_rphy_initialize - common rphy intialization | ||
752 | * @rphy: rphy to initialise | ||
753 | * | ||
754 | * Used by both sas_end_device_alloc() and sas_expander_alloc() to | ||
755 | * initialise the common rphy component of each. | ||
756 | */ | ||
757 | static void sas_rphy_initialize(struct sas_rphy *rphy) | ||
758 | { | ||
759 | INIT_LIST_HEAD(&rphy->list); | ||
760 | } | ||
761 | |||
762 | /** | ||
751 | * sas_end_device_alloc - allocate an rphy for an end device | 763 | * sas_end_device_alloc - allocate an rphy for an end device |
752 | * | 764 | * |
753 | * Allocates an SAS remote PHY structure, connected to @parent. | 765 | * Allocates an SAS remote PHY structure, connected to @parent. |
@@ -771,6 +783,7 @@ struct sas_rphy *sas_end_device_alloc(struct sas_phy *parent) | |||
771 | sprintf(rdev->rphy.dev.bus_id, "end_device-%d:%d-%d", | 783 | sprintf(rdev->rphy.dev.bus_id, "end_device-%d:%d-%d", |
772 | shost->host_no, parent->port_identifier, parent->number); | 784 | shost->host_no, parent->port_identifier, parent->number); |
773 | rdev->rphy.identify.device_type = SAS_END_DEVICE; | 785 | rdev->rphy.identify.device_type = SAS_END_DEVICE; |
786 | sas_rphy_initialize(&rdev->rphy); | ||
774 | transport_setup_device(&rdev->rphy.dev); | 787 | transport_setup_device(&rdev->rphy.dev); |
775 | 788 | ||
776 | return &rdev->rphy; | 789 | return &rdev->rphy; |
@@ -809,6 +822,7 @@ struct sas_rphy *sas_expander_alloc(struct sas_phy *parent, | |||
809 | sprintf(rdev->rphy.dev.bus_id, "expander-%d:%d", | 822 | sprintf(rdev->rphy.dev.bus_id, "expander-%d:%d", |
810 | shost->host_no, rdev->rphy.scsi_target_id); | 823 | shost->host_no, rdev->rphy.scsi_target_id); |
811 | rdev->rphy.identify.device_type = type; | 824 | rdev->rphy.identify.device_type = type; |
825 | sas_rphy_initialize(&rdev->rphy); | ||
812 | transport_setup_device(&rdev->rphy.dev); | 826 | transport_setup_device(&rdev->rphy.dev); |
813 | 827 | ||
814 | return &rdev->rphy; | 828 | return &rdev->rphy; |