summaryrefslogtreecommitdiff
path: root/drivers/iio/accel/adxl345_core.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-02-22 12:00:05 +0300
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-02-26 22:11:13 +0300
commit266be7cb11c75f930a5902bc6199ff50ca4282a1 (patch)
treebc4abdbe4cf19b8f00ccaed874e37faf7cc9c34f /drivers/iio/accel/adxl345_core.c
parentc1db3d5cab03a79947736c44fd33f19f234b14a0 (diff)
downloadlinux-266be7cb11c75f930a5902bc6199ff50ca4282a1.tar.xz
iio: accel: adxl345: Make use of device properties
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Tested-by: Kai-Heng Feng <kai.heng.feng@canonical.com> Link: https://lore.kernel.org/r/20220222090009.2060-4-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/accel/adxl345_core.c')
-rw-r--r--drivers/iio/accel/adxl345_core.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/iio/accel/adxl345_core.c b/drivers/iio/accel/adxl345_core.c
index 0f34c349aa1e..315a408115b3 100644
--- a/drivers/iio/accel/adxl345_core.c
+++ b/drivers/iio/accel/adxl345_core.c
@@ -8,6 +8,7 @@
*/
#include <linux/module.h>
+#include <linux/property.h>
#include <linux/regmap.h>
#include <linux/iio/iio.h>
@@ -213,14 +214,16 @@ static void adxl345_powerdown(void *regmap)
regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY);
}
-int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type)
+int adxl345_core_probe(struct device *dev, struct regmap *regmap)
{
+ enum adxl345_device_type type;
struct adxl345_data *data;
struct iio_dev *indio_dev;
const char *name;
u32 regval;
int ret;
+ type = (uintptr_t)device_get_match_data(dev);
switch (type) {
case ADXL345:
name = "adxl345";