diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-10-09 21:47:31 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-09 23:56:13 -0400 |
commit | 10270613fb4d5a44c335cfa13e9626bf5743c01d (patch) | |
tree | 6852db04a76e5a13c295f906c6f9acc88837a372 /drivers/macintosh/windfarm_pm81.c | |
parent | 9f2545c11869868fd3cde7098d99e690891e442c (diff) |
[POWERPC] Fix windfarm platform device usage
The windfarm code uses a struct device_driver instead of
platform_driver, which can cause crashes if any of the callbacks are
called (like on module removal). This fixes it.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'drivers/macintosh/windfarm_pm81.c')
-rw-r--r-- | drivers/macintosh/windfarm_pm81.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/macintosh/windfarm_pm81.c b/drivers/macintosh/windfarm_pm81.c index 2ff546e4c92f..2a944851b8e1 100644 --- a/drivers/macintosh/windfarm_pm81.c +++ b/drivers/macintosh/windfarm_pm81.c | |||
@@ -131,8 +131,6 @@ | |||
131 | 131 | ||
132 | static int wf_smu_mach_model; /* machine model id */ | 132 | static int wf_smu_mach_model; /* machine model id */ |
133 | 133 | ||
134 | static struct device *wf_smu_dev; | ||
135 | |||
136 | /* Controls & sensors */ | 134 | /* Controls & sensors */ |
137 | static struct wf_sensor *sensor_cpu_power; | 135 | static struct wf_sensor *sensor_cpu_power; |
138 | static struct wf_sensor *sensor_cpu_temp; | 136 | static struct wf_sensor *sensor_cpu_temp; |
@@ -717,16 +715,14 @@ static int wf_init_pm(void) | |||
717 | return 0; | 715 | return 0; |
718 | } | 716 | } |
719 | 717 | ||
720 | static int wf_smu_probe(struct device *ddev) | 718 | static int wf_smu_probe(struct platform_device *ddev) |
721 | { | 719 | { |
722 | wf_smu_dev = ddev; | ||
723 | |||
724 | wf_register_client(&wf_smu_events); | 720 | wf_register_client(&wf_smu_events); |
725 | 721 | ||
726 | return 0; | 722 | return 0; |
727 | } | 723 | } |
728 | 724 | ||
729 | static int wf_smu_remove(struct device *ddev) | 725 | static int __devexit wf_smu_remove(struct platform_device *ddev) |
730 | { | 726 | { |
731 | wf_unregister_client(&wf_smu_events); | 727 | wf_unregister_client(&wf_smu_events); |
732 | 728 | ||
@@ -766,16 +762,16 @@ static int wf_smu_remove(struct device *ddev) | |||
766 | if (wf_smu_cpu_fans) | 762 | if (wf_smu_cpu_fans) |
767 | kfree(wf_smu_cpu_fans); | 763 | kfree(wf_smu_cpu_fans); |
768 | 764 | ||
769 | wf_smu_dev = NULL; | ||
770 | |||
771 | return 0; | 765 | return 0; |
772 | } | 766 | } |
773 | 767 | ||
774 | static struct device_driver wf_smu_driver = { | 768 | static struct platform_driver wf_smu_driver = { |
775 | .name = "windfarm", | ||
776 | .bus = &platform_bus_type, | ||
777 | .probe = wf_smu_probe, | 769 | .probe = wf_smu_probe, |
778 | .remove = wf_smu_remove, | 770 | .remove = __devexit_p(wf_smu_remove), |
771 | .driver = { | ||
772 | .name = "windfarm", | ||
773 | .bus = &platform_bus_type, | ||
774 | }, | ||
779 | }; | 775 | }; |
780 | 776 | ||
781 | 777 | ||
@@ -794,7 +790,7 @@ static int __init wf_smu_init(void) | |||
794 | request_module("windfarm_lm75_sensor"); | 790 | request_module("windfarm_lm75_sensor"); |
795 | 791 | ||
796 | #endif /* MODULE */ | 792 | #endif /* MODULE */ |
797 | driver_register(&wf_smu_driver); | 793 | platform_driver_register(&wf_smu_driver); |
798 | } | 794 | } |
799 | 795 | ||
800 | return rc; | 796 | return rc; |
@@ -803,7 +799,7 @@ static int __init wf_smu_init(void) | |||
803 | static void __exit wf_smu_exit(void) | 799 | static void __exit wf_smu_exit(void) |
804 | { | 800 | { |
805 | 801 | ||
806 | driver_unregister(&wf_smu_driver); | 802 | platform_driver_unregister(&wf_smu_driver); |
807 | } | 803 | } |
808 | 804 | ||
809 | 805 | ||