Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Sean Nyekjaer <sean@geanix.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20210518112546.44592-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
b892770a 941f1308

+21 -35
+1 -2
drivers/iio/accel/bma180.c
··· 1001 1001 chip = id->driver_data; 1002 1002 data->part_info = &bma180_part_info[chip]; 1003 1003 1004 - ret = iio_read_mount_matrix(dev, "mount-matrix", 1005 - &data->orientation); 1004 + ret = iio_read_mount_matrix(dev, &data->orientation); 1006 1005 if (ret) 1007 1006 return ret; 1008 1007
+1 -1
drivers/iio/accel/bma400_core.c
··· 811 811 if (ret) 812 812 return ret; 813 813 814 - ret = iio_read_mount_matrix(dev, "mount-matrix", &data->orientation); 814 + ret = iio_read_mount_matrix(dev, &data->orientation); 815 815 if (ret) 816 816 return ret; 817 817
+1 -2
drivers/iio/accel/bmc150-accel-core.c
··· 1685 1685 data->regmap = regmap; 1686 1686 1687 1687 if (!bmc150_apply_acpi_orientation(dev, &data->orientation)) { 1688 - ret = iio_read_mount_matrix(dev, "mount-matrix", 1689 - &data->orientation); 1688 + ret = iio_read_mount_matrix(dev, &data->orientation); 1690 1689 if (ret) 1691 1690 return ret; 1692 1691 }
+1 -1
drivers/iio/accel/fxls8962af-core.c
··· 862 862 dev_set_drvdata(dev, indio_dev); 863 863 data->regmap = regmap; 864 864 865 - ret = iio_read_mount_matrix(dev, "mount-matrix", &data->orientation); 865 + ret = iio_read_mount_matrix(dev, &data->orientation); 866 866 if (ret) 867 867 return ret; 868 868
+1 -2
drivers/iio/accel/kxcjk-1013.c
··· 1455 1455 } else { 1456 1456 data->active_high_intr = true; /* default polarity */ 1457 1457 1458 - ret = iio_read_mount_matrix(&client->dev, "mount-matrix", 1459 - &data->orientation); 1458 + ret = iio_read_mount_matrix(&client->dev, &data->orientation); 1460 1459 if (ret) 1461 1460 return ret; 1462 1461 }
+1 -1
drivers/iio/accel/kxsd9.c
··· 420 420 indio_dev->available_scan_masks = kxsd9_scan_masks; 421 421 422 422 /* Read the mounting matrix, if present */ 423 - ret = iio_read_mount_matrix(dev, "mount-matrix", &st->orientation); 423 + ret = iio_read_mount_matrix(dev, &st->orientation); 424 424 if (ret) 425 425 return ret; 426 426
+1 -2
drivers/iio/gyro/bmg160_core.c
··· 1106 1106 if (ret) 1107 1107 return ret; 1108 1108 1109 - ret = iio_read_mount_matrix(dev, "mount-matrix", 1110 - &data->orientation); 1109 + ret = iio_read_mount_matrix(dev, &data->orientation); 1111 1110 if (ret) 1112 1111 return ret; 1113 1112
+1 -2
drivers/iio/gyro/itg3200_core.c
··· 308 308 309 309 st = iio_priv(indio_dev); 310 310 311 - ret = iio_read_mount_matrix(&client->dev, "mount-matrix", 312 - &st->orientation); 311 + ret = iio_read_mount_matrix(&client->dev, &st->orientation); 313 312 if (ret) 314 313 return ret; 315 314
+1 -1
drivers/iio/gyro/mpu3050-core.c
··· 1164 1164 mpu3050->divisor = 99; 1165 1165 1166 1166 /* Read the mounting matrix, if present */ 1167 - ret = iio_read_mount_matrix(dev, "mount-matrix", &mpu3050->orientation); 1167 + ret = iio_read_mount_matrix(dev, &mpu3050->orientation); 1168 1168 if (ret) 1169 1169 return ret; 1170 1170
+1 -2
drivers/iio/imu/bmi160/bmi160_core.c
··· 852 852 return ret; 853 853 } 854 854 855 - ret = iio_read_mount_matrix(dev, "mount-matrix", 856 - &data->orientation); 855 + ret = iio_read_mount_matrix(dev, &data->orientation); 857 856 if (ret) 858 857 return ret; 859 858
+1 -1
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
··· 592 592 st->chip = chip; 593 593 st->map = regmap; 594 594 595 - ret = iio_read_mount_matrix(dev, "mount-matrix", &st->orientation); 595 + ret = iio_read_mount_matrix(dev, &st->orientation); 596 596 if (ret) { 597 597 dev_err(dev, "failed to retrieve mounting matrix %d\n", ret); 598 598 return ret;
+1 -2
drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
··· 1455 1455 1456 1456 pdata = dev_get_platdata(dev); 1457 1457 if (!pdata) { 1458 - result = iio_read_mount_matrix(dev, "mount-matrix", 1459 - &st->orientation); 1458 + result = iio_read_mount_matrix(dev, &st->orientation); 1460 1459 if (result) { 1461 1460 dev_err(dev, "Failed to retrieve mounting matrix %d\n", 1462 1461 result);
+1 -1
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c
··· 2256 2256 return err; 2257 2257 } 2258 2258 2259 - err = iio_read_mount_matrix(hw->dev, "mount-matrix", &hw->orientation); 2259 + err = iio_read_mount_matrix(hw->dev, &hw->orientation); 2260 2260 if (err) 2261 2261 return err; 2262 2262
+2 -5
drivers/iio/industrialio-core.c
··· 617 617 * iio_read_mount_matrix() - retrieve iio device mounting matrix from 618 618 * device "mount-matrix" property 619 619 * @dev: device the mounting matrix property is assigned to 620 - * @propname: device specific mounting matrix property name 621 620 * @matrix: where to store retrieved matrix 622 621 * 623 622 * If device is assigned no mounting matrix property, a default 3x3 identity ··· 624 625 * 625 626 * Return: 0 if success, or a negative error code on failure. 626 627 */ 627 - int iio_read_mount_matrix(struct device *dev, const char *propname, 628 - struct iio_mount_matrix *matrix) 628 + int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix) 629 629 { 630 630 size_t len = ARRAY_SIZE(iio_mount_idmatrix.rotation); 631 631 int err; 632 632 633 - err = device_property_read_string_array(dev, propname, 634 - matrix->rotation, len); 633 + err = device_property_read_string_array(dev, "mount-matrix", matrix->rotation, len); 635 634 if (err == len) 636 635 return 0; 637 636
+1 -2
drivers/iio/magnetometer/ak8974.c
··· 833 833 ak8974->i2c = i2c; 834 834 mutex_init(&ak8974->lock); 835 835 836 - ret = iio_read_mount_matrix(&i2c->dev, "mount-matrix", 837 - &ak8974->orientation); 836 + ret = iio_read_mount_matrix(&i2c->dev, &ak8974->orientation); 838 837 if (ret) 839 838 return ret; 840 839
+1 -1
drivers/iio/magnetometer/ak8975.c
··· 890 890 data->reset_gpiod = reset_gpiod; 891 891 data->eoc_irq = 0; 892 892 893 - err = iio_read_mount_matrix(&client->dev, "mount-matrix", &data->orientation); 893 + err = iio_read_mount_matrix(&client->dev, &data->orientation); 894 894 if (err) 895 895 return err; 896 896
+1 -2
drivers/iio/magnetometer/bmc150_magn.c
··· 890 890 if (ret) 891 891 return dev_err_probe(dev, ret, "failed to get regulators\n"); 892 892 893 - ret = iio_read_mount_matrix(dev, "mount-matrix", 894 - &data->orientation); 893 + ret = iio_read_mount_matrix(dev, &data->orientation); 895 894 if (ret) 896 895 return ret; 897 896
+1 -2
drivers/iio/magnetometer/hmc5843_core.c
··· 637 637 data->variant = &hmc5843_chip_info_tbl[id]; 638 638 mutex_init(&data->lock); 639 639 640 - ret = iio_read_mount_matrix(dev, "mount-matrix", 641 - &data->orientation); 640 + ret = iio_read_mount_matrix(dev, &data->orientation); 642 641 if (ret) 643 642 return ret; 644 643
+1 -1
drivers/iio/magnetometer/yamaha-yas530.c
··· 831 831 yas5xx->dev = dev; 832 832 mutex_init(&yas5xx->lock); 833 833 834 - ret = iio_read_mount_matrix(dev, "mount-matrix", &yas5xx->orientation); 834 + ret = iio_read_mount_matrix(dev, &yas5xx->orientation); 835 835 if (ret) 836 836 return ret; 837 837
+1 -2
include/linux/iio/iio.h
··· 127 127 128 128 ssize_t iio_show_mount_matrix(struct iio_dev *indio_dev, uintptr_t priv, 129 129 const struct iio_chan_spec *chan, char *buf); 130 - int iio_read_mount_matrix(struct device *dev, const char *propname, 131 - struct iio_mount_matrix *matrix); 130 + int iio_read_mount_matrix(struct device *dev, struct iio_mount_matrix *matrix); 132 131 133 132 typedef const struct iio_mount_matrix * 134 133 (iio_get_mount_matrix_t)(const struct iio_dev *indio_dev,