Re: [PATCH 1/2] iio: chemical: bme680: Add device-tree support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Sebastien,

Thank you for the patch! Yet something to improve:

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

url:    https://github.com/0day-ci/linux/commits/Sebastien-Bourdelin/iio-chemical-bme680-Add-device-tree-support/20190114-063618
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: i386-randconfig-x007-201902 (attached as .config)
compiler: gcc-7 (Debian 7.3.0-1) 7.3.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

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

   In file included from include/linux/acpi.h:41:0,
                    from drivers/iio/chemical/bme680_spi.c:7:
   include/linux/module.h:213:1: error: expected ',' or ';' before 'extern'
    extern typeof(name) __mod_##type##__##name##_device_table  \
    ^
>> drivers/iio/chemical/bme680_spi.c:117:1: note: in expansion of macro 'MODULE_DEVICE_TABLE'
    MODULE_DEVICE_TABLE(of, bme680_of_spi_match);
    ^~~~~~~~~~~~~~~~~~~
>> drivers/iio/chemical/bme680_spi.c:123:22: error: implicit declaration of function 'of_match_ptr'; did you mean 'hash_ptr'? [-Werror=implicit-function-declaration]
      .of_match_table  = of_match_ptr(bme680_of_spi_match),
                         ^~~~~~~~~~~~
                         hash_ptr
>> drivers/iio/chemical/bme680_spi.c:123:22: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   drivers/iio/chemical/bme680_spi.c:123:22: note: (near initialization for 'bme680_spi_driver.driver.of_match_table')
>> drivers/iio/chemical/bme680_spi.c:123:22: error: initializer element is not constant
   drivers/iio/chemical/bme680_spi.c:123:22: note: (near initialization for 'bme680_spi_driver.driver.of_match_table')
   cc1: some warnings being treated as errors

vim +123 drivers/iio/chemical/bme680_spi.c

   > 7	#include <linux/acpi.h>
     8	#include <linux/module.h>
     9	#include <linux/regmap.h>
    10	#include <linux/spi/spi.h>
    11	
    12	#include "bme680.h"
    13	
    14	static int bme680_regmap_spi_write(void *context, const void *data,
    15					   size_t count)
    16	{
    17		struct spi_device *spi = context;
    18		u8 buf[2];
    19	
    20		memcpy(buf, data, 2);
    21		/*
    22		 * The SPI register address (= full register address without bit 7)
    23		 * and the write command (bit7 = RW = '0')
    24		 */
    25		buf[0] &= ~0x80;
    26	
    27		return spi_write_then_read(spi, buf, 2, NULL, 0);
    28	}
    29	
    30	static int bme680_regmap_spi_read(void *context, const void *reg,
    31					  size_t reg_size, void *val, size_t val_size)
    32	{
    33		struct spi_device *spi = context;
    34	
    35		return spi_write_then_read(spi, reg, reg_size, val, val_size);
    36	}
    37	
    38	static struct regmap_bus bme680_regmap_bus = {
    39		.write = bme680_regmap_spi_write,
    40		.read = bme680_regmap_spi_read,
    41		.reg_format_endian_default = REGMAP_ENDIAN_BIG,
    42		.val_format_endian_default = REGMAP_ENDIAN_BIG,
    43	};
    44	
    45	static int bme680_spi_probe(struct spi_device *spi)
    46	{
    47		const struct spi_device_id *id = spi_get_device_id(spi);
    48		struct regmap *regmap;
    49		unsigned int val;
    50		int ret;
    51	
    52		spi->bits_per_word = 8;
    53		ret = spi_setup(spi);
    54		if (ret < 0) {
    55			dev_err(&spi->dev, "spi_setup failed!\n");
    56			return ret;
    57		}
    58	
    59		regmap = devm_regmap_init(&spi->dev, &bme680_regmap_bus,
    60					  &spi->dev, &bme680_regmap_config);
    61		if (IS_ERR(regmap)) {
    62			dev_err(&spi->dev, "Failed to register spi regmap %d\n",
    63					(int)PTR_ERR(regmap));
    64			return PTR_ERR(regmap);
    65		}
    66	
    67		ret = regmap_write(regmap, BME680_REG_SOFT_RESET_SPI,
    68				   BME680_CMD_SOFTRESET);
    69		if (ret < 0) {
    70			dev_err(&spi->dev, "Failed to reset chip\n");
    71			return ret;
    72		}
    73	
    74		/* after power-on reset, Page 0(0x80-0xFF) of spi_mem_page is active */
    75		ret = regmap_read(regmap, BME680_REG_CHIP_SPI_ID, &val);
    76		if (ret < 0) {
    77			dev_err(&spi->dev, "Error reading SPI chip ID\n");
    78			return ret;
    79		}
    80	
    81		if (val != BME680_CHIP_ID_VAL) {
    82			dev_err(&spi->dev, "Wrong chip ID, got %x expected %x\n",
    83					val, BME680_CHIP_ID_VAL);
    84			return -ENODEV;
    85		}
    86		/*
    87		 * select Page 1 of spi_mem_page to enable access to
    88		 * to registers from address 0x00 to 0x7F.
    89		 */
    90		ret = regmap_write_bits(regmap, BME680_REG_STATUS,
    91					BME680_SPI_MEM_PAGE_BIT,
    92					BME680_SPI_MEM_PAGE_1_VAL);
    93		if (ret < 0) {
    94			dev_err(&spi->dev, "failed to set page 1 of spi_mem_page\n");
    95			return ret;
    96		}
    97	
    98		return bme680_core_probe(&spi->dev, regmap, id->name);
    99	}
   100	
   101	static const struct spi_device_id bme680_spi_id[] = {
   102		{"bme680", 0},
   103		{},
   104	};
   105	MODULE_DEVICE_TABLE(spi, bme680_spi_id);
   106	
   107	static const struct acpi_device_id bme680_acpi_match[] = {
   108		{"BME0680", 0},
   109		{},
   110	};
   111	MODULE_DEVICE_TABLE(acpi, bme680_acpi_match);
   112	
   113	static const struct of_device_id bme680_of_spi_match[] = {
   114		{ .compatible = "bosch,bme680", },
   115		{},
   116	}
 > 117	MODULE_DEVICE_TABLE(of, bme680_of_spi_match);
   118	
   119	static struct spi_driver bme680_spi_driver = {
   120		.driver = {
   121			.name			= "bme680_spi",
   122			.acpi_match_table	= ACPI_PTR(bme680_acpi_match),
 > 123			.of_match_table		= of_match_ptr(bme680_of_spi_match),
   124		},
   125		.probe = bme680_spi_probe,
   126		.id_table = bme680_spi_id,
   127	};
   128	module_spi_driver(bme680_spi_driver);
   129	

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

Attachment: .config.gz
Description: application/gzip


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux