[xlnx:xlnx_rebase_v5.4 1277/1704] drivers/gpio/gpio-xilinx.c:94:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast

kernel test robot lkp at intel.com
Wed Apr 7 14:08:23 BST 2021


Hi Michal,

FYI, the error/warning still remains.

tree:   https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.4
head:   914337937cb6a106a2942347d8c8feacd2223299
commit: af0c19b6f15388c554317280433100fd9f3d7d0a [1277/1704] gpio: xilinx: Use xilinx tested gpio driver
config: x86_64-randconfig-s022-20210407 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.3-279-g6d5d9b42-dirty
        # https://github.com/Xilinx/linux-xlnx/commit/af0c19b6f15388c554317280433100fd9f3d7d0a
        git remote add xlnx https://github.com/Xilinx/linux-xlnx
        git fetch --no-tags xlnx xlnx_rebase_v5.4
        git checkout af0c19b6f15388c554317280433100fd9f3d7d0a
        # save the attached .config to linux build tree
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64 

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>

All warnings (new ones prefixed by >>):

   drivers/gpio/gpio-xilinx.c:68:25: error: field 'mmchip' has incomplete type
      68 |  struct of_mm_gpio_chip mmchip;
         |                         ^~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_get':
   drivers/gpio/gpio-xilinx.c:94:34: error: implicit declaration of function 'to_of_mm_gpio_chip' [-Werror=implicit-function-declaration]
      94 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
>> drivers/gpio/gpio-xilinx.c:94:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   In file included from arch/x86/include/asm/bitops.h:16,
                    from include/linux/bitops.h:26,
                    from drivers/gpio/gpio-xilinx.c:15:
   include/linux/kernel.h:994:32: error: dereferencing pointer to incomplete type 'struct of_mm_gpio_chip'
     994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                                ^~~~~~
   include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
     330 |   if (!(condition))     \
         |         ^~~~~~~~~
   include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
     350 |  _compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
         |  ^~~~~~~~~~~~~~~~~~~
   include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
      39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
         |                                     ^~~~~~~~~~~~~~~~~~
   include/linux/kernel.h:994:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
     994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |  ^~~~~~~~~~~~~~~~
   include/linux/kernel.h:994:20: note: in expansion of macro '__same_type'
     994 |  BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
         |                    ^~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c:96:6: note: in expansion of macro 'container_of'
      96 |      container_of(mm_gc, struct xgpio_instance, mmchip);
         |      ^~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_set':
   drivers/gpio/gpio-xilinx.c:115:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     115 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_set_multiple':
   drivers/gpio/gpio-xilinx.c:147:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     147 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_dir_in':
   drivers/gpio/gpio-xilinx.c:187:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     187 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_dir_out':
   drivers/gpio/gpio-xilinx.c:218:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     218 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_xlate':
   drivers/gpio/gpio-xilinx.c:274:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     274 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c:277:8: error: 'struct gpio_chip' has no member named 'of_gpio_n_cells'
     277 |  if (gc->of_gpio_n_cells == 3 && flags)
         |        ^~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_irq_mask':
   drivers/gpio/gpio-xilinx.c:315:12: warning: conversion from 'long unsigned int' to 'unsigned int' changes value from '18446744071562067967' to '2147483647' [-Woverflow]
     315 |            ~XGPIO_GIER_IE);
   drivers/gpio/gpio-xilinx.c:50:51: note: in definition of macro 'xgpio_writereg'
      50 | # define xgpio_writereg(offset, val) __raw_writel(val, offset)
         |                                                   ^~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_to_irq':
   drivers/gpio/gpio-xilinx.c:392:34: warning: initialization of 'struct of_mm_gpio_chip *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
     392 |  struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
         |                                  ^~~~~~~~~~~~~~~~~~
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_remove':
   drivers/gpio/gpio-xilinx.c:576:2: error: implicit declaration of function 'of_mm_gpiochip_remove'; did you mean 'gpiochip_remove'? [-Werror=implicit-function-declaration]
     576 |  of_mm_gpiochip_remove(&chip->mmchip);
         |  ^~~~~~~~~~~~~~~~~~~~~
         |  gpiochip_remove
   drivers/gpio/gpio-xilinx.c: In function 'xgpio_of_probe':
   drivers/gpio/gpio-xilinx.c:676:11: error: implicit declaration of function 'of_mm_gpiochip_add'; did you mean 'gpiochip_add'? [-Werror=implicit-function-declaration]
     676 |  status = of_mm_gpiochip_add(np, &chip->mmchip);
         |           ^~~~~~~~~~~~~~~~~~
         |           gpiochip_add
   cc1: some warnings being treated as errors


vim +94 drivers/gpio/gpio-xilinx.c

    52	
    53	/**
    54	 * struct xgpio_instance - Stores information about GPIO device
    55	 * @mmchip: OF GPIO chip for memory mapped banks
    56	 * @mmchip_dual: Pointer to the OF dual gpio chip
    57	 * @gpio_state: GPIO state shadow register
    58	 * @gpio_dir: GPIO direction shadow register
    59	 * @offset: GPIO channel offset
    60	 * @irq_base: GPIO channel irq base address
    61	 * @irq_enable: GPIO irq enable/disable bitfield
    62	 * @no_init: No intitialisation at probe
    63	 * @gpio_lock: Lock used for synchronization
    64	 * @irq_domain: irq_domain of the controller
    65	 * @clk: clock resource for this driver
    66	 */
    67	struct xgpio_instance {
  > 68		struct of_mm_gpio_chip mmchip;
    69		struct of_mm_gpio_chip *mmchip_dual;
    70		u32 gpio_state;
    71		u32 gpio_dir;
    72		u32 offset;
    73		int irq_base;
    74		u32 irq_enable;
    75		bool no_init;
    76		spinlock_t gpio_lock;
    77		struct irq_domain *irq_domain;
    78		struct clk *clk;
    79	};
    80	
    81	/**
    82	 * xgpio_get - Read the specified signal of the GPIO device.
    83	 * @gc:     Pointer to gpio_chip device structure.
    84	 * @gpio:   GPIO signal number.
    85	 *
    86	 * This function reads the specified signal of the GPIO device.
    87	 *
    88	 * Return:
    89	 * 0 if direction of GPIO signals is set as input otherwise it
    90	 * returns negative error value.
    91	 */
    92	static int xgpio_get(struct gpio_chip *gc, unsigned int gpio)
    93	{
  > 94		struct of_mm_gpio_chip *mm_gc = to_of_mm_gpio_chip(gc);
    95		struct xgpio_instance *chip =
    96		    container_of(mm_gc, struct xgpio_instance, mmchip);
    97	
    98		void __iomem *regs = mm_gc->regs + chip->offset;
    99	
   100		return !!(xgpio_readreg(regs + XGPIO_DATA_OFFSET) & BIT(gpio));
   101	}
   102	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 31327 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20210407/648d690b/attachment-0001.gz>


More information about the linux-arm-kernel mailing list