Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 93919
b: refs/heads/master
c: 352f6bb
h: refs/heads/master
i:
  93917: 93cfd58
  93915: 9892d68
  93911: 1635512
  93903: f1a74ba
  93887: 7b5dde5
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Apr 22, 2008
1 parent f9dcb62 commit d996bd7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 25 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: 0f4238958d28044b335644b69df6071cdb04b5ce
refs/heads/master: 352f6bb422bd31a80b4a0f1c3f19b6993df2508c
32 changes: 8 additions & 24 deletions trunk/drivers/scsi/scsi_transport_spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1374,11 +1374,11 @@ static int spi_host_configure(struct transport_container *tc,
* overloads the return by setting 1<<1 if the attribute should
* be writeable */
#define TARGET_ATTRIBUTE_HELPER(name) \
(si->f->show_##name ? 1 : 0) + \
(si->f->set_##name ? 2 : 0)
(si->f->show_##name ? S_IRUGO : 0) | \
(si->f->set_##name ? S_IWUSR : 0)

static int target_attribute_is_visible(struct kobject *kobj,
struct attribute *attr, int i)
static mode_t target_attribute_is_visible(struct kobject *kobj,
struct attribute *attr, int i)
{
struct device *cdev = container_of(kobj, struct device, kobj);
struct scsi_target *starget = transport_class_to_starget(cdev);
Expand Down Expand Up @@ -1428,7 +1428,7 @@ static int target_attribute_is_visible(struct kobject *kobj,
spi_support_ius(starget))
return TARGET_ATTRIBUTE_HELPER(hold_mcs);
else if (attr == &dev_attr_revalidate.attr)
return 1;
return S_IWUSR;

return 0;
}
Expand Down Expand Up @@ -1462,25 +1462,9 @@ static int spi_target_configure(struct transport_container *tc,
struct device *cdev)
{
struct kobject *kobj = &cdev->kobj;
int i;
struct attribute *attr;
int rc;

for (i = 0; (attr = target_attributes[i]) != NULL; i++) {
int j = target_attribute_group.is_visible(kobj, attr, i);

/* FIXME: as well as returning -EEXIST, which we'd like
* to ignore, sysfs also does a WARN_ON and dumps a trace,
* which is bad, so temporarily, skip attributes that are
* already visible (the revalidate one) */
if (j && attr != &dev_attr_revalidate.attr)
rc = sysfs_add_file_to_group(kobj, attr,
target_attribute_group.name);
/* and make the attribute writeable if we have a set
* function */
if ((j & 1))
rc = sysfs_chmod_file(kobj, attr, attr->mode | S_IWUSR);
}

/* force an update based on parameters read from the device */
sysfs_update_group(kobj, &target_attribute_group);

return 0;
}
Expand Down

0 comments on commit d996bd7

Please sign in to comment.