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

Configure Feed

Select the types of activity you want to include in your feed.

iio: accel: adxl345: Set driver_data for OF enumeration

In order to enable this driver on mode platforms, assign driver_data
field in the OF device ID table.

While at it, make sure that device type is not 0 which may be wrongly
interpreted by device property APIs in the future.

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-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
024f5d4f 01676b0f

+6 -6
+2 -2
drivers/iio/accel/adxl345.h
··· 9 9 #define _ADXL345_H_ 10 10 11 11 enum adxl345_device_type { 12 - ADXL345, 13 - ADXL375, 12 + ADXL345 = 1, 13 + ADXL375 = 2, 14 14 }; 15 15 16 16 int adxl345_core_probe(struct device *dev, struct regmap *regmap,
+2 -2
drivers/iio/accel/adxl345_i2c.c
··· 44 44 MODULE_DEVICE_TABLE(i2c, adxl345_i2c_id); 45 45 46 46 static const struct of_device_id adxl345_of_match[] = { 47 - { .compatible = "adi,adxl345" }, 48 - { .compatible = "adi,adxl375" }, 47 + { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, 48 + { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, 49 49 { }, 50 50 }; 51 51
+2 -2
drivers/iio/accel/adxl345_spi.c
··· 46 46 MODULE_DEVICE_TABLE(spi, adxl345_spi_id); 47 47 48 48 static const struct of_device_id adxl345_of_match[] = { 49 - { .compatible = "adi,adxl345" }, 50 - { .compatible = "adi,adxl375" }, 49 + { .compatible = "adi,adxl345", .data = (const void *)ADXL345 }, 50 + { .compatible = "adi,adxl375", .data = (const void *)ADXL375 }, 51 51 { }, 52 52 }; 53 53