diff options
-rw-r--r-- | arch/powerpc/sysdev/fsl_soc.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c index 167523e9e41c..14616d5d12d5 100644 --- a/arch/powerpc/sysdev/fsl_soc.c +++ b/arch/powerpc/sysdev/fsl_soc.c | |||
@@ -496,6 +496,8 @@ static int __init fsl_i2c_of_init(void) | |||
496 | struct resource r[2]; | 496 | struct resource r[2]; |
497 | struct fsl_i2c_platform_data i2c_data; | 497 | struct fsl_i2c_platform_data i2c_data; |
498 | const unsigned char *flags = NULL; | 498 | const unsigned char *flags = NULL; |
499 | int idx; | ||
500 | const u32 *iprop; | ||
499 | 501 | ||
500 | memset(&r, 0, sizeof(r)); | 502 | memset(&r, 0, sizeof(r)); |
501 | memset(&i2c_data, 0, sizeof(i2c_data)); | 503 | memset(&i2c_data, 0, sizeof(i2c_data)); |
@@ -506,7 +508,10 @@ static int __init fsl_i2c_of_init(void) | |||
506 | 508 | ||
507 | of_irq_to_resource(np, 0, &r[1]); | 509 | of_irq_to_resource(np, 0, &r[1]); |
508 | 510 | ||
509 | i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2); | 511 | iprop = of_get_property(np, "cell-index", NULL); |
512 | idx = iprop ? *iprop : i; | ||
513 | |||
514 | i2c_dev = platform_device_register_simple("fsl-i2c", idx, r, 2); | ||
510 | if (IS_ERR(i2c_dev)) { | 515 | if (IS_ERR(i2c_dev)) { |
511 | ret = PTR_ERR(i2c_dev); | 516 | ret = PTR_ERR(i2c_dev); |
512 | goto err; | 517 | goto err; |
@@ -528,7 +533,8 @@ static int __init fsl_i2c_of_init(void) | |||
528 | if (ret) | 533 | if (ret) |
529 | goto unreg; | 534 | goto unreg; |
530 | 535 | ||
531 | of_register_i2c_devices(np, i++); | 536 | of_register_i2c_devices(np, idx); |
537 | i++; | ||
532 | } | 538 | } |
533 | 539 | ||
534 | return 0; | 540 | return 0; |