diff options
Diffstat (limited to 'drivers/i2c/busses/i2c-mpc.c')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 22 |
1 files changed, 9 insertions, 13 deletions
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 | ||
563 | static int __devinit fsl_i2c_probe(struct platform_device *op, | 563 | static 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[] = { | |||
700 | MODULE_DEVICE_TABLE(of, mpc_i2c_of_match); | 702 | MODULE_DEVICE_TABLE(of, mpc_i2c_of_match); |
701 | 703 | ||
702 | /* Structure for a device driver */ | 704 | /* Structure for a device driver */ |
703 | static struct of_platform_driver mpc_i2c_driver = { | 705 | static 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 | ||
713 | static int __init fsl_i2c_init(void) | 715 | static 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 | ||
724 | static void __exit fsl_i2c_exit(void) | 720 | static 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 | ||
729 | module_init(fsl_i2c_init); | 725 | module_init(fsl_i2c_init); |