Skip to content

Commit

Permalink
firewire: core: add is_local sysfs device attribute
Browse files Browse the repository at this point in the history
Making this information available in sysfs allows to differentiate
between controllers in the local and remote Linux PCs, and thus is
useful for servers that are started with udev rules.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
  • Loading branch information
Clemens Ladisch authored and Stefan Richter committed Jun 30, 2012
1 parent e18907c commit baedee1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,14 @@ static ssize_t guid_show(struct device *dev,
return ret;
}

static ssize_t is_local_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct fw_device *device = fw_device(dev);

return sprintf(buf, "%u\n", device->is_local);
}

static int units_sprintf(char *buf, const u32 *directory)
{
struct fw_csr_iterator ci;
Expand Down Expand Up @@ -447,6 +455,7 @@ static ssize_t units_show(struct device *dev,
static struct device_attribute fw_device_attributes[] = {
__ATTR_RO(config_rom),
__ATTR_RO(guid),
__ATTR_RO(is_local),
__ATTR_RO(units),
__ATTR_NULL,
};
Expand Down
2 changes: 1 addition & 1 deletion include/linux/firewire.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ struct fw_card {
struct fw_attribute_group {
struct attribute_group *groups[2];
struct attribute_group group;
struct attribute *attrs[12];
struct attribute *attrs[13];
};

enum fw_device_state {
Expand Down

0 comments on commit baedee1

Please sign in to comment.