return len;
 }
 
+/*
+ * Set current LSB to 1mA, shunt is in uOhms
+ * (equation 13 in datasheet). We hardcode a Current_LSB
+ * of 1.0 x10-6. The only remaining parameter is RShunt.
+ * There is no need to expose the CALIBRATION register
+ * to the user for now. But we need to reset this register
+ * if the user updates RShunt after driver init, e.g upon
+ * reading an EEPROM/Probe-type value.
+ */
+static int ina2xx_set_calibration(struct ina2xx_chip_info *chip)
+{
+       u16 regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor,
+                                  chip->shunt_resistor);
+
+       return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval);
+}
+
 static int set_shunt_resistor(struct ina2xx_chip_info *chip, unsigned int val)
 {
        if (val <= 0 || val > chip->config->calibration_factor)
        if (ret)
                return ret;
 
+       /* Update the Calibration register */
+       ret = ina2xx_set_calibration(chip);
+       if (ret)
+               return ret;
+
        return len;
 }
 
 /* Initialize the configuration and calibration registers. */
 static int ina2xx_init(struct ina2xx_chip_info *chip, unsigned int config)
 {
-       u16 regval;
-       int ret;
-
-       ret = regmap_write(chip->regmap, INA2XX_CONFIG, config);
+       int ret = regmap_write(chip->regmap, INA2XX_CONFIG, config);
        if (ret)
                return ret;
 
-       /*
-        * Set current LSB to 1mA, shunt is in uOhms
-        * (equation 13 in datasheet). We hardcode a Current_LSB
-        * of 1.0 x10-6. The only remaining parameter is RShunt.
-        * There is no need to expose the CALIBRATION register
-        * to the user for now.
-        */
-       regval = DIV_ROUND_CLOSEST(chip->config->calibration_factor,
-                                  chip->shunt_resistor);
-
-       return regmap_write(chip->regmap, INA2XX_CALIBRATION, regval);
+       return ina2xx_set_calibration(chip);
 }
 
 static int ina2xx_probe(struct i2c_client *client,