aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorDave Jiang <dave.jiang@intel.com>2011-07-29 20:17:00 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-08-23 22:54:24 -0400
commit3a7bda830fad427768ed71c0ebf3448849c006b5 (patch)
tree601d8c165a70e5bb33bac239b03dd296222bfcdf /drivers
parent4ac13e177904280a2502c27029a72e3fd2957cde (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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/isci/init.c36
1 files changed, 18 insertions, 18 deletions
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;
113module_param(max_concurr_spinup, byte, 0); 114module_param(max_concurr_spinup, byte, 0);
114MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup"); 115MODULE_PARM_DESC(max_concurr_spinup, "Max concurrent device spinup");
115 116
117static 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
126static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
127
128struct device_attribute *isci_host_attrs[] = {
129 &dev_attr_isci_id,
130 NULL
131};
132
116static struct scsi_host_template isci_sht = { 133static 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
143static struct sas_domain_function_template isci_transport_ops = { 161static 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
235static 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
244static DEVICE_ATTR(isci_id, S_IRUGO, isci_show_id, NULL);
245
246static void isci_unregister(struct isci_host *isci_host) 253static 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: