diff options
author | Dave Jiang <dave.jiang@intel.com> | 2011-07-29 20:17:00 -0400 |
---|---|---|
committer | James Bottomley <JBottomley@Parallels.com> | 2011-08-23 22:54:24 -0400 |
commit | 3a7bda830fad427768ed71c0ebf3448849c006b5 (patch) | |
tree | 601d8c165a70e5bb33bac239b03dd296222bfcdf | |
parent | 4ac13e177904280a2502c27029a72e3fd2957cde (diff) |
[SCSI] isci: Adding documentation to API change and fixup sysfs registration
Adding API update for adding isci_id entry scsi_host sysfs entry.
Also fixing up the sysfs registration to the scsi_host template
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
-rw-r--r-- | Documentation/ABI/testing/sysfs-class-scsi_host | 13 | ||||
-rw-r--r-- | drivers/scsi/isci/init.c | 36 |
2 files changed, 31 insertions, 18 deletions
diff --git a/Documentation/ABI/testing/sysfs-class-scsi_host b/Documentation/ABI/testing/sysfs-class-scsi_host new file mode 100644 index 000000000000..29a4f892e433 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-class-scsi_host | |||
@@ -0,0 +1,13 @@ | |||
1 | What: /sys/class/scsi_host/hostX/isci_id | ||
2 | Date: June 2011 | ||
3 | Contact: Dave Jiang <dave.jiang@intel.com> | ||
4 | Description: | ||
5 | This file contains the enumerated host ID for the Intel | ||
6 | SCU controller. The Intel(R) C600 Series Chipset SATA/SAS | ||
7 | Storage Control Unit embeds up to two 4-port controllers in | ||
8 | a single PCI device. The controllers are enumerated in order | ||
9 | which usually means the lowest number scsi_host corresponds | ||
10 | with the first controller, but this association is not | ||
11 | guaranteed. The 'isci_id' attribute unambiguously identifies | ||
12 | the controller index: '0' for the first controller, | ||
13 | '1' for the second. | ||
diff --git a/drivers/scsi/isci/init.c b/drivers/scsi/isci/init.c index 61e0d09e2b57..e78320bbec4f 100644 --- a/drivers/scsi/isci/init.c +++ b/drivers/scsi/isci/init.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <linux/firmware.h> | 59 | #include <linux/firmware.h> |
60 | #include <linux/efi.h> | 60 | #include <linux/efi.h> |
61 | #include <asm/string.h> | 61 | #include <asm/string.h> |
62 | #include <scsi/scsi_host.h> | ||
62 | #include "isci.h" | 63 | #include "isci.h" |
63 | #include "task.h" | 64 | #include "task.h" |
64 | #include "probe_roms.h" | 65 | #include "probe_roms.h" |
@@ -113,6 +114,22 @@ unsigned char max_concurr_spinup = 1; | |||
113 | module_param(max_concurr_spinup, byte, 0); | 114 | module_param(max_concurr_spinup, byte, 0); |
114 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); | 115 | MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); |
115 | 116 | ||
117 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
118 | { | ||
119 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
120 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
121 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
122 | |||
123 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
124 | } | ||
125 | |||
126 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
127 | |||
128 | struct device_attribute *isci_host_attrs[] = { | ||
129 | &dev_attr_isci_id, | ||
130 | NULL | ||
131 | }; | ||
132 | |||
116 | static struct scsi_host_template isci_sht = { | 133 | static struct scsi_host_template isci_sht = { |
117 | 134 | ||
118 | .module = THIS_MODULE, | 135 | .module = THIS_MODULE, |
@@ -138,6 +155,7 @@ static struct scsi_host_template isci_sht = { | |||
138 | .slave_alloc = sas_slave_alloc, | 155 | .slave_alloc = sas_slave_alloc, |
139 | .target_destroy = sas_target_destroy, | 156 | .target_destroy = sas_target_destroy, |
140 | .ioctl = sas_ioctl, | 157 | .ioctl = sas_ioctl, |
158 | .shost_attrs = isci_host_attrs, | ||
141 | }; | 159 | }; |
142 | 160 | ||
143 | static struct sas_domain_function_template isci_transport_ops = { | 161 | static struct sas_domain_function_template isci_transport_ops = { |
@@ -232,17 +250,6 @@ static int isci_register_sas_ha(struct isci_host *isci_host) | |||
232 | return 0; | 250 | return 0; |
233 | } | 251 | } |
234 | 252 | ||
235 | static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) | ||
236 | { | ||
237 | struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); | ||
238 | struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); | ||
239 | struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); | ||
240 | |||
241 | return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); | ||
242 | } | ||
243 | |||
244 | static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); | ||
245 | |||
246 | static void isci_unregister(struct isci_host *isci_host) | 253 | static void isci_unregister(struct isci_host *isci_host) |
247 | { | 254 | { |
248 | struct Scsi_Host *shost; | 255 | struct Scsi_Host *shost; |
@@ -251,7 +258,6 @@ static void isci_unregister(struct isci_host *isci_host) | |||
251 | return; | 258 | return; |
252 | 259 | ||
253 | shost = isci_host->shost; | 260 | shost = isci_host->shost; |
254 | device_remove_file(&shost->shost_dev, &dev_attr_isci_id); | ||
255 | 261 | ||
256 | sas_unregister_ha(&isci_host->sas_ha); | 262 | sas_unregister_ha(&isci_host->sas_ha); |
257 | 263 | ||
@@ -415,14 +421,8 @@ static struct isci_host *isci_host_alloc(struct pci_dev *pdev, int id) | |||
415 | if (err) | 421 | if (err) |
416 | goto err_shost_remove; | 422 | goto err_shost_remove; |
417 | 423 | ||
418 | err = device_create_file(&shost->shost_dev, &dev_attr_isci_id); | ||
419 | if (err) | ||
420 | goto err_unregister_ha; | ||
421 | |||
422 | return isci_host; | 424 | return isci_host; |
423 | 425 | ||
424 | err_unregister_ha: | ||
425 | sas_unregister_ha(&(isci_host->sas_ha)); | ||
426 | err_shost_remove: | 426 | err_shost_remove: |
427 | scsi_remove_host(shost); | 427 | scsi_remove_host(shost); |
428 | err_shost: | 428 | err_shost: |