diff options
author | Kristian Høgsberg <krh@redhat.com> | 2007-03-07 12:12:46 -0500 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-03-09 16:03:10 -0500 |
commit | 048961ef90b584d00ec79c75cb7c7b28403f0c87 (patch) | |
tree | 4a89a4c77bbc21e90e0a4dfabd017562c90ad3e0 /drivers/firewire/fw-device.c | |
parent | 5c5539d8cdfd13fdb080357fe79f94a7e11a6ef6 (diff) |
firewire: Add rom_index attribute for unit sysfs directories.
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-device.c')
-rw-r--r-- | drivers/firewire/fw-device.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/firewire/fw-device.c b/drivers/firewire/fw-device.c index b24090ae9c70..4ade867db888 100644 --- a/drivers/firewire/fw-device.c +++ b/drivers/firewire/fw-device.c | |||
@@ -230,6 +230,22 @@ static struct device_attribute config_rom_attribute = { | |||
230 | .show = show_config_rom_attribute, | 230 | .show = show_config_rom_attribute, |
231 | }; | 231 | }; |
232 | 232 | ||
233 | static ssize_t | ||
234 | show_rom_index_attribute(struct device *dev, | ||
235 | struct device_attribute *attr, char *buf) | ||
236 | { | ||
237 | struct fw_device *device = fw_device(dev->parent); | ||
238 | struct fw_unit *unit = fw_unit(dev); | ||
239 | |||
240 | return snprintf(buf, PAGE_SIZE, "%d\n", | ||
241 | unit->directory - device->config_rom); | ||
242 | } | ||
243 | |||
244 | static struct device_attribute rom_index_attribute = { | ||
245 | .attr = { .name = "rom_index", .mode = S_IRUGO, }, | ||
246 | .show = show_rom_index_attribute, | ||
247 | }; | ||
248 | |||
233 | struct read_quadlet_callback_data { | 249 | struct read_quadlet_callback_data { |
234 | struct completion done; | 250 | struct completion done; |
235 | int rcode; | 251 | int rcode; |
@@ -393,6 +409,11 @@ static void create_units(struct fw_device *device) | |||
393 | device_unregister(&unit->device); | 409 | device_unregister(&unit->device); |
394 | kfree(unit); | 410 | kfree(unit); |
395 | } | 411 | } |
412 | |||
413 | if (device_create_file(&unit->device, &rom_index_attribute) < 0) { | ||
414 | device_unregister(&unit->device); | ||
415 | kfree(unit); | ||
416 | } | ||
396 | } | 417 | } |
397 | } | 418 | } |
398 | 419 | ||