aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/busses/i2c-cpm.c9
-rw-r--r--drivers/i2c/busses/i2c-ibm_iic.c9
-rw-r--r--drivers/i2c/busses/i2c-mpc.c22
-rw-r--r--drivers/i2c/busses/i2c-ocores.c14
-rw-r--r--drivers/i2c/i2c-core.c2
5 files changed, 20 insertions, 36 deletions
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index f2de3be35df3..3a20961bef1e 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -634,8 +634,7 @@ static void cpm_i2c_shutdown(struct cpm_i2c *cpm)
634 cpm_muram_free(cpm->i2c_addr); 634 cpm_muram_free(cpm->i2c_addr);
635} 635}
636 636
637static int __devinit cpm_i2c_probe(struct platform_device *ofdev, 637static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
638 const struct of_device_id *match)
639{ 638{
640 int result, len; 639 int result, len;
641 struct cpm_i2c *cpm; 640 struct cpm_i2c *cpm;
@@ -718,7 +717,7 @@ static const struct of_device_id cpm_i2c_match[] = {
718 717
719MODULE_DEVICE_TABLE(of, cpm_i2c_match); 718MODULE_DEVICE_TABLE(of, cpm_i2c_match);
720 719
721static struct of_platform_driver cpm_i2c_driver = { 720static struct platform_driver cpm_i2c_driver = {
722 .probe = cpm_i2c_probe, 721 .probe = cpm_i2c_probe,
723 .remove = __devexit_p(cpm_i2c_remove), 722 .remove = __devexit_p(cpm_i2c_remove),
724 .driver = { 723 .driver = {
@@ -730,12 +729,12 @@ static struct of_platform_driver cpm_i2c_driver = {
730 729
731static int __init cpm_i2c_init(void) 730static int __init cpm_i2c_init(void)
732{ 731{
733 return of_register_platform_driver(&cpm_i2c_driver); 732 return platform_driver_register(&cpm_i2c_driver);
734} 733}
735 734
736static void __exit cpm_i2c_exit(void) 735static void __exit cpm_i2c_exit(void)
737{ 736{
738 of_unregister_platform_driver(&cpm_i2c_driver); 737 platform_driver_unregister(&cpm_i2c_driver);
739} 738}
740 739
741module_init(cpm_i2c_init); 740module_init(cpm_i2c_init);
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 6e3c38240336..e4f88dca99b5 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -691,8 +691,7 @@ static int __devinit iic_request_irq(struct platform_device *ofdev,
691/* 691/*
692 * Register single IIC interface 692 * Register single IIC interface
693 */ 693 */
694static int __devinit iic_probe(struct platform_device *ofdev, 694static int __devinit iic_probe(struct platform_device *ofdev)
695 const struct of_device_id *match)
696{ 695{
697 struct device_node *np = ofdev->dev.of_node; 696 struct device_node *np = ofdev->dev.of_node;
698 struct ibm_iic_private *dev; 697 struct ibm_iic_private *dev;
@@ -806,7 +805,7 @@ static const struct of_device_id ibm_iic_match[] = {
806 {} 805 {}
807}; 806};
808 807
809static struct of_platform_driver ibm_iic_driver = { 808static struct platform_driver ibm_iic_driver = {
810 .driver = { 809 .driver = {
811 .name = "ibm-iic", 810 .name = "ibm-iic",
812 .owner = THIS_MODULE, 811 .owner = THIS_MODULE,
@@ -818,12 +817,12 @@ static struct of_platform_driver ibm_iic_driver = {
818 817
819static int __init iic_init(void) 818static int __init iic_init(void)
820{ 819{
821 return of_register_platform_driver(&ibm_iic_driver); 820 return platform_driver_register(&ibm_iic_driver);
822} 821}
823 822
824static void __exit iic_exit(void) 823static void __exit iic_exit(void)
825{ 824{
826 of_unregister_platform_driver(&ibm_iic_driver); 825 platform_driver_unregister(&ibm_iic_driver);
827} 826}
828 827
829module_init(iic_init); 828module_init(iic_init);
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b74e6dc6886c..75b984c519ac 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -560,8 +560,7 @@ static struct i2c_adapter mpc_ops = {
560 .timeout = HZ, 560 .timeout = HZ,
561}; 561};
562 562
563static int __devinit fsl_i2c_probe(struct platform_device *op, 563static int __devinit fsl_i2c_probe(struct platform_device *op)
564 const struct of_device_id *match)
565{ 564{
566 struct mpc_i2c *i2c; 565 struct mpc_i2c *i2c;
567 const u32 *prop; 566 const u32 *prop;
@@ -569,6 +568,9 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
569 int result = 0; 568 int result = 0;
570 int plen; 569 int plen;
571 570
571 if (!op->dev.of_match)
572 return -EINVAL;
573
572 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL); 574 i2c = kzalloc(sizeof(*i2c), GFP_KERNEL);
573 if (!i2c) 575 if (!i2c)
574 return -ENOMEM; 576 return -ENOMEM;
@@ -603,8 +605,8 @@ static int __devinit fsl_i2c_probe(struct platform_device *op,
603 clock = *prop; 605 clock = *prop;
604 } 606 }
605 607
606 if (match->data) { 608 if (op->dev.of_match->data) {
607 struct mpc_i2c_data *data = match->data; 609 struct mpc_i2c_data *data = op->dev.of_match->data;
608 data->setup(op->dev.of_node, i2c, clock, data->prescaler); 610 data->setup(op->dev.of_node, i2c, clock, data->prescaler);
609 } else { 611 } else {
610 /* Backwards compatibility */ 612 /* Backwards compatibility */
@@ -700,7 +702,7 @@ static const struct of_device_id mpc_i2c_of_match[] = {
700MODULE_DEVICE_TABLE(of, mpc_i2c_of_match); 702MODULE_DEVICE_TABLE(of, mpc_i2c_of_match);
701 703
702/* Structure for a device driver */ 704/* Structure for a device driver */
703static struct of_platform_driver mpc_i2c_driver = { 705static struct platform_driver mpc_i2c_driver = {
704 .probe = fsl_i2c_probe, 706 .probe = fsl_i2c_probe,
705 .remove = __devexit_p(fsl_i2c_remove), 707 .remove = __devexit_p(fsl_i2c_remove),
706 .driver = { 708 .driver = {
@@ -712,18 +714,12 @@ static struct of_platform_driver mpc_i2c_driver = {
712 714
713static int __init fsl_i2c_init(void) 715static int __init fsl_i2c_init(void)
714{ 716{
715 int rv; 717 return platform_driver_register(&mpc_i2c_driver);
716
717 rv = of_register_platform_driver(&mpc_i2c_driver);
718 if (rv)
719 printk(KERN_ERR DRV_NAME
720 " of_register_platform_driver failed (%i)\n", rv);
721 return rv;
722} 718}
723 719
724static void __exit fsl_i2c_exit(void) 720static void __exit fsl_i2c_exit(void)
725{ 721{
726 of_unregister_platform_driver(&mpc_i2c_driver); 722 platform_driver_unregister(&mpc_i2c_driver);
727} 723}
728 724
729module_init(fsl_i2c_init); 725module_init(fsl_i2c_init);
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 61653f079671..1b46a9d9f907 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -330,9 +330,7 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
330 i2c->adap = ocores_adapter; 330 i2c->adap = ocores_adapter;
331 i2c_set_adapdata(&i2c->adap, i2c); 331 i2c_set_adapdata(&i2c->adap, i2c);
332 i2c->adap.dev.parent = &pdev->dev; 332 i2c->adap.dev.parent = &pdev->dev;
333#ifdef CONFIG_OF
334 i2c->adap.dev.of_node = pdev->dev.of_node; 333 i2c->adap.dev.of_node = pdev->dev.of_node;
335#endif
336 334
337 /* add i2c adapter to i2c tree */ 335 /* add i2c adapter to i2c tree */
338 ret = i2c_add_adapter(&i2c->adap); 336 ret = i2c_add_adapter(&i2c->adap);
@@ -390,15 +388,11 @@ static int ocores_i2c_resume(struct platform_device *pdev)
390#define ocores_i2c_resume NULL 388#define ocores_i2c_resume NULL
391#endif 389#endif
392 390
393#ifdef CONFIG_OF
394static struct of_device_id ocores_i2c_match[] = { 391static struct of_device_id ocores_i2c_match[] = {
395 { 392 { .compatible = "opencores,i2c-ocores", },
396 .compatible = "opencores,i2c-ocores", 393 {},
397 },
398 {},
399}; 394};
400MODULE_DEVICE_TABLE(of, ocores_i2c_match); 395MODULE_DEVICE_TABLE(of, ocores_i2c_match);
401#endif
402 396
403/* work with hotplug and coldplug */ 397/* work with hotplug and coldplug */
404MODULE_ALIAS("platform:ocores-i2c"); 398MODULE_ALIAS("platform:ocores-i2c");
@@ -411,9 +405,7 @@ static struct platform_driver ocores_i2c_driver = {
411 .driver = { 405 .driver = {
412 .owner = THIS_MODULE, 406 .owner = THIS_MODULE,
413 .name = "ocores-i2c", 407 .name = "ocores-i2c",
414#ifdef CONFIG_OF 408 .of_match_table = ocores_i2c_match,
415 .of_match_table = ocores_i2c_match,
416#endif
417 }, 409 },
418}; 410};
419 411
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index f0bd5bcdf563..045ba6efea48 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -537,9 +537,7 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info)
537 client->dev.parent = &client->adapter->dev; 537 client->dev.parent = &client->adapter->dev;
538 client->dev.bus = &i2c_bus_type; 538 client->dev.bus = &i2c_bus_type;
539 client->dev.type = &i2c_client_type; 539 client->dev.type = &i2c_client_type;
540#ifdef CONFIG_OF
541 client->dev.of_node = info->of_node; 540 client->dev.of_node = info->of_node;
542#endif
543 541
544 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), 542 dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap),
545 client->addr); 543 client->addr);