aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-iop3xx.c
diff options
context:
space:
mode:
authorRussell King <rmk@dyn-67.arm.linux.org.uk>2005-11-09 17:32:44 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2005-11-09 17:32:44 -0500
commit3ae5eaec1d2d9c0cf53745352e7d4b152810ba24 (patch)
treed8825be54cefb6ad6707478d719c8e30605bee7b /drivers/i2c/busses/i2c-iop3xx.c
parent00d3dcdd96646be6059cc21f2efa94c4edc1eda5 (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-iop3xx.c')
-rw-r--r--drivers/i2c/busses/i2c-iop3xx.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/i2c/busses/i2c-iop3xx.c b/drivers/i2c/busses/i2c-iop3xx.c
index cfae4ad00fae..1414851a17b8 100644
--- a/drivers/i2c/busses/i2c-iop3xx.c
+++ b/drivers/i2c/busses/i2c-iop3xx.c
@@ -405,10 +405,9 @@ static struct i2c_algorithm iop3xx_i2c_algo = {
405}; 405};
406 406
407static int 407static int
408iop3xx_i2c_remove(struct device *device) 408iop3xx_i2c_remove(struct platform_device *pdev)
409{ 409{
410 struct platform_device *pdev = to_platform_device(device); 410 struct i2c_adapter *padapter = platform_get_drvdata(pdev);
411 struct i2c_adapter *padapter = dev_get_drvdata(&pdev->dev);
412 struct i2c_algo_iop3xx_data *adapter_data = 411 struct i2c_algo_iop3xx_data *adapter_data =
413 (struct i2c_algo_iop3xx_data *)padapter->algo_data; 412 (struct i2c_algo_iop3xx_data *)padapter->algo_data;
414 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 413 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -426,15 +425,14 @@ iop3xx_i2c_remove(struct device *device)
426 kfree(adapter_data); 425 kfree(adapter_data);
427 kfree(padapter); 426 kfree(padapter);
428 427
429 dev_set_drvdata(&pdev->dev, NULL); 428 platform_set_drvdata(pdev, NULL);
430 429
431 return 0; 430 return 0;
432} 431}
433 432
434static int 433static int
435iop3xx_i2c_probe(struct device *dev) 434iop3xx_i2c_probe(struct platform_device *pdev)
436{ 435{
437 struct platform_device *pdev = to_platform_device(dev);
438 struct resource *res; 436 struct resource *res;
439 int ret; 437 int ret;
440 struct i2c_adapter *new_adapter; 438 struct i2c_adapter *new_adapter;
@@ -499,7 +497,7 @@ iop3xx_i2c_probe(struct device *dev)
499 iop3xx_i2c_set_slave_addr(adapter_data); 497 iop3xx_i2c_set_slave_addr(adapter_data);
500 iop3xx_i2c_enable(adapter_data); 498 iop3xx_i2c_enable(adapter_data);
501 499
502 dev_set_drvdata(&pdev->dev, new_adapter); 500 platform_set_drvdata(pdev, new_adapter);
503 new_adapter->algo_data = adapter_data; 501 new_adapter->algo_data = adapter_data;
504 502
505 i2c_add_adapter(new_adapter); 503 i2c_add_adapter(new_adapter);
@@ -523,24 +521,25 @@ out:
523} 521}
524 522
525 523
526static struct device_driver iop3xx_i2c_driver = { 524static struct platform_driver iop3xx_i2c_driver = {
527 .owner = THIS_MODULE,
528 .name = "IOP3xx-I2C",
529 .bus = &platform_bus_type,
530 .probe = iop3xx_i2c_probe, 525 .probe = iop3xx_i2c_probe,
531 .remove = iop3xx_i2c_remove 526 .remove = iop3xx_i2c_remove,
527 .driver = {
528 .owner = THIS_MODULE,
529 .name = "IOP3xx-I2C",
530 },
532}; 531};
533 532
534static int __init 533static int __init
535i2c_iop3xx_init (void) 534i2c_iop3xx_init (void)
536{ 535{
537 return driver_register(&iop3xx_i2c_driver); 536 return platform_driver_register(&iop3xx_i2c_driver);
538} 537}
539 538
540static void __exit 539static void __exit
541i2c_iop3xx_exit (void) 540i2c_iop3xx_exit (void)
542{ 541{
543 driver_unregister(&iop3xx_i2c_driver); 542 platform_driver_unregister(&iop3xx_i2c_driver);
544 return; 543 return;
545} 544}
546 545