if (ret)
return -EINVAL;
+ /*
+ * Previously, this sysfs parameter used a different raw-register
+ * format. All legal values in this format fall numerically into the
+ * range [0, 1023]. Since in the new format, these encode values so
+ * low as to be meaningless, reject them here so that anybody trying
+ * to use the old format will have at least a chance of figuring out
+ * why it isn't working any more. Note that in both formats, the value
+ * 0 has the same meaning, so it is allowed where values in the range
+ * [1, 1023] are not.
+ */
+ if (new_current < 1024 && new_current != 0)
+ return -EINVAL;
+
ret = update_charge_parameters(bci, new_current, -1);
if (ret)
return ret;