diff options
Diffstat (limited to 'drivers/acpi/dock.c')
-rw-r--r-- | drivers/acpi/dock.c | 47 |
1 files changed, 23 insertions, 24 deletions
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index f66f4f7767ac..b5addd411b55 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c | |||
@@ -41,7 +41,7 @@ MODULE_DESCRIPTION(ACPI_DOCK_DRIVER_DESCRIPTION); | |||
41 | MODULE_LICENSE("GPL"); | 41 | MODULE_LICENSE("GPL"); |
42 | 42 | ||
43 | static struct atomic_notifier_head dock_notifier_list; | 43 | static struct atomic_notifier_head dock_notifier_list; |
44 | static struct platform_device dock_device; | 44 | static struct platform_device *dock_device; |
45 | static char dock_device_name[] = "dock"; | 45 | static char dock_device_name[] = "dock"; |
46 | 46 | ||
47 | struct dock_station { | 47 | struct dock_station { |
@@ -327,7 +327,7 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event) | |||
327 | 327 | ||
328 | static void dock_event(struct dock_station *ds, u32 event, int num) | 328 | static void dock_event(struct dock_station *ds, u32 event, int num) |
329 | { | 329 | { |
330 | struct device *dev = &dock_device.dev; | 330 | struct device *dev = &dock_device->dev; |
331 | /* | 331 | /* |
332 | * Indicate that the status of the dock station has | 332 | * Indicate that the status of the dock station has |
333 | * changed. | 333 | * changed. |
@@ -710,37 +710,36 @@ static int dock_add(acpi_handle handle) | |||
710 | ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); | 710 | ATOMIC_INIT_NOTIFIER_HEAD(&dock_notifier_list); |
711 | 711 | ||
712 | /* initialize platform device stuff */ | 712 | /* initialize platform device stuff */ |
713 | dock_device.name = dock_device_name; | 713 | dock_device = |
714 | ret = platform_device_register(&dock_device); | 714 | platform_device_register_simple(dock_device_name, 0, NULL, 0); |
715 | if (ret) { | 715 | if (IS_ERR(dock_device)) { |
716 | printk(KERN_ERR PREFIX "Error %d registering dock device\n", ret); | ||
717 | kfree(dock_station); | 716 | kfree(dock_station); |
718 | dock_station = NULL; | 717 | dock_station = NULL; |
719 | return ret; | 718 | return PTR_ERR(dock_device); |
720 | } | 719 | } |
721 | ret = device_create_file(&dock_device.dev, &dev_attr_docked); | 720 | ret = device_create_file(&dock_device->dev, &dev_attr_docked); |
722 | if (ret) { | 721 | if (ret) { |
723 | printk("Error %d adding sysfs file\n", ret); | 722 | printk("Error %d adding sysfs file\n", ret); |
724 | platform_device_unregister(&dock_device); | 723 | platform_device_unregister(dock_device); |
725 | kfree(dock_station); | 724 | kfree(dock_station); |
726 | dock_station = NULL; | 725 | dock_station = NULL; |
727 | return ret; | 726 | return ret; |
728 | } | 727 | } |
729 | ret = device_create_file(&dock_device.dev, &dev_attr_undock); | 728 | ret = device_create_file(&dock_device->dev, &dev_attr_undock); |
730 | if (ret) { | 729 | if (ret) { |
731 | printk("Error %d adding sysfs file\n", ret); | 730 | printk("Error %d adding sysfs file\n", ret); |
732 | device_remove_file(&dock_device.dev, &dev_attr_docked); | 731 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
733 | platform_device_unregister(&dock_device); | 732 | platform_device_unregister(dock_device); |
734 | kfree(dock_station); | 733 | kfree(dock_station); |
735 | dock_station = NULL; | 734 | dock_station = NULL; |
736 | return ret; | 735 | return ret; |
737 | } | 736 | } |
738 | ret = device_create_file(&dock_device.dev, &dev_attr_uid); | 737 | ret = device_create_file(&dock_device->dev, &dev_attr_uid); |
739 | if (ret) { | 738 | if (ret) { |
740 | printk("Error %d adding sysfs file\n", ret); | 739 | printk("Error %d adding sysfs file\n", ret); |
741 | device_remove_file(&dock_device.dev, &dev_attr_docked); | 740 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
742 | device_remove_file(&dock_device.dev, &dev_attr_undock); | 741 | device_remove_file(&dock_device->dev, &dev_attr_undock); |
743 | platform_device_unregister(&dock_device); | 742 | platform_device_unregister(dock_device); |
744 | kfree(dock_station); | 743 | kfree(dock_station); |
745 | dock_station = NULL; | 744 | dock_station = NULL; |
746 | return ret; | 745 | return ret; |
@@ -779,10 +778,10 @@ static int dock_add(acpi_handle handle) | |||
779 | dock_add_err: | 778 | dock_add_err: |
780 | kfree(dd); | 779 | kfree(dd); |
781 | dock_add_err_unregister: | 780 | dock_add_err_unregister: |
782 | device_remove_file(&dock_device.dev, &dev_attr_docked); | 781 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
783 | device_remove_file(&dock_device.dev, &dev_attr_undock); | 782 | device_remove_file(&dock_device->dev, &dev_attr_undock); |
784 | device_remove_file(&dock_device.dev, &dev_attr_uid); | 783 | device_remove_file(&dock_device->dev, &dev_attr_uid); |
785 | platform_device_unregister(&dock_device); | 784 | platform_device_unregister(dock_device); |
786 | kfree(dock_station); | 785 | kfree(dock_station); |
787 | dock_station = NULL; | 786 | dock_station = NULL; |
788 | return ret; | 787 | return ret; |
@@ -812,10 +811,10 @@ static int dock_remove(void) | |||
812 | printk(KERN_ERR "Error removing notify handler\n"); | 811 | printk(KERN_ERR "Error removing notify handler\n"); |
813 | 812 | ||
814 | /* cleanup sysfs */ | 813 | /* cleanup sysfs */ |
815 | device_remove_file(&dock_device.dev, &dev_attr_docked); | 814 | device_remove_file(&dock_device->dev, &dev_attr_docked); |
816 | device_remove_file(&dock_device.dev, &dev_attr_undock); | 815 | device_remove_file(&dock_device->dev, &dev_attr_undock); |
817 | device_remove_file(&dock_device.dev, &dev_attr_uid); | 816 | device_remove_file(&dock_device->dev, &dev_attr_uid); |
818 | platform_device_unregister(&dock_device); | 817 | platform_device_unregister(dock_device); |
819 | 818 | ||
820 | /* free dock station memory */ | 819 | /* free dock station memory */ |
821 | kfree(dock_station); | 820 | kfree(dock_station); |