Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Dave Jiang and committed by
James Bottomley
3a7bda83 4ac13e17

+31 -18
+13
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.
+18 -18
drivers/scsi/isci/init.c
··· 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" ··· 114 113 module_param(max_concurr_spinup, byte, 0); 115 114 MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); 116 115 116 + static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) 117 + { 118 + struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); 119 + struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); 120 + struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); 121 + 122 + return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); 123 + } 124 + 125 + static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); 126 + 127 + struct device_attribute *isci_host_attrs[] = { 128 + &dev_attr_isci_id, 129 + NULL 130 + }; 131 + 117 132 static struct scsi_host_template isci_sht = { 118 133 119 134 .module = THIS_MODULE, ··· 155 138 .slave_alloc = sas_slave_alloc, 156 139 .target_destroy = sas_target_destroy, 157 140 .ioctl = sas_ioctl, 141 + .shost_attrs = isci_host_attrs, 158 142 }; 159 143 160 144 static struct sas_domain_function_template isci_transport_ops = { ··· 250 232 return 0; 251 233 } 252 234 253 - static ssize_t isci_show_id(struct device *dev, struct device_attribute *attr, char *buf) 254 - { 255 - struct Scsi_Host *shost = container_of(dev, typeof(*shost), shost_dev); 256 - struct sas_ha_struct *sas_ha = SHOST_TO_SAS_HA(shost); 257 - struct isci_host *ihost = container_of(sas_ha, typeof(*ihost), sas_ha); 258 - 259 - return snprintf(buf, PAGE_SIZE, "%d\n", ihost->id); 260 - } 261 - 262 - static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL); 263 - 264 235 static void isci_unregister(struct isci_host *isci_host) 265 236 { 266 237 struct Scsi_Host *shost; ··· 258 251 return; 259 252 260 253 shost = isci_host->shost; 261 - device_remove_file(&shost->shost_dev, &dev_attr_isci_id); 262 254 263 255 sas_unregister_ha(&isci_host->sas_ha); 264 256 ··· 421 415 if (err) 422 416 goto err_shost_remove; 423 417 424 - err = device_create_file(&shost->shost_dev, &dev_attr_isci_id); 425 - if (err) 426 - goto err_unregister_ha; 427 - 428 418 return isci_host; 429 419 430 - err_unregister_ha: 431 - sas_unregister_ha(&(isci_host->sas_ha)); 432 420 err_shost_remove: 433 421 scsi_remove_host(shost); 434 422 err_shost: