aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorKristen Carlson Accardi <kristen.c.accardi@intel.com>2006-12-04 17:49:43 -0500
committerLen Brown <len.brown@intel.com>2006-12-07 04:11:58 -0500
commit671adbec210efc15cef81b4616adae8bcd667296 (patch)
tree7f7b7999b3787b5cb17a292a5f924adc3d051bcc /drivers/acpi
parentec0bf39a471bf6fcd01def2bd677128cea940b73 (diff)
ACPI: dock: Make the dock station driver a platform device driver.
Make the dock station driver a platform device driver so that we can create sysfs entries under /sys/device/platform. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/dock.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index bf5b79ed3613..336d94cdf2a0 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -27,6 +27,7 @@
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/types.h> 28#include <linux/types.h>
29#include <linux/notifier.h> 29#include <linux/notifier.h>
30#include <linux/platform_device.h>
30#include <linux/jiffies.h> 31#include <linux/jiffies.h>
31#include <acpi/acpi_bus.h> 32#include <acpi/acpi_bus.h>
32#include <acpi/acpi_drivers.h> 33#include <acpi/acpi_drivers.h>
@@ -39,6 +40,8 @@ MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_NAME);
39MODULE_LICENSE("GPL"); 40MODULE_LICENSE("GPL");
40 41
41static struct atomic_notifier_head dock_notifier_list; 42static struct atomic_notifier_head dock_notifier_list;
43static struct platform_device dock_device;
44static char dock_device_name[] = "dock";
42 45
43struct dock_station { 46struct dock_station {
44 acpi_handle handle; 47 acpi_handle handle;
@@ -629,6 +632,15 @@ static int dock_add(acpi_handle handle)
629 spin_lock_init(&dock_station->hp_lock); 632 spin_lock_init(&dock_station->hp_lock);
630 ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); 633 ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list);
631 634
635 /* initialize platform device stuff */
636 dock_device.name = dock_device_name;
637 ret = platform_device_register(&dock_device);
638 if (ret) {
639 printk(KERN_ERR PREFIX "Error registering dock device\n", ret);
640 kfree(dock_station);
641 return ret;
642 }
643
632 /* Find dependent devices */ 644 /* Find dependent devices */
633 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 645 acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
634 ACPI_UINT32_MAX, find_dock_devices, dock_station, 646 ACPI_UINT32_MAX, find_dock_devices, dock_station,
@@ -638,7 +650,8 @@ static int dock_add(acpi_handle handle)
638 dd = alloc_dock_dependent_device(handle); 650 dd = alloc_dock_dependent_device(handle);
639 if (!dd) { 651 if (!dd) {
640 kfree(dock_station); 652 kfree(dock_station);
641 return -ENOMEM; 653 ret = -ENOMEM;
654 goto dock_add_err_unregister;
642 } 655 }
643 add_dock_dependent_device(dock_station, dd); 656 add_dock_dependent_device(dock_station, dd);
644 657
@@ -658,8 +671,10 @@ static int dock_add(acpi_handle handle)
658 return 0; 671 return 0;
659 672
660dock_add_err: 673dock_add_err:
661 kfree(dock_station);
662 kfree(dd); 674 kfree(dd);
675dock_add_err_unregister:
676 platform_device_unregister(&dock_device);
677 kfree(dock_station);
663 return ret; 678 return ret;
664} 679}
665 680
@@ -686,6 +701,9 @@ static int dock_remove(void)
686 if (ACPI_FAILURE(status)) 701 if (ACPI_FAILURE(status))
687 printk(KERN_ERR "Error removing notify handler\n"); 702 printk(KERN_ERR "Error removing notify handler\n");
688 703
704 /* cleanup sysfs */
705 platform_device_unregister(&dock_device);
706
689 /* free dock station memory */ 707 /* free dock station memory */
690 kfree(dock_station); 708 kfree(dock_station);
691 return 0; 709 return 0;