Subject: [xlnx:master 9636/9981] drivers/mtd/spi-nor/spi-nor.c:5196:14: error: implicit declaration of function 'of_get_next_parent'

From: kbuild test robot <[email-masked]>
Date: Fri, 3 Apr 2020 18:56:02 +0800

tree:   https://github.com/Xilinx/linux-xlnx master
head:   9d6f04f3b34bc4fc65d301a7dbf9acdd0d39923c
commit: b5be635d3544589973bdf42e3ee94deabaf45711 [9636/9981] mtd: spi-nor: Added axi-qspi support in spi-nor framework
config: x86_64-randconfig-c003-20200403 (attached as .config)
compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project f68cc2a7ed766965028b8b0f0d9300a0460c3cf1)
reproduce:
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        git checkout b5be635d3544589973bdf42e3ee94deabaf45711
        # save the attached .config to linux build tree
        COMPILER=clang make.cross ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <[email-masked]>

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

>> drivers/mtd/spi-nor/spi-nor.c:5196:14: error: implicit declaration of function 'of_get_next_parent' [-Werror,-Wimplicit-function-declaration]
                                   np_spi = of_get_next_parent(np);
                                            ^
>> drivers/mtd/spi-nor/spi-nor.c:5196:12: warning: incompatible integer to pointer conversion assigning to 'struct device_node *' from 'int' [-Wint-conversion]
                                   np_spi = of_get_next_parent(np);
                                          ^ ~~~~~~~~~~~~~~~~~~~~~~
   drivers/mtd/spi-nor/spi-nor.c:5266:11: error: returning 'const struct flash_info *' from a function with result type 'struct flash_info *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
                           return jinfo;
                                  ^~~~~
   drivers/mtd/spi-nor/spi-nor.c:5281:9: error: returning 'const struct flash_info *' from a function with result type 'struct flash_info *' discards qualifiers [-Werror,-Wincompatible-pointer-types-discards-qualifiers]
           return info;
                  ^~~~
   drivers/mtd/spi-nor/spi-nor.c:5295:6: warning: unused variable 'is_dual' [-Wunused-variable]
           u32 is_dual;
               ^
   drivers/mtd/spi-nor/spi-nor.c:5294:22: warning: unused variable 'np_spi' [-Wunused-variable]
           struct device_node *np_spi;
                               ^
   3 warnings and 3 errors generated.

vim +/of_get_next_parent +5196 drivers/mtd/spi-nor/spi-nor.c

  5162	
  5163	static int spi_nor_set_addr_width(struct spi_nor *nor)
  5164	{
  5165		struct device_node *np = spi_nor_get_flash_node(nor);
  5166		struct device_node *np_spi;
  5167		if (nor->addr_width) {
  5168			/* already configured from SFDP */
  5169		} else if (nor->info->addr_width) {
  5170			nor->addr_width = nor->info->addr_width;
  5171		} else if (nor->mtd.size > 0x1000000) {
  5172	#ifdef CONFIG_OF
  5173			np_spi = of_get_next_parent(np);
  5174			if (of_property_match_string(np_spi, "compatible",
  5175						     "xlnx,zynq-qspi-1.0") >= 0) {
  5176				int status;
  5177	
  5178				nor->addr_width = 3;
  5179				nor->params.set_4byte(nor, false);
  5180				status = read_ear(nor, (struct flash_info *)nor->info);
  5181				if (status < 0)
  5182					dev_warn(nor->dev, "failed to read ear reg\n");
  5183				else
  5184					nor->curbank = status & EAR_SEGMENT_MASK;
  5185			} else {
  5186	#endif
  5187				/*
  5188				 * enable 4-byte addressing if the
  5189				 * device exceeds 16MiB
  5190				 */
  5191				nor->addr_width = 4;
  5192				if (JEDEC_MFR(nor->info) == SNOR_MFR_SPANSION ||
  5193				    nor->info->flags & SPI_NOR_4B_OPCODES) {
  5194					spi_nor_set_4byte_opcodes(nor);
  5195				} else {
> 5196					np_spi = of_get_next_parent(np);
  5197					if (of_property_match_string(np_spi,
  5198								     "compatible",
  5199								     "xlnx,xps-spi-2.00.a") >= 0) {
  5200						nor->addr_width = 3;
  5201						nor->params.set_4byte(nor, false);
  5202					} else {
  5203						nor->params.set_4byte(nor, true);
  5204						if (nor->isstacked) {
  5205							nor->spi->master->flags |=
  5206								SPI_MASTER_U_PAGE;
  5207							nor->params.set_4byte(nor, true);
  5208							nor->spi->master->flags &=
  5209								~SPI_MASTER_U_PAGE;
  5210						}
  5211					}
  5212				}
  5213	#ifdef CONFIG_OF
  5214			}
  5215	#endif
  5216		} else {
  5217			nor->addr_width = 3;
  5218		}
  5219	
  5220		if (nor->addr_width > SPI_NOR_MAX_ADDR_WIDTH) {
  5221			dev_err(nor->dev, "address width is too large: %u\n",
  5222				nor->addr_width);
  5223			return -EINVAL;
  5224		}
  5225	
  5226		/* Set 4byte opcodes when possible. */
  5227		if (nor->addr_width == 4 && nor->flags & SNOR_F_4B_OPCODES &&
  5228		    !(nor->flags & SNOR_F_HAS_4BAIT))
  5229			spi_nor_set_4byte_opcodes(nor);
  5230	
  5231		return 0;
  5232	}
  5233	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email-masked]
_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel