Commit b586b40e authored by Petre Rodan's avatar Petre Rodan Committed by Jonathan Cameron

iio: pressure: mprls0025pa remove defaults

This driver supports 32*3 combinations of fixed ranges and transfer
functions, plus custom ranges.

So statistically a user has more than 99% chance that the provided
default configuration will generate invalid pressure readings if the
bindings are not initialized and the driver is instantiated via sysfs.

The current patch removes this loophole making sure the driver loads
only if the firmware properties are present.
Co-developed-by: default avatarAndreas Klinger <ak@it-klinger.de>
Signed-off-by: default avatarAndreas Klinger <ak@it-klinger.de>
Signed-off-by: default avatarPetre Rodan <petre.rodan@subdimension.ro>
Link: https://lore.kernel.org/r/20231229092445.30180-7-petre.rodan@subdimension.roSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 0a0fb0e6
...@@ -353,7 +353,6 @@ static int mpr_probe(struct i2c_client *client) ...@@ -353,7 +353,6 @@ static int mpr_probe(struct i2c_client *client)
return dev_err_probe(dev, ret, return dev_err_probe(dev, ret,
"can't get and enable vdd supply\n"); "can't get and enable vdd supply\n");
if (dev_fwnode(dev)) {
ret = device_property_read_u32(dev, "honeywell,pmin-pascal", ret = device_property_read_u32(dev, "honeywell,pmin-pascal",
&data->pmin); &data->pmin);
if (ret) if (ret)
...@@ -374,13 +373,6 @@ static int mpr_probe(struct i2c_client *client) ...@@ -374,13 +373,6 @@ static int mpr_probe(struct i2c_client *client)
return dev_err_probe(dev, -EINVAL, return dev_err_probe(dev, -EINVAL,
"honeywell,transfer-function %d invalid\n", "honeywell,transfer-function %d invalid\n",
data->function); data->function);
} else {
/* when loaded as i2c device we need to use default values */
dev_notice(dev, "firmware node not found; using defaults\n");
data->pmin = 0;
data->pmax = 172369; /* 25 psi */
data->function = MPR_FUNCTION_A;
}
data->outmin = mpr_func_spec[data->function].output_min; data->outmin = mpr_func_spec[data->function].output_min;
data->outmax = mpr_func_spec[data->function].output_max; data->outmax = mpr_func_spec[data->function].output_max;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment