* [PATCH] powerpc: Fix windfarm platform device usage
@ 2006-10-10 1:47 Benjamin Herrenschmidt
2006-10-10 12:09 ` Robin H. Johnson
0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-10 1:47 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev list
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>
Index: linux-work/drivers/macintosh/windfarm_pm112.c
===================================================================
--- linux-work.orig/drivers/macintosh/windfarm_pm112.c 2006-03-10 15:58:18.000000000 +1100
+++ linux-work/drivers/macintosh/windfarm_pm112.c 2006-10-10 11:40:20.000000000 +1000
@@ -650,24 +650,26 @@ static struct notifier_block pm112_event
.notifier_call = pm112_wf_notify,
};
-static int wf_pm112_probe(struct device *dev)
+static int wf_pm112_probe(struct platform_device *dev)
{
wf_register_client(&pm112_events);
return 0;
}
-static int wf_pm112_remove(struct device *dev)
+static int __devexit wf_pm112_remove(struct platform_device *dev)
{
wf_unregister_client(&pm112_events);
/* should release all sensors and controls */
return 0;
}
-static struct device_driver wf_pm112_driver = {
- .name = "windfarm",
- .bus = &platform_bus_type,
+static struct platform_driver wf_pm112_driver = {
.probe = wf_pm112_probe,
- .remove = wf_pm112_remove,
+ .remove = __devexit_p(wf_pm112_remove),
+ .driver = {
+ .name = "windfarm",
+ .bus = &platform_bus_type,
+ },
};
static int __init wf_pm112_init(void)
@@ -683,13 +685,13 @@ static int __init wf_pm112_init(void)
++nr_cores;
printk(KERN_INFO "windfarm: initializing for dual-core desktop G5\n");
- driver_register(&wf_pm112_driver);
+ platform_driver_register(&wf_pm112_driver);
return 0;
}
static void __exit wf_pm112_exit(void)
{
- driver_unregister(&wf_pm112_driver);
+ platform_driver_unregister(&wf_pm112_driver);
}
module_init(wf_pm112_init);
Index: linux-work/drivers/macintosh/windfarm_pm81.c
===================================================================
--- linux-work.orig/drivers/macintosh/windfarm_pm81.c 2006-10-06 13:48:04.000000000 +1000
+++ linux-work/drivers/macintosh/windfarm_pm81.c 2006-10-10 11:42:02.000000000 +1000
@@ -131,8 +131,6 @@
static int wf_smu_mach_model; /* machine model id */
-static struct device *wf_smu_dev;
-
/* Controls & sensors */
static struct wf_sensor *sensor_cpu_power;
static struct wf_sensor *sensor_cpu_temp;
@@ -717,16 +715,14 @@ static int wf_init_pm(void)
return 0;
}
-static int wf_smu_probe(struct device *ddev)
+static int wf_smu_probe(struct platform_device *ddev)
{
- wf_smu_dev = ddev;
-
wf_register_client(&wf_smu_events);
return 0;
}
-static int wf_smu_remove(struct device *ddev)
+static int __devexit wf_smu_remove(struct platform_device *ddev)
{
wf_unregister_client(&wf_smu_events);
@@ -766,16 +762,16 @@ static int wf_smu_remove(struct device *
if (wf_smu_cpu_fans)
kfree(wf_smu_cpu_fans);
- wf_smu_dev = NULL;
-
return 0;
}
-static struct device_driver wf_smu_driver = {
- .name = "windfarm",
- .bus = &platform_bus_type,
+static struct platform_driver wf_smu_driver = {
.probe = wf_smu_probe,
- .remove = wf_smu_remove,
+ .remove = __devexit_p(wf_smu_remove),
+ .driver = {
+ .name = "windfarm",
+ .bus = &platform_bus_type,
+ },
};
@@ -794,7 +790,7 @@ static int __init wf_smu_init(void)
request_module("windfarm_lm75_sensor");
#endif /* MODULE */
- driver_register(&wf_smu_driver);
+ platform_driver_register(&wf_smu_driver);
}
return rc;
@@ -803,7 +799,7 @@ static int __init wf_smu_init(void)
static void __exit wf_smu_exit(void)
{
- driver_unregister(&wf_smu_driver);
+ platform_driver_unregister(&wf_smu_driver);
}
Index: linux-work/drivers/macintosh/windfarm_pm91.c
===================================================================
--- linux-work.orig/drivers/macintosh/windfarm_pm91.c 2006-10-06 13:48:04.000000000 +1000
+++ linux-work/drivers/macintosh/windfarm_pm91.c 2006-10-10 11:41:52.000000000 +1000
@@ -63,8 +63,6 @@
*/
#undef HACKED_OVERTEMP
-static struct device *wf_smu_dev;
-
/* Controls & sensors */
static struct wf_sensor *sensor_cpu_power;
static struct wf_sensor *sensor_cpu_temp;
@@ -641,16 +639,14 @@ static int wf_init_pm(void)
return 0;
}
-static int wf_smu_probe(struct device *ddev)
+static int wf_smu_probe(struct platform_device *ddev)
{
- wf_smu_dev = ddev;
-
wf_register_client(&wf_smu_events);
return 0;
}
-static int wf_smu_remove(struct device *ddev)
+static int __devexit wf_smu_remove(struct platform_device *ddev)
{
wf_unregister_client(&wf_smu_events);
@@ -698,16 +694,16 @@ static int wf_smu_remove(struct device *
if (wf_smu_cpu_fans)
kfree(wf_smu_cpu_fans);
- wf_smu_dev = NULL;
-
return 0;
}
-static struct device_driver wf_smu_driver = {
- .name = "windfarm",
- .bus = &platform_bus_type,
+static struct platform_driver wf_smu_driver = {
.probe = wf_smu_probe,
- .remove = wf_smu_remove,
+ .remove = __devexit_p(wf_smu_remove),
+ .driver = {
+ .name = "windfarm",
+ .bus = &platform_bus_type,
+ },
};
@@ -725,7 +721,7 @@ static int __init wf_smu_init(void)
request_module("windfarm_lm75_sensor");
#endif /* MODULE */
- driver_register(&wf_smu_driver);
+ platform_driver_register(&wf_smu_driver);
}
return rc;
@@ -734,7 +730,7 @@ static int __init wf_smu_init(void)
static void __exit wf_smu_exit(void)
{
- driver_unregister(&wf_smu_driver);
+ platform_driver_unregister(&wf_smu_driver);
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Fix windfarm platform device usage
2006-10-10 1:47 [PATCH] powerpc: Fix windfarm platform device usage Benjamin Herrenschmidt
@ 2006-10-10 12:09 ` Robin H. Johnson
2006-10-10 12:19 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 3+ messages in thread
From: Robin H. Johnson @ 2006-10-10 12:09 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev list, Paul Mackerras
[-- Attachment #1: Type: text/plain, Size: 479 bytes --]
On Tue, Oct 10, 2006 at 11:47:31AM +1000, Benjamin Herrenschmidt wrote:
> 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.
Thanks! This makes my windfarm work a lot easier!
(I am still working on it, just very slowly).
--
Robin Hugh Johnson
E-Mail : robbat2@gentoo.org
GnuPG FP : 11AC BA4F 4778 E3F6 E4ED F38E B27B 944E 3488 4E85
[-- Attachment #2: Type: application/pgp-signature, Size: 232 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] powerpc: Fix windfarm platform device usage
2006-10-10 12:09 ` Robin H. Johnson
@ 2006-10-10 12:19 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 3+ messages in thread
From: Benjamin Herrenschmidt @ 2006-10-10 12:19 UTC (permalink / raw)
To: Robin H. Johnson; +Cc: linuxppc-dev list, Paul Mackerras
On Tue, 2006-10-10 at 05:09 -0700, Robin H. Johnson wrote:
> On Tue, Oct 10, 2006 at 11:47:31AM +1000, Benjamin Herrenschmidt wrote:
> > 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.
> Thanks! This makes my windfarm work a lot easier!
> (I am still working on it, just very slowly).
Ah good news :)
Ben.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-10-10 12:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-10 1:47 [PATCH] powerpc: Fix windfarm platform device usage Benjamin Herrenschmidt
2006-10-10 12:09 ` Robin H. Johnson
2006-10-10 12:19 ` Benjamin Herrenschmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).