Commit b892770a authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: Drop Duplicated "mount-matrix" parameter

All of the users of iio_read_mount_matrix() are using the very same
property name. Moreover, the property name is hard coded in the API
documentation.

Make this clear and avoid duplication now and in the future.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarSean Nyekjaer <sean@geanix.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210518112546.44592-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 941f1308
......@@ -1001,8 +1001,7 @@ static int bma180_probe(struct i2c_client *client,
chip = id->driver_data;
data->part_info = &bma180_part_info[chip];
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -811,7 +811,7 @@ int bma400_probe(struct device *dev, struct regmap *regmap, const char *name)
if (ret)
return ret;
ret = iio_read_mount_matrix(dev, "mount-matrix", &data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -1685,8 +1685,7 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
data->regmap = regmap;
if (!bmc150_apply_acpi_orientation(dev, &data->orientation)) {
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
}
......
......@@ -862,7 +862,7 @@ int fxls8962af_core_probe(struct device *dev, struct regmap *regmap, int irq)
dev_set_drvdata(dev, indio_dev);
data->regmap = regmap;
ret = iio_read_mount_matrix(dev, "mount-matrix", &data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -1455,8 +1455,7 @@ static int kxcjk1013_probe(struct i2c_client *client,
} else {
data->active_high_intr = true; /* default polarity */
ret = iio_read_mount_matrix(&client->dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(&client->dev, &data->orientation);
if (ret)
return ret;
}
......
......@@ -420,7 +420,7 @@ int kxsd9_common_probe(struct device *dev,
indio_dev->available_scan_masks = kxsd9_scan_masks;
/* Read the mounting matrix, if present */
ret = iio_read_mount_matrix(dev, "mount-matrix", &st->orientation);
ret = iio_read_mount_matrix(dev, &st->orientation);
if (ret)
return ret;
......
......@@ -1106,8 +1106,7 @@ int bmg160_core_probe(struct device *dev, struct regmap *regmap, int irq,
if (ret)
return ret;
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -308,8 +308,7 @@ static int itg3200_probe(struct i2c_client *client,
st = iio_priv(indio_dev);
ret = iio_read_mount_matrix(&client->dev, "mount-matrix",
&st->orientation);
ret = iio_read_mount_matrix(&client->dev, &st->orientation);
if (ret)
return ret;
......
......@@ -1164,7 +1164,7 @@ int mpu3050_common_probe(struct device *dev,
mpu3050->divisor = 99;
/* Read the mounting matrix, if present */
ret = iio_read_mount_matrix(dev, "mount-matrix", &mpu3050->orientation);
ret = iio_read_mount_matrix(dev, &mpu3050->orientation);
if (ret)
return ret;
......
......@@ -852,8 +852,7 @@ int bmi160_core_probe(struct device *dev, struct regmap *regmap,
return ret;
}
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -592,7 +592,7 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
st->chip = chip;
st->map = regmap;
ret = iio_read_mount_matrix(dev, "mount-matrix", &st->orientation);
ret = iio_read_mount_matrix(dev, &st->orientation);
if (ret) {
dev_err(dev, "failed to retrieve mounting matrix %d\n", ret);
return ret;
......
......@@ -1455,8 +1455,7 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
pdata = dev_get_platdata(dev);
if (!pdata) {
result = iio_read_mount_matrix(dev, "mount-matrix",
&st->orientation);
result = iio_read_mount_matrix(dev, &st->orientation);
if (result) {
dev_err(dev, "Failed to retrieve mounting matrix %d\n",
result);
......
......@@ -2256,7 +2256,7 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id,
return err;
}
err = iio_read_mount_matrix(hw->dev, "mount-matrix", &hw->orientation);
err = iio_read_mount_matrix(hw->dev, &hw->orientation);
if (err)
return err;
......
......@@ -617,7 +617,6 @@ EXPORT_SYMBOL_GPL(iio_show_mount_matrix);
* iio_read_mount_matrix() - retrieve iio device mounting matrix from
* device "mount-matrix" property
* @dev: device the mounting matrix property is assigned to
* @propname: device specific mounting matrix property name
* @matrix: where to store retrieved matrix
*
* If device is assigned no mounting matrix property, a default 3x3 identity
......@@ -625,14 +624,12 @@ EXPORT_SYMBOL_GPL(iio_show_mount_matrix);
*
* Return: 0 if success, or a negative error code on failure.
*/
int iio_read_mount_matrix(struct device *dev, const char *propname,
struct iio_mount_matrix *matrix)
int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix)
{
size_t len = ARRAY_SIZE(iio_mount_idmatrix.rotation);
int err;
err = device_property_read_string_array(dev, propname,
matrix->rotation, len);
err = device_property_read_string_array(dev, "mount-matrix", matrix->rotation, len);
if (err == len)
return 0;
......
......@@ -833,8 +833,7 @@ static int ak8974_probe(struct i2c_client *i2c,
ak8974->i2c = i2c;
mutex_init(&ak8974->lock);
ret = iio_read_mount_matrix(&i2c->dev, "mount-matrix",
&ak8974->orientation);
ret = iio_read_mount_matrix(&i2c->dev, &ak8974->orientation);
if (ret)
return ret;
......
......@@ -890,7 +890,7 @@ static int ak8975_probe(struct i2c_client *client,
data->reset_gpiod = reset_gpiod;
data->eoc_irq = 0;
err = iio_read_mount_matrix(&client->dev, "mount-matrix", &data->orientation);
err = iio_read_mount_matrix(&client->dev, &data->orientation);
if (err)
return err;
......
......@@ -890,8 +890,7 @@ int bmc150_magn_probe(struct device *dev, struct regmap *regmap,
if (ret)
return dev_err_probe(dev, ret, "failed to get regulators\n");
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -637,8 +637,7 @@ int hmc5843_common_probe(struct device *dev, struct regmap *regmap,
data->variant = &hmc5843_chip_info_tbl[id];
mutex_init(&data->lock);
ret = iio_read_mount_matrix(dev, "mount-matrix",
&data->orientation);
ret = iio_read_mount_matrix(dev, &data->orientation);
if (ret)
return ret;
......
......@@ -831,7 +831,7 @@ static int yas5xx_probe(struct i2c_client *i2c,
yas5xx->dev = dev;
mutex_init(&yas5xx->lock);
ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation);
ret = iio_read_mount_matrix(dev, &yas5xx->orientation);
if (ret)
return ret;
......
......@@ -127,8 +127,7 @@ struct iio_mount_matrix {
ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv,
const struct iio_chan_spec *chan, char *buf);
int iio_read_mount_matrix(struct device *dev, const char *propname,
struct iio_mount_matrix *matrix);
int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix);
typedef const struct iio_mount_matrix *
(iio_get_mount_matrix_t)(const struct iio_dev *indio_dev,
......
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