Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 40323
b: refs/heads/master
c: f1663ad
h: refs/heads/master
i:
  40321: 011809d
  40319: 055b192
v: v3
  • Loading branch information
Andrew Vasquez authored and James Bottomley committed Oct 25, 2006
1 parent 4ee542b commit 8ee4709
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8d1a006049ff1c084d57fbea1106ecad3455bd27
refs/heads/master: f1663ad5dbb801e03c4c99c24d698ad5dba9aaff
51 changes: 32 additions & 19 deletions trunk/drivers/scsi/qla2xxx/qla_attr.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,39 +379,52 @@ 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);
}
}

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)
Expand Down

0 comments on commit 8ee4709

Please sign in to comment.