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: Get rid of name parameter in adxl345_core_probe()

As a preparation to switch to use device properties, get rid of name
parameter in adxl345_core_probe(). Instead, choose it based on the type.

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

authored by

Andy Shevchenko and committed by
Jonathan Cameron
c1db3d5c 024f5d4f

+16 -7
+1 -2
drivers/iio/accel/adxl345.h
··· 13 13 ADXL375 = 2, 14 14 }; 15 15 16 - int adxl345_core_probe(struct device *dev, struct regmap *regmap, 17 - enum adxl345_device_type type, const char *name); 16 + int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type); 18 17 19 18 #endif /* _ADXL345_H_ */
+13 -2
drivers/iio/accel/adxl345_core.c
··· 213 213 regmap_write(regmap, ADXL345_REG_POWER_CTL, ADXL345_POWER_CTL_STANDBY); 214 214 } 215 215 216 - int adxl345_core_probe(struct device *dev, struct regmap *regmap, 217 - enum adxl345_device_type type, const char *name) 216 + int adxl345_core_probe(struct device *dev, struct regmap *regmap, enum adxl345_device_type type) 218 217 { 219 218 struct adxl345_data *data; 220 219 struct iio_dev *indio_dev; 220 + const char *name; 221 221 u32 regval; 222 222 int ret; 223 + 224 + switch (type) { 225 + case ADXL345: 226 + name = "adxl345"; 227 + break; 228 + case ADXL375: 229 + name = "adxl375"; 230 + break; 231 + default: 232 + return -EINVAL; 233 + } 223 234 224 235 ret = regmap_read(regmap, ADXL345_REG_DEVID, &regval); 225 236 if (ret < 0)
+1 -2
drivers/iio/accel/adxl345_i2c.c
··· 31 31 if (IS_ERR(regmap)) 32 32 return dev_err_probe(&client->dev, PTR_ERR(regmap), "Error initializing regmap\n"); 33 33 34 - return adxl345_core_probe(&client->dev, regmap, id->driver_data, 35 - id->name); 34 + return adxl345_core_probe(&client->dev, regmap, id->driver_data); 36 35 } 37 36 38 37 static const struct i2c_device_id adxl345_i2c_id[] = {
+1 -1
drivers/iio/accel/adxl345_spi.c
··· 34 34 if (IS_ERR(regmap)) 35 35 return dev_err_probe(&spi->dev, PTR_ERR(regmap), "Error initializing regmap\n"); 36 36 37 - return adxl345_core_probe(&spi->dev, regmap, id->driver_data, id->name); 37 + return adxl345_core_probe(&spi->dev, regmap, id->driver_data); 38 38 } 39 39 40 40 static const struct spi_device_id adxl345_spi_id[] = {