/* register new adapter to i2c module... */
 
        data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len);
-       if (data && len == 4) {
-               cpm->adap.nr = *data;
-               result = i2c_add_numbered_adapter(&cpm->adap);
-       } else
-               result = i2c_add_adapter(&cpm->adap);
+       cpm->adap.nr = (data && len == 4) ? be32_to_cpup(data) : -1;
+       result = i2c_add_numbered_adapter(&cpm->adap);
 
        if (result < 0) {
                dev_err(&ofdev->dev, "Unable to register with I2C\n");
 
         * The reason to do so is to avoid sysfs names that only make
         * sense when there are multiple adapters.
         */
-       i2c->adap.nr = dev->id != -1 ? dev->id : 0;
+       i2c->adap.nr = dev->id;
        snprintf(i2c->adap.name, sizeof(i2c->adap.name), "pxa_i2c-i2c.%u",
                 i2c->adap.nr);
 
        i2c->adap.dev.of_node = dev->dev.of_node;
 #endif
 
-       if (i2c_type == REGS_CE4100)
-               ret = i2c_add_adapter(&i2c->adap);
-       else
-               ret = i2c_add_numbered_adapter(&i2c->adap);
+       ret = i2c_add_numbered_adapter(&i2c->adap);
        if (ret < 0) {
                printk(KERN_INFO "I2C: Failed to add bus\n");
                goto eadapt;
 
        i2c_wr16(iface, S6_I2C_TXTL, 0);
 
        platform_set_drvdata(dev, iface);
-       if (bus_num < 0)
-               rc = i2c_add_adapter(p_adap);
-       else
-               rc = i2c_add_numbered_adapter(p_adap);
+       rc = i2c_add_numbered_adapter(p_adap);
        if (rc)
                goto err_irq_free;
        return 0;
 
  * or otherwise built in to the system's mainboard, and where i2c_board_info
  * is used to properly configure I2C devices.
  *
+ * If the requested bus number is set to -1, then this function will behave
+ * identically to i2c_add_adapter, and will dynamically assign a bus number.
+ *
  * If no devices have pre-been declared for this bus, then be sure to
  * register the adapter before any dynamically allocated ones.  Otherwise
  * the required bus ID may not be available.
        int     id;
        int     status;
 
+       if (adap->nr == -1) /* -1 means dynamically assign bus id */
+               return i2c_add_adapter(adap);
        if (adap->nr & ~MAX_ID_MASK)
                return -EINVAL;