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_pm91.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_pm91.c')
-rw-r--r-- | drivers/macintosh/windfarm_pm91.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/drivers/macintosh/windfarm_pm91.c b/drivers/macintosh/windfarm_pm91.c index 59e9ffe37c39..9961a67b4f85 100644 --- a/drivers/macintosh/windfarm_pm91.c +++ b/drivers/macintosh/windfarm_pm91.c | |||
@@ -63,8 +63,6 @@ | |||
63 | */ | 63 | */ |
64 | #undef HACKED_OVERTEMP | 64 | #undef HACKED_OVERTEMP |
65 | 65 | ||
66 | static struct device *wf_smu_dev; | ||
67 | |||
68 | /* Controls & sensors */ | 66 | /* Controls & sensors */ |
69 | static struct wf_sensor *sensor_cpu_power; | 67 | static struct wf_sensor *sensor_cpu_power; |
70 | static struct wf_sensor *sensor_cpu_temp; | 68 | static struct wf_sensor *sensor_cpu_temp; |
@@ -641,16 +639,14 @@ static int wf_init_pm(void) | |||
641 | return 0; | 639 | return 0; |
642 | } | 640 | } |
643 | 641 | ||
644 | static int wf_smu_probe(struct device *ddev) | 642 | static int wf_smu_probe(struct platform_device *ddev) |
645 | { | 643 | { |
646 | wf_smu_dev = ddev; | ||
647 | |||
648 | wf_register_client(&wf_smu_events); | 644 | wf_register_client(&wf_smu_events); |
649 | 645 | ||
650 | return 0; | 646 | return 0; |
651 | } | 647 | } |
652 | 648 | ||
653 | static int wf_smu_remove(struct device *ddev) | 649 | static int __devexit wf_smu_remove(struct platform_device *ddev) |
654 | { | 650 | { |
655 | wf_unregister_client(&wf_smu_events); | 651 | wf_unregister_client(&wf_smu_events); |
656 | 652 | ||
@@ -698,16 +694,16 @@ static int wf_smu_remove(struct device *ddev) | |||
698 | if (wf_smu_cpu_fans) | 694 | if (wf_smu_cpu_fans) |
699 | kfree(wf_smu_cpu_fans); | 695 | kfree(wf_smu_cpu_fans); |
700 | 696 | ||
701 | wf_smu_dev = NULL; | ||
702 | |||
703 | return 0; | 697 | return 0; |
704 | } | 698 | } |
705 | 699 | ||
706 | static struct device_driver wf_smu_driver = { | 700 | static struct platform_driver wf_smu_driver = { |
707 | .name = "windfarm", | ||
708 | .bus = &platform_bus_type, | ||
709 | .probe = wf_smu_probe, | 701 | .probe = wf_smu_probe, |
710 | .remove = wf_smu_remove, | 702 | .remove = __devexit_p(wf_smu_remove), |
703 | .driver = { | ||
704 | .name = "windfarm", | ||
705 | .bus = &platform_bus_type, | ||
706 | }, | ||
711 | }; | 707 | }; |
712 | 708 | ||
713 | 709 | ||
@@ -725,7 +721,7 @@ static int __init wf_smu_init(void) | |||
725 | request_module("windfarm_lm75_sensor"); | 721 | request_module("windfarm_lm75_sensor"); |
726 | 722 | ||
727 | #endif /* MODULE */ | 723 | #endif /* MODULE */ |
728 | driver_register(&wf_smu_driver); | 724 | platform_driver_register(&wf_smu_driver); |
729 | } | 725 | } |
730 | 726 | ||
731 | return rc; | 727 | return rc; |
@@ -734,7 +730,7 @@ static int __init wf_smu_init(void) | |||
734 | static void __exit wf_smu_exit(void) | 730 | static void __exit wf_smu_exit(void) |
735 | { | 731 | { |
736 | 732 | ||
737 | driver_unregister(&wf_smu_driver); | 733 | platform_driver_unregister(&wf_smu_driver); |
738 | } | 734 | } |
739 | 735 | ||
740 | 736 | ||