2016-03-28 17:22:42

by Tirdea, Irina

[permalink] [raw]
Subject: [PATCH v2 1/1] iio: accel: bmc150: use common definition for regmap conf

bmc150_i2c_regmap_conf is defined three times (in bmc150-accel-core.c,
bmc150-accel-i2c.c and and bmc150-accel-spi.c), although the
definition is the same.

Use one common definition for bmc150_i2c_regmap_conf in all
included files.

Signed-off-by: Irina Tirdea <[email protected]>
---

Changes from v1:
- instead of removing the unused definition from the core,
share it between the i2c and spi files
- renamed the subject line from "iio: accel: bmc150: remove
unused definition" to better reflect the new change

drivers/iio/accel/bmc150-accel-core.c | 3 ++-
drivers/iio/accel/bmc150-accel-i2c.c | 5 -----
drivers/iio/accel/bmc150-accel-spi.c | 6 ------
drivers/iio/accel/bmc150-accel.h | 1 +
4 files changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/accel/bmc150-accel-core.c b/drivers/iio/accel/bmc150-accel-core.c
index f3d096f..14d0ee6 100644
--- a/drivers/iio/accel/bmc150-accel-core.c
+++ b/drivers/iio/accel/bmc150-accel-core.c
@@ -246,11 +246,12 @@ static const struct {
{500000, BMC150_ACCEL_SLEEP_500_MS},
{1000000, BMC150_ACCEL_SLEEP_1_SEC} };

-static const struct regmap_config bmc150_i2c_regmap_conf = {
+const struct regmap_config bmc150_i2c_regmap_conf = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0x3f,
};
+EXPORT_SYMBOL_GPL(bmc150_i2c_regmap_conf);

static int bmc150_accel_set_mode(struct bmc150_accel_data *data,
enum bmc150_power_modes mode,
diff --git a/drivers/iio/accel/bmc150-accel-i2c.c b/drivers/iio/accel/bmc150-accel-i2c.c
index b41404b..4852ecb 100644
--- a/drivers/iio/accel/bmc150-accel-i2c.c
+++ b/drivers/iio/accel/bmc150-accel-i2c.c
@@ -28,11 +28,6 @@

#include "bmc150-accel.h"

-static const struct regmap_config bmc150_i2c_regmap_conf = {
- .reg_bits = 8,
- .val_bits = 8,
-};
-
static int bmc150_accel_probe(struct i2c_client *client,
const struct i2c_device_id *id)
{
diff --git a/drivers/iio/accel/bmc150-accel-spi.c b/drivers/iio/accel/bmc150-accel-spi.c
index 16b66f2..e89f460 100644
--- a/drivers/iio/accel/bmc150-accel-spi.c
+++ b/drivers/iio/accel/bmc150-accel-spi.c
@@ -25,12 +25,6 @@

#include "bmc150-accel.h"

-static const struct regmap_config bmc150_spi_regmap_conf = {
- .reg_bits = 8,
- .val_bits = 8,
- .max_register = 0x3f,
-};
-
static int bmc150_accel_probe(struct spi_device *spi)
{
struct regmap *regmap;
diff --git a/drivers/iio/accel/bmc150-accel.h b/drivers/iio/accel/bmc150-accel.h
index ba03359..f2fe611 100644
--- a/drivers/iio/accel/bmc150-accel.h
+++ b/drivers/iio/accel/bmc150-accel.h
@@ -16,5 +16,6 @@ int bmc150_accel_core_probe(struct device *dev, struct regmap *regmap, int irq,
const char *name, bool block_supported);
int bmc150_accel_core_remove(struct device *dev);
extern const struct dev_pm_ops bmc150_accel_pm_ops;
+extern const struct regmap_config bmc150_i2c_regmap_conf;

#endif /* _BMC150_ACCEL_H_ */
--
1.9.1


2016-03-28 17:42:44

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH v2 1/1] iio: accel: bmc150: use common definition for regmap conf

Hi Irina,

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.6-rc1 next-20160327]
[if your patch is applied to the wrong git tree, please drop us a note to help improving the system]

url: https://github.com/0day-ci/linux/commits/Irina-Tirdea/iio-accel-bmc150-use-common-definition-for-regmap-conf/20160329-012449
base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: xtensa-allyesconfig (attached as .config)
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=xtensa

All error/warnings (new ones prefixed by >>):

In file included from drivers/iio/accel/bmc150-accel-spi.c:23:0:
drivers/iio/accel/bmc150-accel-spi.c: In function 'bmc150_accel_probe':
>> drivers/iio/accel/bmc150-accel-spi.c:33:38: error: 'bmc150_spi_regmap_conf' undeclared (first use in this function)
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
^
include/linux/regmap.h:436:6: note: in definition of macro '__regmap_lockdep_wrapper'
fn(__VA_ARGS__, &_key, \
^
>> drivers/iio/accel/bmc150-accel-spi.c:33:11: note: in expansion of macro 'devm_regmap_init_spi'
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
^
drivers/iio/accel/bmc150-accel-spi.c:33:38: note: each undeclared identifier is reported only once for each function it appears in
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
^
include/linux/regmap.h:436:6: note: in definition of macro '__regmap_lockdep_wrapper'
fn(__VA_ARGS__, &_key, \
^
>> drivers/iio/accel/bmc150-accel-spi.c:33:11: note: in expansion of macro 'devm_regmap_init_spi'
regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
^

vim +/bmc150_spi_regmap_conf +33 drivers/iio/accel/bmc150-accel-spi.c

f9ab96e2 Markus Pargmann 2015-09-21 17 */
f9ab96e2 Markus Pargmann 2015-09-21 18
f9ab96e2 Markus Pargmann 2015-09-21 19 #include <linux/device.h>
f9ab96e2 Markus Pargmann 2015-09-21 20 #include <linux/mod_devicetable.h>
f9ab96e2 Markus Pargmann 2015-09-21 21 #include <linux/module.h>
f9ab96e2 Markus Pargmann 2015-09-21 22 #include <linux/acpi.h>
f9ab96e2 Markus Pargmann 2015-09-21 @23 #include <linux/regmap.h>
f9ab96e2 Markus Pargmann 2015-09-21 24 #include <linux/spi/spi.h>
f9ab96e2 Markus Pargmann 2015-09-21 25
f9ab96e2 Markus Pargmann 2015-09-21 26 #include "bmc150-accel.h"
f9ab96e2 Markus Pargmann 2015-09-21 27
f9ab96e2 Markus Pargmann 2015-09-21 28 static int bmc150_accel_probe(struct spi_device *spi)
f9ab96e2 Markus Pargmann 2015-09-21 29 {
f9ab96e2 Markus Pargmann 2015-09-21 30 struct regmap *regmap;
f9ab96e2 Markus Pargmann 2015-09-21 31 const struct spi_device_id *id = spi_get_device_id(spi);
f9ab96e2 Markus Pargmann 2015-09-21 32
f9ab96e2 Markus Pargmann 2015-09-21 @33 regmap = devm_regmap_init_spi(spi, &bmc150_spi_regmap_conf);
f9ab96e2 Markus Pargmann 2015-09-21 34 if (IS_ERR(regmap)) {
f9ab96e2 Markus Pargmann 2015-09-21 35 dev_err(&spi->dev, "Failed to initialize spi regmap\n");
f9ab96e2 Markus Pargmann 2015-09-21 36 return PTR_ERR(regmap);

:::::: The code at line 33 was first introduced by commit
:::::: f9ab96e212808123fbd9072d580a59194e5cd410 iio: bmc150: Add SPI driver

:::::: TO: Markus Pargmann <[email protected]>
:::::: CC: Jonathan Cameron <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation


Attachments:
(No filename) (3.71 kB)
.config.gz (43.11 kB)
Download all attachments