mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 12:21:22 -05:00
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>
This commit is contained in:
committed by
Jonathan Cameron
parent
6f3d8de888
commit
db52c405f3
@@ -11,6 +11,12 @@
|
||||
#include <linux/pm.h>
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#define BMA220_REG_WDT 0x17
|
||||
#define BMA220_WDT_MASK GENMASK(2, 1)
|
||||
#define BMA220_WDT_OFF 0x0
|
||||
#define BMA220_WDT_1MS 0x2
|
||||
#define BMA220_WDT_10MS 0x3
|
||||
|
||||
struct device;
|
||||
|
||||
extern const struct regmap_config bma220_i2c_regmap_config;
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
#include <linux/cleanup.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
@@ -78,11 +77,6 @@
|
||||
#define BMA220_FILTER_MASK GENMASK(3, 0)
|
||||
#define BMA220_REG_RANGE 0x11
|
||||
#define BMA220_RANGE_MASK GENMASK(1, 0)
|
||||
#define BMA220_REG_WDT 0x17
|
||||
#define BMA220_WDT_MASK GENMASK(2, 1)
|
||||
#define BMA220_WDT_OFF 0x0
|
||||
#define BMA220_WDT_1MS 0x2
|
||||
#define BMA220_WDT_10MS 0x3
|
||||
#define BMA220_REG_SUSPEND 0x18
|
||||
#define BMA220_REG_SOFTRESET 0x19
|
||||
|
||||
@@ -443,12 +437,6 @@ static int bma220_power(struct bma220_data *data, bool up)
|
||||
return -EBUSY;
|
||||
}
|
||||
|
||||
static int bma220_set_wdt(struct bma220_data *data, const u8 val)
|
||||
{
|
||||
return regmap_update_bits(data->regmap, BMA220_REG_WDT, BMA220_WDT_MASK,
|
||||
FIELD_PREP(BMA220_WDT_MASK, val));
|
||||
}
|
||||
|
||||
static int bma220_init(struct device *dev, struct bma220_data *data)
|
||||
{
|
||||
int ret;
|
||||
@@ -477,13 +465,6 @@ static int bma220_init(struct device *dev, struct bma220_data *data)
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret, "Failed to soft reset chip\n");
|
||||
|
||||
if (i2c_verify_client(dev)) {
|
||||
ret = bma220_set_wdt(data, BMA220_WDT_1MS);
|
||||
if (ret)
|
||||
return dev_err_probe(dev, ret,
|
||||
"Failed to set i2c watchdog\n");
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* I2C address is either 0x0b or 0x0a depending on CSB (pin 10)
|
||||
*/
|
||||
|
||||
#include <linux/bitfield.h>
|
||||
#include <linux/i2c.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
@@ -16,16 +17,27 @@
|
||||
|
||||
#include "bma220.h"
|
||||
|
||||
static int bma220_set_wdt(struct regmap *regmap, const u8 val)
|
||||
{
|
||||
return regmap_update_bits(regmap, BMA220_REG_WDT, BMA220_WDT_MASK,
|
||||
FIELD_PREP(BMA220_WDT_MASK, val));
|
||||
}
|
||||
|
||||
static int bma220_i2c_probe(struct i2c_client *client)
|
||||
{
|
||||
struct regmap *regmap;
|
||||
int ret;
|
||||
|
||||
regmap = devm_regmap_init_i2c(client, &bma220_i2c_regmap_config);
|
||||
if (IS_ERR(regmap))
|
||||
return dev_err_probe(&client->dev, PTR_ERR(regmap),
|
||||
"failed to create regmap\n");
|
||||
|
||||
return bma220_common_probe(&client->dev, regmap, client->irq);
|
||||
ret = bma220_common_probe(&client->dev, regmap, client->irq);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return bma220_set_wdt(regmap, BMA220_WDT_1MS);
|
||||
}
|
||||
|
||||
static const struct of_device_id bma220_i2c_match[] = {
|
||||
|
||||
Reference in New Issue
Block a user