Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux
[firefly-linux-kernel-4.4.55.git] / drivers / regulator / da9211-regulator.c
index 5aabbac1b524e257638a20dbe1c430896194ca70..c78d2106d6cb66aa6b5ca1b8df25c244c73a3686 100644 (file)
@@ -278,7 +278,7 @@ static struct da9211_pdata *da9211_parse_regulators_dt(
                pdata->init_data[n] = da9211_matches[i].init_data;
 
                n++;
-       };
+       }
 
        return pdata;
 }
@@ -364,6 +364,7 @@ static int da9211_regulator_init(struct da9211 *chip)
                config.dev = chip->dev;
                config.driver_data = chip;
                config.regmap = chip->regmap;
+               config.of_node = chip->dev->of_node;
 
                chip->rdev[i] = devm_regulator_register(chip->dev,
                        &da9211_regulators[i], &config);
@@ -375,7 +376,7 @@ static int da9211_regulator_init(struct da9211 *chip)
 
                if (chip->chip_irq != 0) {
                        ret = regmap_update_bits(chip->regmap,
-                               DA9211_REG_MASK_B, DA9211_M_OV_CURR_A << i, 1);
+                               DA9211_REG_MASK_B, DA9211_M_OV_CURR_A << i, 0);
                        if (ret < 0) {
                                dev_err(chip->dev,
                                        "Failed to update mask reg: %d\n", ret);
@@ -387,20 +388,6 @@ static int da9211_regulator_init(struct da9211 *chip)
        return 0;
 }
 
-static const struct i2c_device_id da9211_i2c_id[] = {
-       {"da9211", DA9211},
-       {"da9213", DA9213},
-       {},
-};
-
-#ifdef CONFIG_OF
-static const struct of_device_id da9211_dt_ids[] = {
-       { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
-       { .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
-       {},
-};
-#endif
-
 /*
  * I2C driver interface functions
  */
@@ -478,12 +465,27 @@ static int da9211_i2c_probe(struct i2c_client *i2c,
        return ret;
 }
 
+static const struct i2c_device_id da9211_i2c_id[] = {
+       {"da9211", DA9211},
+       {"da9213", DA9213},
+       {},
+};
 MODULE_DEVICE_TABLE(i2c, da9211_i2c_id);
 
+#ifdef CONFIG_OF
+static const struct of_device_id da9211_dt_ids[] = {
+       { .compatible = "dlg,da9211", .data = &da9211_i2c_id[0] },
+       { .compatible = "dlg,da9213", .data = &da9211_i2c_id[1] },
+       {},
+};
+MODULE_DEVICE_TABLE(of, da9211_dt_ids);
+#endif
+
 static struct i2c_driver da9211_regulator_driver = {
        .driver = {
                .name = "da9211",
                .owner = THIS_MODULE,
+               .of_match_table = of_match_ptr(da9211_dt_ids),
        },
        .probe = da9211_i2c_probe,
        .id_table = da9211_i2c_id,