]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blobdiff - src/patches/suse-2.6.27.31/patches.arch/acpi-dock-add-type-sysfs-file-for-dock.patch
Reenabled linux-xen, added patches for Xen Kernel Version 2.6.27.31,
[people/pmueller/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.arch / acpi-dock-add-type-sysfs-file-for-dock.patch
diff --git a/src/patches/suse-2.6.27.31/patches.arch/acpi-dock-add-type-sysfs-file-for-dock.patch b/src/patches/suse-2.6.27.31/patches.arch/acpi-dock-add-type-sysfs-file-for-dock.patch
new file mode 100644 (file)
index 0000000..a450cb5
--- /dev/null
@@ -0,0 +1,70 @@
+From: Shaohua Li <shaohua.li@intel.com>
+Subject: add 'type' sysfs file for dock
+Patch-mainline: submitted 2008-08-28
+References: fate#304731,bnc#401740
+
+add a sysfs file to present dock type. Suggested by Holger.
+
+Signed-off-by: Shaohua Li <shaohua.li@intel.com>
+Signed-off-by: Holger Macht <hmacht@suse.de>
+---
+
+---
+ drivers/acpi/dock.c |   25 +++++++++++++++++++++++++
+ 1 file changed, 25 insertions(+)
+
+--- a/drivers/acpi/dock.c
++++ b/drivers/acpi/dock.c
+@@ -909,6 +909,26 @@ static ssize_t show_dock_uid(struct devi
+ }
+ static DEVICE_ATTR(uid, S_IRUGO, show_dock_uid, NULL);
++static ssize_t show_dock_type(struct device *dev,
++              struct device_attribute *attr, char *buf)
++{
++      struct dock_station *dock_station = *((struct dock_station **)
++              dev->platform_data);
++      char *type;
++
++      if (dock_station->flags & DOCK_IS_DOCK)
++              type = "dock_station";
++      else if (dock_station->flags & DOCK_IS_ATA)
++              type = "ata_bay";
++      else if (dock_station->flags & DOCK_IS_BAT)
++              type = "battery_bay";
++      else
++              type = "unknown";
++
++      return snprintf(buf, PAGE_SIZE, "%s\n", type);
++}
++static DEVICE_ATTR(type, S_IRUGO, show_dock_type, NULL);
++
+ /**
+  * dock_add - add a new dock station
+  * @handle: the dock station handle
+@@ -997,6 +1017,9 @@ static int dock_add(acpi_handle handle)
+               dock_station = NULL;
+               return ret;
+       }
++      ret = device_create_file(&dock_device->dev, &dev_attr_type);
++      if (ret)
++              printk(KERN_ERR"Error %d adding sysfs file\n", ret);
+       /* Find dependent devices */
+       acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+@@ -1018,6 +1041,7 @@ static int dock_add(acpi_handle handle)
+       return 0;
+ dock_add_err_unregister:
++      device_remove_file(&dock_device->dev, &dev_attr_type);
+       device_remove_file(&dock_device->dev, &dev_attr_docked);
+       device_remove_file(&dock_device->dev, &dev_attr_undock);
+       device_remove_file(&dock_device->dev, &dev_attr_uid);
+@@ -1045,6 +1069,7 @@ static int dock_remove(struct dock_stati
+           kfree(dd);
+       /* cleanup sysfs */
++      device_remove_file(&dock_device->dev, &dev_attr_type);
+       device_remove_file(&dock_device->dev, &dev_attr_docked);
+       device_remove_file(&dock_device->dev, &dev_attr_undock);
+       device_remove_file(&dock_device->dev, &dev_attr_uid);