diff options
Diffstat (limited to 'drivers/macintosh')
| -rw-r--r-- | drivers/macintosh/therm_pm72.c | 30 |
1 files changed, 5 insertions, 25 deletions
diff --git a/drivers/macintosh/therm_pm72.c b/drivers/macintosh/therm_pm72.c index 44549272333..2e041fd0a00 100644 --- a/drivers/macintosh/therm_pm72.c +++ b/drivers/macintosh/therm_pm72.c | |||
| @@ -2213,6 +2213,9 @@ static void fcu_lookup_fans(struct device_node *fcu_node) | |||
| 2213 | static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match) | 2213 | static int fcu_of_probe(struct platform_device* dev, const struct of_device_id *match) |
| 2214 | { | 2214 | { |
| 2215 | state = state_detached; | 2215 | state = state_detached; |
| 2216 | of_dev = dev; | ||
| 2217 | |||
| 2218 | dev_info(&dev->dev, "PowerMac G5 Thermal control driver %s\n", VERSION); | ||
| 2216 | 2219 | ||
| 2217 | /* Lookup the fans in the device tree */ | 2220 | /* Lookup the fans in the device tree */ |
| 2218 | fcu_lookup_fans(dev->dev.of_node); | 2221 | fcu_lookup_fans(dev->dev.of_node); |
| @@ -2235,6 +2238,7 @@ static const struct of_device_id fcu_match[] = | |||
| 2235 | }, | 2238 | }, |
| 2236 | {}, | 2239 | {}, |
| 2237 | }; | 2240 | }; |
| 2241 | MODULE_DEVICE_TABLE(of, fcu_match); | ||
| 2238 | 2242 | ||
| 2239 | static struct of_platform_driver fcu_of_platform_driver = | 2243 | static struct of_platform_driver fcu_of_platform_driver = |
| 2240 | { | 2244 | { |
| @@ -2252,8 +2256,6 @@ static struct of_platform_driver fcu_of_platform_driver = | |||
| 2252 | */ | 2256 | */ |
| 2253 | static int __init therm_pm72_init(void) | 2257 | static int __init therm_pm72_init(void) |
| 2254 | { | 2258 | { |
| 2255 | struct device_node *np; | ||
| 2256 | |||
| 2257 | rackmac = of_machine_is_compatible("RackMac3,1"); | 2259 | rackmac = of_machine_is_compatible("RackMac3,1"); |
| 2258 | 2260 | ||
| 2259 | if (!of_machine_is_compatible("PowerMac7,2") && | 2261 | if (!of_machine_is_compatible("PowerMac7,2") && |
| @@ -2261,34 +2263,12 @@ static int __init therm_pm72_init(void) | |||
| 2261 | !rackmac) | 2263 | !rackmac) |
| 2262 | return -ENODEV; | 2264 | return -ENODEV; |
| 2263 | 2265 | ||
| 2264 | printk(KERN_INFO "PowerMac G5 Thermal control driver %s\n", VERSION); | 2266 | return of_register_platform_driver(&fcu_of_platform_driver); |
| 2265 | |||
| 2266 | np = of_find_node_by_type(NULL, "fcu"); | ||
| 2267 | if (np == NULL) { | ||
| 2268 | /* Some machines have strangely broken device-tree */ | ||
| 2269 | np = of_find_node_by_path("/u3@0,f8000000/i2c@f8001000/fan@15e"); | ||
| 2270 | if (np == NULL) { | ||
| 2271 | printk(KERN_ERR "Can't find FCU in device-tree !\n"); | ||
| 2272 | return -ENODEV; | ||
| 2273 | } | ||
| 2274 | } | ||
| 2275 | of_dev = of_platform_device_create(np, "temperature", NULL); | ||
| 2276 | if (of_dev == NULL) { | ||
| 2277 | printk(KERN_ERR "Can't register FCU platform device !\n"); | ||
| 2278 | return -ENODEV; | ||
| 2279 | } | ||
| 2280 | |||
| 2281 | of_register_platform_driver(&fcu_of_platform_driver); | ||
| 2282 | |||
| 2283 | return 0; | ||
| 2284 | } | 2267 | } |
| 2285 | 2268 | ||
| 2286 | static void __exit therm_pm72_exit(void) | 2269 | static void __exit therm_pm72_exit(void) |
| 2287 | { | 2270 | { |
| 2288 | of_unregister_platform_driver(&fcu_of_platform_driver); | 2271 | of_unregister_platform_driver(&fcu_of_platform_driver); |
| 2289 | |||
| 2290 | if (of_dev) | ||
| 2291 | of_device_unregister(of_dev); | ||
| 2292 | } | 2272 | } |
| 2293 | 2273 | ||
| 2294 | module_init(therm_pm72_init); | 2274 | module_init(therm_pm72_init); |
