diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2005-11-09 17:32:44 -0500 |
commit | 3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch) | |
tree | d8825be54cefb6ad6707478d719c8e30605bee7b /drivers/i2c/busses/i2c-mpc.c | |
parent | 00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (diff) |
[DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-mpc.c')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 65b939a059e9..5ccd338a9dc9 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -288,11 +288,10 @@ static struct i2c_adapter mpc_ops = { | |||
288 | .retries = 1 | 288 | .retries = 1 |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static int fsl_i2c_probe(struct device *device) | 291 | static int fsl_i2c_probe(struct platform_device *pdev) |
292 | { | 292 | { |
293 | int result = 0; | 293 | int result = 0; |
294 | struct mpc_i2c *i2c; | 294 | struct mpc_i2c *i2c; |
295 | struct platform_device *pdev = to_platform_device(device); | ||
296 | struct fsl_i2c_platform_data *pdata; | 295 | struct fsl_i2c_platform_data *pdata; |
297 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 296 | struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
298 | 297 | ||
@@ -323,7 +322,7 @@ static int fsl_i2c_probe(struct device *device) | |||
323 | } | 322 | } |
324 | 323 | ||
325 | mpc_i2c_setclock(i2c); | 324 | mpc_i2c_setclock(i2c); |
326 | dev_set_drvdata(device, i2c); | 325 | platform_set_drvdata(pdev, i2c); |
327 | 326 | ||
328 | i2c->adap = mpc_ops; | 327 | i2c->adap = mpc_ops; |
329 | i2c_set_adapdata(&i2c->adap, i2c); | 328 | i2c_set_adapdata(&i2c->adap, i2c); |
@@ -345,12 +344,12 @@ static int fsl_i2c_probe(struct device *device) | |||
345 | return result; | 344 | return result; |
346 | }; | 345 | }; |
347 | 346 | ||
348 | static int fsl_i2c_remove(struct device *device) | 347 | static int fsl_i2c_remove(struct platform_device *pdev) |
349 | { | 348 | { |
350 | struct mpc_i2c *i2c = dev_get_drvdata(device); | 349 | struct mpc_i2c *i2c = platform_get_drvdata(pdev); |
351 | 350 | ||
352 | i2c_del_adapter(&i2c->adap); | 351 | i2c_del_adapter(&i2c->adap); |
353 | dev_set_drvdata(device, NULL); | 352 | platform_set_drvdata(pdev, NULL); |
354 | 353 | ||
355 | if (i2c->irq != 0) | 354 | if (i2c->irq != 0) |
356 | free_irq(i2c->irq, i2c); | 355 | free_irq(i2c->irq, i2c); |
@@ -361,22 +360,23 @@ static int fsl_i2c_remove(struct device *device) | |||
361 | }; | 360 | }; |
362 | 361 | ||
363 | /* Structure for a device driver */ | 362 | /* Structure for a device driver */ |
364 | static struct device_driver fsl_i2c_driver = { | 363 | static struct platform_driver fsl_i2c_driver = { |
365 | .owner = THIS_MODULE, | ||
366 | .name = "fsl-i2c", | ||
367 | .bus = &platform_bus_type, | ||
368 | .probe = fsl_i2c_probe, | 364 | .probe = fsl_i2c_probe, |
369 | .remove = fsl_i2c_remove, | 365 | .remove = fsl_i2c_remove, |
366 | .driver = { | ||
367 | .owner = THIS_MODULE, | ||
368 | .name = "fsl-i2c", | ||
369 | }, | ||
370 | }; | 370 | }; |
371 | 371 | ||
372 | static int __init fsl_i2c_init(void) | 372 | static int __init fsl_i2c_init(void) |
373 | { | 373 | { |
374 | return driver_register(&fsl_i2c_driver); | 374 | return platform_driver_register(&fsl_i2c_driver); |
375 | } | 375 | } |
376 | 376 | ||
377 | static void __exit fsl_i2c_exit(void) | 377 | static void __exit fsl_i2c_exit(void) |
378 | { | 378 | { |
379 | driver_unregister(&fsl_i2c_driver); | 379 | platform_driver_unregister(&fsl_i2c_driver); |
380 | } | 380 | } |
381 | 381 | ||
382 | module_init(fsl_i2c_init); | 382 | module_init(fsl_i2c_init); |