Re: [PATCH] rtc: i2c/spi: Avoid inclusion of REGMAP support when not needed

From: kbuild test robot
Date: Sun Jan 12 2020 - 16:46:42 EST


Hi Geert,

I love your patch! Yet something to improve:

[auto build test ERROR on abelloni/rtc-next]
[also build test ERROR on v5.5-rc5 next-20200110]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url: https://github.com/0day-ci/linux/commits/Geert-Uytterhoeven/rtc-i2c-spi-Avoid-inclusion-of-REGMAP-support-when-not-needed/20200113-013332
base: https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git rtc-next
config: powerpc-defconfig (attached as .config)
compiler: powerpc64-linux-gcc (GCC) 7.5.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.5.0 make.cross ARCH=powerpc

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

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

>> drivers/rtc/rtc-ds1307.c:1570:21: error: variable 'regmap_config' has initializer but incomplete type
static const struct regmap_config regmap_config = {
^~~~~~~~~~~~~
>> drivers/rtc/rtc-ds1307.c:1571:3: error: 'const struct regmap_config' has no member named 'reg_bits'
.reg_bits = 8,
^~~~~~~~
>> drivers/rtc/rtc-ds1307.c:1571:14: warning: excess elements in struct initializer
.reg_bits = 8,
^
drivers/rtc/rtc-ds1307.c:1571:14: note: (near initialization for 'regmap_config')
>> drivers/rtc/rtc-ds1307.c:1572:3: error: 'const struct regmap_config' has no member named 'val_bits'
.val_bits = 8,
^~~~~~~~
drivers/rtc/rtc-ds1307.c:1572:14: warning: excess elements in struct initializer
.val_bits = 8,
^
drivers/rtc/rtc-ds1307.c:1572:14: note: (near initialization for 'regmap_config')
drivers/rtc/rtc-ds1307.c: In function 'ds1307_probe':
>> drivers/rtc/rtc-ds1307.c:1596:19: error: implicit declaration of function 'devm_regmap_init_i2c'; did you mean 'devm_request_irq'? [-Werror=implicit-function-declaration]
ds1307->regmap = devm_regmap_init_i2c(client, &regmap_config);
^~~~~~~~~~~~~~~~~~~~
devm_request_irq
>> drivers/rtc/rtc-ds1307.c:1596:17: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
ds1307->regmap = devm_regmap_init_i2c(client, &regmap_config);
^
drivers/rtc/rtc-ds1307.c: At top level:
>> drivers/rtc/rtc-ds1307.c:1570:35: error: storage size of 'regmap_config' isn't known
static const struct regmap_config regmap_config = {
^~~~~~~~~~~~~
cc1: some warnings being treated as errors

vim +/regmap_config +1570 drivers/rtc/rtc-ds1307.c

445c02076f1e60 Akinobu Mita 2016-01-25 1569
11e5890b5342c8 Heiner Kallweit 2017-03-10 @1570 static const struct regmap_config regmap_config = {
11e5890b5342c8 Heiner Kallweit 2017-03-10 @1571 .reg_bits = 8,
11e5890b5342c8 Heiner Kallweit 2017-03-10 @1572 .val_bits = 8,
11e5890b5342c8 Heiner Kallweit 2017-03-10 1573 };
11e5890b5342c8 Heiner Kallweit 2017-03-10 1574
5a167f4543e45d Greg Kroah-Hartman 2012-12-21 1575 static int ds1307_probe(struct i2c_client *client,
d2653e92732bd3 Jean Delvare 2008-04-29 1576 const struct i2c_device_id *id)
1abb0dc92d706e David Brownell 2006-06-25 1577 {
1abb0dc92d706e David Brownell 2006-06-25 1578 struct ds1307 *ds1307;
1abb0dc92d706e David Brownell 2006-06-25 1579 int err = -ENODEV;
584ce30c72954e Heiner Kallweit 2017-08-29 1580 int tmp;
7624df482d7aba Heiner Kallweit 2017-07-12 1581 const struct chip_desc *chip;
82e2d43f6315d7 Heiner Kallweit 2017-07-12 1582 bool want_irq;
8bc2a40730ec74 Michael Lange 2016-01-21 1583 bool ds1307_can_wakeup_device = false;
042fa8c7c04dd4 Alexandre Belloni 2017-09-04 1584 unsigned char regs[8];
01ce893d37f053 Jingoo Han 2013-11-12 1585 struct ds1307_platform_data *pdata = dev_get_platdata(&client->dev);
d8490fd55ab90e Heiner Kallweit 2017-07-12 1586 u8 trickle_charger_setup = 0;
1abb0dc92d706e David Brownell 2006-06-25 1587
edca66d2ceae6b Jingoo Han 2013-07-03 1588 ds1307 = devm_kzalloc(&client->dev, sizeof(struct ds1307), GFP_KERNEL);
40ce972d59fcfd David Anders 2012-03-23 1589 if (!ds1307)
c065f35c179290 David Brownell 2007-07-17 1590 return -ENOMEM;
045e0e85f2f6ee David Brownell 2007-07-17 1591
11e5890b5342c8 Heiner Kallweit 2017-03-10 1592 dev_set_drvdata(&client->dev, ds1307);
11e5890b5342c8 Heiner Kallweit 2017-03-10 1593 ds1307->dev = &client->dev;
11e5890b5342c8 Heiner Kallweit 2017-03-10 1594 ds1307->name = client->name;
33df2ee1bb59b8 Joakim Tjernlund 2009-06-17 1595
11e5890b5342c8 Heiner Kallweit 2017-03-10 @1596 ds1307->regmap = devm_regmap_init_i2c(client, &regmap_config);
11e5890b5342c8 Heiner Kallweit 2017-03-10 1597 if (IS_ERR(ds1307->regmap)) {
11e5890b5342c8 Heiner Kallweit 2017-03-10 1598 dev_err(ds1307->dev, "regmap allocation failed\n");
11e5890b5342c8 Heiner Kallweit 2017-03-10 1599 return PTR_ERR(ds1307->regmap);
11e5890b5342c8 Heiner Kallweit 2017-03-10 1600 }
11e5890b5342c8 Heiner Kallweit 2017-03-10 1601
11e5890b5342c8 Heiner Kallweit 2017-03-10 1602 i2c_set_clientdata(client, ds1307);
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1603
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1604 if (client->dev.of_node) {
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1605 ds1307->type = (enum ds_type)
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1606 of_device_get_match_data(&client->dev);
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1607 chip = &chips[ds1307->type];
7ef6d2c266e5b0 Javier Martinez Canillas 2017-03-03 1608 } else if (id) {
9c19b8930d2cf9 Tin Huynh 2016-11-30 1609 chip = &chips[id->driver_data];
3760f736716f74 Jean Delvare 2008-04-29 1610 ds1307->type = id->driver_data;
9c19b8930d2cf9 Tin Huynh 2016-11-30 1611 } else {
9c19b8930d2cf9 Tin Huynh 2016-11-30 1612 const struct acpi_device_id *acpi_id;
9c19b8930d2cf9 Tin Huynh 2016-11-30 1613
9c19b8930d2cf9 Tin Huynh 2016-11-30 1614 acpi_id = acpi_match_device(ACPI_PTR(ds1307_acpi_ids),
11e5890b5342c8 Heiner Kallweit 2017-03-10 1615 ds1307->dev);
9c19b8930d2cf9 Tin Huynh 2016-11-30 1616 if (!acpi_id)
9c19b8930d2cf9 Tin Huynh 2016-11-30 1617 return -ENODEV;
9c19b8930d2cf9 Tin Huynh 2016-11-30 1618 chip = &chips[acpi_id->driver_data];
9c19b8930d2cf9 Tin Huynh 2016-11-30 1619 ds1307->type = acpi_id->driver_data;
9c19b8930d2cf9 Tin Huynh 2016-11-30 1620 }
33df2ee1bb59b8 Joakim Tjernlund 2009-06-17 1621
82e2d43f6315d7 Heiner Kallweit 2017-07-12 1622 want_irq = client->irq > 0 && chip->alarm;
82e2d43f6315d7 Heiner Kallweit 2017-07-12 1623
9c19b8930d2cf9 Tin Huynh 2016-11-30 1624 if (!pdata)
d8490fd55ab90e Heiner Kallweit 2017-07-12 1625 trickle_charger_setup = ds1307_trickle_init(ds1307, chip);
9c19b8930d2cf9 Tin Huynh 2016-11-30 1626 else if (pdata->trickle_charger_setup)
d8490fd55ab90e Heiner Kallweit 2017-07-12 1627 trickle_charger_setup = pdata->trickle_charger_setup;
33b04b7b7c03d0 Matti Vaittinen 2014-10-13 1628
d8490fd55ab90e Heiner Kallweit 2017-07-12 1629 if (trickle_charger_setup && chip->trickle_charger_reg) {
d8490fd55ab90e Heiner Kallweit 2017-07-12 1630 trickle_charger_setup |= DS13XX_TRICKLE_CHARGER_MAGIC;
11e5890b5342c8 Heiner Kallweit 2017-03-10 1631 dev_dbg(ds1307->dev,
11e5890b5342c8 Heiner Kallweit 2017-03-10 1632 "writing trickle charger info 0x%x to 0x%x\n",
d8490fd55ab90e Heiner Kallweit 2017-07-12 1633 trickle_charger_setup, chip->trickle_charger_reg);
11e5890b5342c8 Heiner Kallweit 2017-03-10 1634 regmap_write(ds1307->regmap, chip->trickle_charger_reg,
d8490fd55ab90e Heiner Kallweit 2017-07-12 1635 trickle_charger_setup);
33b04b7b7c03d0 Matti Vaittinen 2014-10-13 1636 }
eb86c3064b3c53 Wolfram Sang 2012-05-29 1637

:::::: The code at line 1570 was first introduced by commit
:::::: 11e5890b5342c82eefbaa39aec4767ae21ae8803 rtc: ds1307: convert driver to regmap

:::::: TO: Heiner Kallweit <hkallweit1@xxxxxxxxx>
:::::: CC: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip