aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/macintosh/windfarm_pm112.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_pm112.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_pm112.c')
-rw-r--r--drivers/macintosh/windfarm_pm112.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/macintosh/windfarm_pm112.c b/drivers/macintosh/windfarm_pm112.c
index ef66bf2778ec..fa4b13f89369 100644
--- a/drivers/macintosh/windfarm_pm112.c
+++ b/drivers/macintosh/windfarm_pm112.c
@@ -650,24 +650,26 @@ static struct notifier_block pm112_events = {
650 .notifier_call = pm112_wf_notify, 650 .notifier_call = pm112_wf_notify,
651}; 651};
652 652
653static int wf_pm112_probe(struct device *dev) 653static int wf_pm112_probe(struct platform_device *dev)
654{ 654{
655 wf_register_client(&pm112_events); 655 wf_register_client(&pm112_events);
656 return 0; 656 return 0;
657} 657}
658 658
659static int wf_pm112_remove(struct device *dev) 659static int __devexit wf_pm112_remove(struct platform_device *dev)
660{ 660{
661 wf_unregister_client(&pm112_events); 661 wf_unregister_client(&pm112_events);
662 /* should release all sensors and controls */ 662 /* should release all sensors and controls */
663 return 0; 663 return 0;
664} 664}
665 665
666static struct device_driver wf_pm112_driver = { 666static struct platform_driver wf_pm112_driver = {
667 .name = "windfarm",
668 .bus = &platform_bus_type,
669 .probe = wf_pm112_probe, 667 .probe = wf_pm112_probe,
670 .remove = wf_pm112_remove, 668 .remove = __devexit_p(wf_pm112_remove),
669 .driver = {
670 .name = "windfarm",
671 .bus = &platform_bus_type,
672 },
671}; 673};
672 674
673static int __init wf_pm112_init(void) 675static int __init wf_pm112_init(void)
@@ -683,13 +685,13 @@ static int __init wf_pm112_init(void)
683 ++nr_cores; 685 ++nr_cores;
684 686
685 printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n"); 687 printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n");
686 driver_register(&wf_pm112_driver); 688 platform_driver_register(&wf_pm112_driver);
687 return 0; 689 return 0;
688} 690}
689 691
690static void __exit wf_pm112_exit(void) 692static void __exit wf_pm112_exit(void)
691{ 693{
692 driver_unregister(&wf_pm112_driver); 694 platform_driver_unregister(&wf_pm112_driver);
693} 695}
694 696
695module_init(wf_pm112_init); 697module_init(wf_pm112_init);