firewire: Export GUID as sysfs attribute.
authorKristian Høgsberg <krh@redhat.com>
Wed, 21 Mar 2007 00:58:35 +0000 (20:58 -0400)
committerStefan Richter <stefanr@s5r6.in-berlin.de>
Wed, 21 Mar 2007 23:48:50 +0000 (00:48 +0100)
Signed-off-by: Kristian Høgsberg <krh@redhat.com>
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
drivers/firewire/fw-device.c

index 71bb9d1e8196720a1bce83dee9010fb5137c07a1..2bf86aa1c9bc71286457d959c802a24c62e83c63 100644 (file)
@@ -348,8 +348,7 @@ static struct device_attribute fw_unit_attributes[] = {
 };
 
 static ssize_t
-config_rom_show(struct device *dev,
-               struct device_attribute *attr, char *buf)
+config_rom_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct fw_device *device = fw_device(dev);
 
@@ -358,8 +357,20 @@ config_rom_show(struct device *dev,
        return device->config_rom_length * 4;
 }
 
+static ssize_t
+guid_show(struct device *dev, struct device_attribute *attr, char *buf)
+{
+       struct fw_device *device = fw_device(dev);
+       u64 guid;
+
+       guid = ((u64)device->config_rom[3] << 32) | device->config_rom[4];
+
+       return snprintf(buf, PAGE_SIZE, "0x%016llx\n", guid);
+}
+
 static struct device_attribute fw_device_attributes[] = {
        __ATTR_RO(config_rom),
+       __ATTR_RO(guid),
        __ATTR_NULL,
 };