Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=048961ef90b584d00ec79c75cb7c7b28403f0c87
Commit:     048961ef90b584d00ec79c75cb7c7b28403f0c87
Parent:     5c5539d8cdfd13fdb080357fe79f94a7e11a6ef6
Author:     Kristian Høgsberg <[EMAIL PROTECTED]>
AuthorDate: Wed Mar 7 12:12:46 2007 -0500
Committer:  Stefan Richter <[EMAIL PROTECTED]>
CommitDate: Fri Mar 9 22:03:10 2007 +0100

    firewire: Add rom_index attribute for unit sysfs directories.
    
    Signed-off-by: Kristian Høgsberg <[EMAIL PROTECTED]>
    Signed-off-by: Stefan Richter <[EMAIL PROTECTED]>
---
 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 b24090a..4ade867 100644
--- a/drivers/firewire/fw-device.c
+++ b/drivers/firewire/fw-device.c
@@ -230,6 +230,22 @@ static struct device_attribute 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 completion done;
        int rcode;
@@ -393,6 +409,11 @@ static void create_units(struct fw_device *device)
                        device_unregister(&unit->device);
                        kfree(unit);
                }
+
+               if (device_create_file(&unit->device, &rom_index_attribute) < 
0) {
+                       device_unregister(&unit->device);
+                       kfree(unit);
+               }
        }
 }
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to