aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_pm81.c
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2006-10-09 21:47:31 -0400
committerPaul Mackerras <paulus@samba.org>2006-10-09 23:56:13 -0400
commit10270613fb4d5a44c335cfa13e9626bf5743c01d (patch)
tree6852db04a76e5a13c295f906c6f9acc88837a372 /drivers/macintosh/windfarm_pm81.c
parent9f2545c11869868fd3cde7098d99e690891e442c (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.c24
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
132static int wf_smu_mach_model; /* machine model id */ 132static int wf_smu_mach_model; /* machine model id */
133 133
134static struct device *wf_smu_dev;
135
136/* Controls & sensors */ 134/* Controls & sensors */
137static struct wf_sensor *sensor_cpu_power; 135static struct wf_sensor *sensor_cpu_power;
138static struct wf_sensor *sensor_cpu_temp; 136static 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
720static int wf_smu_probe(struct device *ddev) 718static 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
729static int wf_smu_remove(struct device *ddev) 725static 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
774static struct device_driver wf_smu_driver = { 768static 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)
803static void __exit wf_smu_exit(void) 799static 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