diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2006-10-09 21:45:45 -0400 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2006-10-09 23:56:13 -0400 |
commit | 9f2545c11869868fd3cde7098d99e690891e442c (patch) | |
tree | e0e22ce8b9aaef7f29175a0841859c309c6090a7 | |
parent | d6a29252ad120457cd544d44b2fbea46a00734a7 (diff) |
[POWERPC] Fix i2c-powermac platform device usage
i2c-powermac was written & merged right after Russell King's changes
adding platform_driver... which I missed. Thus it still used struct
device, causing crashes when hitting sleep/wakeup callbacks (it happened
to work by luck so far, until early/late callbacks got added). This
causes crashes on sleep/wakeup on PowerBooks with 2.6.19. The patch
fixes it by using a proper platform_driver.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Paul Mackerras <paulus@samba.org>
-rw-r--r-- | drivers/i2c/busses/i2c-powermac.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index a508cb962d24..648d55533d87 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -182,9 +182,9 @@ static const struct i2c_algorithm i2c_powermac_algorithm = { | |||
182 | }; | 182 | }; |
183 | 183 | ||
184 | 184 | ||
185 | static int i2c_powermac_remove(struct device *dev) | 185 | static int i2c_powermac_remove(struct platform_device *dev) |
186 | { | 186 | { |
187 | struct i2c_adapter *adapter = dev_get_drvdata(dev); | 187 | struct i2c_adapter *adapter = platform_get_drvdata(dev); |
188 | struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); | 188 | struct pmac_i2c_bus *bus = i2c_get_adapdata(adapter); |
189 | int rc; | 189 | int rc; |
190 | 190 | ||
@@ -195,16 +195,16 @@ static int i2c_powermac_remove(struct device *dev) | |||
195 | if (rc) | 195 | if (rc) |
196 | printk("i2c-powermac.c: Failed to remove bus %s !\n", | 196 | printk("i2c-powermac.c: Failed to remove bus %s !\n", |
197 | adapter->name); | 197 | adapter->name); |
198 | dev_set_drvdata(dev, NULL); | 198 | platform_set_drvdata(dev, NULL); |
199 | kfree(adapter); | 199 | kfree(adapter); |
200 | 200 | ||
201 | return 0; | 201 | return 0; |
202 | } | 202 | } |
203 | 203 | ||
204 | 204 | ||
205 | static int i2c_powermac_probe(struct device *dev) | 205 | static int __devexit i2c_powermac_probe(struct platform_device *dev) |
206 | { | 206 | { |
207 | struct pmac_i2c_bus *bus = dev->platform_data; | 207 | struct pmac_i2c_bus *bus = dev->dev.platform_data; |
208 | struct device_node *parent = NULL; | 208 | struct device_node *parent = NULL; |
209 | struct i2c_adapter *adapter; | 209 | struct i2c_adapter *adapter; |
210 | char name[32]; | 210 | char name[32]; |
@@ -246,11 +246,11 @@ static int i2c_powermac_probe(struct device *dev) | |||
246 | printk(KERN_ERR "i2c-powermac: can't allocate inteface !\n"); | 246 | printk(KERN_ERR "i2c-powermac: can't allocate inteface !\n"); |
247 | return -ENOMEM; | 247 | return -ENOMEM; |
248 | } | 248 | } |
249 | dev_set_drvdata(dev, adapter); | 249 | platform_set_drvdata(dev, adapter); |
250 | strcpy(adapter->name, name); | 250 | strcpy(adapter->name, name); |
251 | adapter->algo = &i2c_powermac_algorithm; | 251 | adapter->algo = &i2c_powermac_algorithm; |
252 | i2c_set_adapdata(adapter, bus); | 252 | i2c_set_adapdata(adapter, bus); |
253 | adapter->dev.parent = dev; | 253 | adapter->dev.parent = &dev->dev; |
254 | pmac_i2c_attach_adapter(bus, adapter); | 254 | pmac_i2c_attach_adapter(bus, adapter); |
255 | rc = i2c_add_adapter(adapter); | 255 | rc = i2c_add_adapter(adapter); |
256 | if (rc) { | 256 | if (rc) { |
@@ -265,23 +265,25 @@ static int i2c_powermac_probe(struct device *dev) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | 267 | ||
268 | static struct device_driver i2c_powermac_driver = { | 268 | static struct platform_driver i2c_powermac_driver = { |
269 | .name = "i2c-powermac", | ||
270 | .bus = &platform_bus_type, | ||
271 | .probe = i2c_powermac_probe, | 269 | .probe = i2c_powermac_probe, |
272 | .remove = i2c_powermac_remove, | 270 | .remove = __devexit_p(i2c_powermac_remove), |
271 | .driver = { | ||
272 | .name = "i2c-powermac", | ||
273 | .bus = &platform_bus_type, | ||
274 | }, | ||
273 | }; | 275 | }; |
274 | 276 | ||
275 | static int __init i2c_powermac_init(void) | 277 | static int __init i2c_powermac_init(void) |
276 | { | 278 | { |
277 | driver_register(&i2c_powermac_driver); | 279 | platform_driver_register(&i2c_powermac_driver); |
278 | return 0; | 280 | return 0; |
279 | } | 281 | } |
280 | 282 | ||
281 | 283 | ||
282 | static void __exit i2c_powermac_cleanup(void) | 284 | static void __exit i2c_powermac_cleanup(void) |
283 | { | 285 | { |
284 | driver_unregister(&i2c_powermac_driver); | 286 | platform_driver_unregister(&i2c_powermac_driver); |
285 | } | 287 | } |
286 | 288 | ||
287 | module_init(i2c_powermac_init); | 289 | module_init(i2c_powermac_init); |