Commit 048961ef authored by Kristian Høgsberg's avatar Kristian Høgsberg Committed by Stefan Richter

firewire: Add rom_index attribute for unit sysfs directories.

Signed-off-by: default avatarKristian Høgsberg <krh@redhat.com>
Signed-off-by: default avatarStefan Richter <stefanr@s5r6.in-berlin.de>
parent 5c5539d8
...@@ -230,6 +230,22 @@ static struct device_attribute config_rom_attribute = { ...@@ -230,6 +230,22 @@ static struct device_attribute config_rom_attribute = {
.show = show_config_rom_attribute, .show = show_config_rom_attribute,
}; };
static ssize_t
show_rom_index_attribute(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct fw_device *device = fw_device(dev->parent);
struct fw_unit *unit = fw_unit(dev);
return snprintf(buf, PAGE_SIZE, "%d\n",
unit->directory - device->config_rom);
}
static struct device_attribute rom_index_attribute = {
.attr = { .name = "rom_index", .mode = S_IRUGO, },
.show = show_rom_index_attribute,
};
struct read_quadlet_callback_data { struct read_quadlet_callback_data {
struct completion done; struct completion done;
int rcode; int rcode;
...@@ -393,6 +409,11 @@ static void create_units(struct fw_device *device) ...@@ -393,6 +409,11 @@ static void create_units(struct fw_device *device)
device_unregister(&unit->device); device_unregister(&unit->device);
kfree(unit); kfree(unit);
} }
if (device_create_file(&unit->device, &rom_index_attribute) < 0) {
device_unregister(&unit->device);
kfree(unit);
}
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment