Commit 3a7bda830fad427768ed71c0ebf3448849c006b5
Committed by
James Bottomley
1 parent
4ac13e1779
Exists in
master
and in
6 other branches
[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>
Showing 2 changed files with 31 additions and 18 deletions Side-by-side Diff
Documentation/ABI/testing/sysfs-class-scsi_host
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. |
drivers/scsi/isci/init.c
... | ... | @@ -59,6 +59,7 @@ |
59 | 59 | #include <linux/firmware.h> |
60 | 60 | #include <linux/efi.h> |
61 | 61 | #include <asm/string.h> |
62 | +#include <scsi/scsi_host.h> | |
62 | 63 | #include "isci.h" |
63 | 64 | #include "task.h" |
64 | 65 | #include "probe_roms.h" |
... | ... | @@ -113,6 +114,22 @@ |
113 | 114 | module_param(max_concurr_spinup, byte, 0); |
114 | 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 | 133 | static struct scsi_host_template isci_sht = { |
117 | 134 | |
118 | 135 | .module = THIS_MODULE, |
... | ... | @@ -138,6 +155,7 @@ |
138 | 155 | .slave_alloc = sas_slave_alloc, |
139 | 156 | .target_destroy = sas_target_destroy, |
140 | 157 | .ioctl = sas_ioctl, |
158 | + .shost_attrs = isci_host_attrs, | |
141 | 159 | }; |
142 | 160 | |
143 | 161 | static struct sas_domain_function_template isci_transport_ops = { |
... | ... | @@ -232,17 +250,6 @@ |
232 | 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 | 253 | static void isci_unregister(struct isci_host *isci_host) |
247 | 254 | { |
248 | 255 | struct Scsi_Host *shost; |
... | ... | @@ -251,7 +258,6 @@ |
251 | 258 | return; |
252 | 259 | |
253 | 260 | shost = isci_host->shost; |
254 | - device_remove_file(&shost->shost_dev, &dev_attr_isci_id); | |
255 | 261 | |
256 | 262 | sas_unregister_ha(&isci_host->sas_ha); |
257 | 263 | |
258 | 264 | |
... | ... | @@ -415,14 +421,8 @@ |
415 | 421 | if (err) |
416 | 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 | 424 | return isci_host; |
423 | 425 | |
424 | - err_unregister_ha: | |
425 | - sas_unregister_ha(&(isci_host->sas_ha)); | |
426 | 426 | err_shost_remove: |
427 | 427 | scsi_remove_host(shost); |
428 | 428 | err_shost: |