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: bma220: move set_wdt() out of bma220_core

Move bma220_set_wdt() into bma220_i2c.c instead of using a conditional
based on i2c_verify_client() in bma220_core.c that would make core
always depend on the i2c module.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202510102117.Jqxrw1vF-lkp@intel.com/
Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Petre Rodan and committed by
Jonathan Cameron
db52c405 6f3d8de8

+19 -20
+6
drivers/iio/accel/bma220.h
··· 11 11 #include <linux/pm.h> 12 12 #include <linux/regmap.h> 13 13 14 + #define BMA220_REG_WDT 0x17 15 + #define BMA220_WDT_MASK GENMASK(2, 1) 16 + #define BMA220_WDT_OFF 0x0 17 + #define BMA220_WDT_1MS 0x2 18 + #define BMA220_WDT_10MS 0x3 19 + 14 20 struct device; 15 21 16 22 extern const struct regmap_config bma220_i2c_regmap_config;
-19
drivers/iio/accel/bma220_core.c
··· 11 11 #include <linux/cleanup.h> 12 12 #include <linux/device.h> 13 13 #include <linux/errno.h> 14 - #include <linux/i2c.h> 15 14 #include <linux/mod_devicetable.h> 16 15 #include <linux/module.h> 17 16 #include <linux/mutex.h> ··· 77 78 #define BMA220_FILTER_MASK GENMASK(3, 0) 78 79 #define BMA220_REG_RANGE 0x11 79 80 #define BMA220_RANGE_MASK GENMASK(1, 0) 80 - #define BMA220_REG_WDT 0x17 81 - #define BMA220_WDT_MASK GENMASK(2, 1) 82 - #define BMA220_WDT_OFF 0x0 83 - #define BMA220_WDT_1MS 0x2 84 - #define BMA220_WDT_10MS 0x3 85 81 #define BMA220_REG_SUSPEND 0x18 86 82 #define BMA220_REG_SOFTRESET 0x19 87 83 ··· 437 443 return -EBUSY; 438 444 } 439 445 440 - static int bma220_set_wdt(struct bma220_data *data, const u8 val) 441 - { 442 - return regmap_update_bits(data->regmap, BMA220_REG_WDT, BMA220_WDT_MASK, 443 - FIELD_PREP(BMA220_WDT_MASK, val)); 444 - } 445 - 446 446 static int bma220_init(struct device *dev, struct bma220_data *data) 447 447 { 448 448 int ret; ··· 464 476 ret = bma220_reset(data, true); 465 477 if (ret) 466 478 return dev_err_probe(dev, ret, "Failed to soft reset chip\n"); 467 - 468 - if (i2c_verify_client(dev)) { 469 - ret = bma220_set_wdt(data, BMA220_WDT_1MS); 470 - if (ret) 471 - return dev_err_probe(dev, ret, 472 - "Failed to set i2c watchdog\n"); 473 - } 474 479 475 480 return 0; 476 481 }
+13 -1
drivers/iio/accel/bma220_i2c.c
··· 8 8 * I2C address is either 0x0b or 0x0a depending on CSB (pin 10) 9 9 */ 10 10 11 + #include <linux/bitfield.h> 11 12 #include <linux/i2c.h> 12 13 #include <linux/mod_devicetable.h> 13 14 #include <linux/module.h> ··· 17 16 18 17 #include "bma220.h" 19 18 19 + static int bma220_set_wdt(struct regmap *regmap, const u8 val) 20 + { 21 + return regmap_update_bits(regmap, BMA220_REG_WDT, BMA220_WDT_MASK, 22 + FIELD_PREP(BMA220_WDT_MASK, val)); 23 + } 24 + 20 25 static int bma220_i2c_probe(struct i2c_client *client) 21 26 { 22 27 struct regmap *regmap; 28 + int ret; 23 29 24 30 regmap = devm_regmap_init_i2c(client, &bma220_i2c_regmap_config); 25 31 if (IS_ERR(regmap)) 26 32 return dev_err_probe(&client->dev, PTR_ERR(regmap), 27 33 "failed to create regmap\n"); 28 34 29 - return bma220_common_probe(&client->dev, regmap, client->irq); 35 + ret = bma220_common_probe(&client->dev, regmap, client->irq); 36 + if (ret) 37 + return ret; 38 + 39 + return bma220_set_wdt(regmap, BMA220_WDT_1MS); 30 40 } 31 41 32 42 static const struct of_device_id bma220_i2c_match[] = {