summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/qla2xxx/qla_attr.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-10-25 20:22:55 -0700
committerLinus Torvalds <torvalds@g5.osdl.org>2006-10-25 20:22:55 -0700
commit71fa0a849b384f066dea6a2351c722c19846f4ac (patch)
treec6f9ac28003432ba79d0ea5eefd34ad412fb50ef /drivers/scsi/qla2xxx/qla_attr.c
parent9d81a782d55bdeec3bfa3106e514bf46ac12e172 (diff)
parentd6b9ccbbeb625674891f797119f06512d27fc905 (diff)
downloadop-kernel-dev-71fa0a849b384f066dea6a2351c722c19846f4ac.zip
op-kernel-dev-71fa0a849b384f066dea6a2351c722c19846f4ac.tar.gz
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6: (40 commits) [SCSI] aic79xx: Print out signalling [SCSI] aic7xxx: Remove slave_destroy [SCSI] aic79xx: set precompensation [SCSI] aic79xx: Fixup external device reset [SCSI] replace u8 and u32 with __u8 and __u32 in scsi.h for user space [SCSI] lpfc: fix printk format warning [SCSI] aic79xx: make ahd_set_tags() static [SCSI] aic7xxx: cleanups [SCSI] drivers/scsi: Handcrafted MIN/MAX macro removal [SCSI] scsi_debug: support REPORT TARGET PORT GROUPS [SCSI] qla1280 bus reset typo [SCSI] libiscsi: fix logout pdu processing [SCSI] libiscsi: fix aen support [SCSI] libiscsi: fix missed iscsi_task_put in xmit error path [SCSI] libiscsi: fix oops in connection create failure path [SCSI] iscsi class: fix slab corruption during restart [SCSI] Switch fdomain to the pci_get API [SCSI] add can_queue to host parameters [SCSI] megaraid_{mm,mbox}: 64-bit DMA capability fix [SCSI] aic94xx: Supermicro motherboards support ...
Diffstat (limited to 'drivers/scsi/qla2xxx/qla_attr.c')
-rw-r--r--drivers/scsi/qla2xxx/qla_attr.c51
1 files changed, 32 insertions, 19 deletions
diff --git a/drivers/scsi/qla2xxx/qla_attr.c b/drivers/scsi/qla2xxx/qla_attr.c
index ee75a71..285c8e8 100644
--- a/drivers/scsi/qla2xxx/qla_attr.c
+++ b/drivers/scsi/qla2xxx/qla_attr.c
@@ -379,21 +379,37 @@ static struct bin_attribute sysfs_sfp_attr = {
.read = qla2x00_sysfs_read_sfp,
};
+static struct sysfs_entry {
+ char *name;
+ struct bin_attribute *attr;
+ int is4GBp_only;
+} bin_file_entries[] = {
+ { "fw_dump", &sysfs_fw_dump_attr, },
+ { "nvram", &sysfs_nvram_attr, },
+ { "optrom", &sysfs_optrom_attr, },
+ { "optrom_ctl", &sysfs_optrom_ctl_attr, },
+ { "vpd", &sysfs_vpd_attr, 1 },
+ { "sfp", &sysfs_sfp_attr, 1 },
+ { 0 },
+};
+
void
qla2x00_alloc_sysfs_attr(scsi_qla_host_t *ha)
{
struct Scsi_Host *host = ha->host;
+ struct sysfs_entry *iter;
+ int ret;
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj,
- &sysfs_optrom_ctl_attr);
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- sysfs_create_bin_file(&host->shost_gendev.kobj,
- &sysfs_vpd_attr);
- sysfs_create_bin_file(&host->shost_gendev.kobj,
- &sysfs_sfp_attr);
+ for (iter = bin_file_entries; iter->name; iter++) {
+ if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
+ continue;
+
+ ret = sysfs_create_bin_file(&host->shost_gendev.kobj,
+ iter->attr);
+ if (ret)
+ qla_printk(KERN_INFO, ha,
+ "Unable to create sysfs %s binary attribute "
+ "(%d).\n", iter->name, ret);
}
}
@@ -401,17 +417,14 @@ void
qla2x00_free_sysfs_attr(scsi_qla_host_t *ha)
{
struct Scsi_Host *host = ha->host;
+ struct sysfs_entry *iter;
+
+ for (iter = bin_file_entries; iter->name; iter++) {
+ if (iter->is4GBp_only && (!IS_QLA24XX(ha) && !IS_QLA54XX(ha)))
+ continue;
- sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_fw_dump_attr);
- sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_nvram_attr);
- sysfs_remove_bin_file(&host->shost_gendev.kobj, &sysfs_optrom_attr);
- sysfs_remove_bin_file(&host->shost_gendev.kobj,
- &sysfs_optrom_ctl_attr);
- if (IS_QLA24XX(ha) || IS_QLA54XX(ha)) {
- sysfs_remove_bin_file(&host->shost_gendev.kobj,
- &sysfs_vpd_attr);
sysfs_remove_bin_file(&host->shost_gendev.kobj,
- &sysfs_sfp_attr);
+ iter->attr);
}
if (ha->beacon_blink_led == 1)
OpenPOWER on IntegriCloud