drivers/leds/blink/leds-lgm-sso.c:123:19: error: field has incomplete type 'struct gpio_chip'
From: kernel test robot
Date: Sat Feb 27 2021 - 14:19:38 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5695e51619745d4fe3ec2506a2f0cd982c5e27a4
commit: c3987cd2bca34ddfec69027acedb2fae5ffcf7a0 leds: lgm: Add LED controller driver for LGM SoC
date: 8 days ago
config: powerpc64-randconfig-r002-20210227 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 83bc7815c4235786111aa2abf7193292e4a602f5)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc64 cross compiling tool for clang build
# apt-get install binutils-powerpc64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c3987cd2bca34ddfec69027acedb2fae5ffcf7a0
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout c3987cd2bca34ddfec69027acedb2fae5ffcf7a0
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc64
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
All error/warnings (new ones prefixed by >>):
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:43:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insb, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:62:1: note: expanded from here
__do_insb
^
arch/powerpc/include/asm/io.h:556:56: note: expanded from macro '__do_insb'
#define __do_insb(p, b, n) readsb((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/leds/blink/leds-lgm-sso.c:18:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:45:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insw, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:64:1: note: expanded from here
__do_insw
^
arch/powerpc/include/asm/io.h:557:56: note: expanded from macro '__do_insw'
#define __do_insw(p, b, n) readsw((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/leds/blink/leds-lgm-sso.c:18:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:47:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(insl, (unsigned long p, void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:66:1: note: expanded from here
__do_insl
^
arch/powerpc/include/asm/io.h:558:56: note: expanded from macro '__do_insl'
#define __do_insl(p, b, n) readsl((PCI_IO_ADDR)_IO_BASE+(p), (b), (n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/leds/blink/leds-lgm-sso.c:18:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:49:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsb, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:68:1: note: expanded from here
__do_outsb
^
arch/powerpc/include/asm/io.h:559:58: note: expanded from macro '__do_outsb'
#define __do_outsb(p, b, n) writesb((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/leds/blink/leds-lgm-sso.c:18:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:51:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsw, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:70:1: note: expanded from here
__do_outsw
^
arch/powerpc/include/asm/io.h:560:58: note: expanded from macro '__do_outsw'
#define __do_outsw(p, b, n) writesw((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
In file included from drivers/leds/blink/leds-lgm-sso.c:18:
In file included from include/linux/regmap.h:20:
In file included from include/linux/iopoll.h:14:
In file included from include/linux/io.h:13:
In file included from arch/powerpc/include/asm/io.h:619:
arch/powerpc/include/asm/io-defs.h:53:1: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
DEF_PCI_AC_NORET(outsl, (unsigned long p, const void *b, unsigned long c),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
arch/powerpc/include/asm/io.h:616:3: note: expanded from macro 'DEF_PCI_AC_NORET'
__do_##name al; \
^~~~~~~~~~~~~~
<scratch space>:72:1: note: expanded from here
__do_outsl
^
arch/powerpc/include/asm/io.h:561:58: note: expanded from macro '__do_outsl'
#define __do_outsl(p, b, n) writesl((PCI_IO_ADDR)_IO_BASE+(p),(b),(n))
~~~~~~~~~~~~~~~~~~~~~^
>> drivers/leds/blink/leds-lgm-sso.c:123:19: error: field has incomplete type 'struct gpio_chip'
struct gpio_chip chip;
^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
>> drivers/leds/blink/leds-lgm-sso.c:263:3: error: implicit declaration of function 'gpiod_set_value' [-Werror,-Wimplicit-function-declaration]
gpiod_set_value(led->gpiod, val);
^
drivers/leds/blink/leds-lgm-sso.c:263:3: note: did you mean 'gpio_set_value'?
include/linux/gpio.h:168:20: note: 'gpio_set_value' declared here
static inline void gpio_set_value(unsigned gpio, int value)
^
drivers/leds/blink/leds-lgm-sso.c:345:3: error: implicit declaration of function 'gpiod_set_value' [-Werror,-Wimplicit-function-declaration]
gpiod_set_value(led->gpiod, 1);
^
>> drivers/leds/blink/leds-lgm-sso.c:405:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror,-Wimplicit-function-declaration]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^
>> drivers/leds/blink/leds-lgm-sso.c:405:23: warning: incompatible integer to pointer conversion initializing 'struct sso_led_priv *' with an expression of type 'int' [-Wint-conversion]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^ ~~~~~~~~~~~~~~~~~~~~~~~
drivers/leds/blink/leds-lgm-sso.c:418:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror,-Wimplicit-function-declaration]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^
drivers/leds/blink/leds-lgm-sso.c:418:23: warning: incompatible integer to pointer conversion initializing 'struct sso_led_priv *' with an expression of type 'int' [-Wint-conversion]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^ ~~~~~~~~~~~~~~~~~~~~~~~
drivers/leds/blink/leds-lgm-sso.c:432:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror,-Wimplicit-function-declaration]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^
drivers/leds/blink/leds-lgm-sso.c:432:23: warning: incompatible integer to pointer conversion initializing 'struct sso_led_priv *' with an expression of type 'int' [-Wint-conversion]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^ ~~~~~~~~~~~~~~~~~~~~~~~
drivers/leds/blink/leds-lgm-sso.c:445:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror,-Wimplicit-function-declaration]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^
drivers/leds/blink/leds-lgm-sso.c:445:23: warning: incompatible integer to pointer conversion initializing 'struct sso_led_priv *' with an expression of type 'int' [-Wint-conversion]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^ ~~~~~~~~~~~~~~~~~~~~~~~
drivers/leds/blink/leds-lgm-sso.c:455:30: error: implicit declaration of function 'gpiochip_get_data' [-Werror,-Wimplicit-function-declaration]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^
drivers/leds/blink/leds-lgm-sso.c:455:23: warning: incompatible integer to pointer conversion initializing 'struct sso_led_priv *' with an expression of type 'int' [-Wint-conversion]
struct sso_led_priv *priv = gpiochip_get_data(chip);
^ ~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/leds/blink/leds-lgm-sso.c:467:4: error: incomplete definition of type 'struct gpio_chip'
gc->request = sso_gpio_request;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:468:4: error: incomplete definition of type 'struct gpio_chip'
gc->free = sso_gpio_free;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:469:4: error: incomplete definition of type 'struct gpio_chip'
gc->get_direction = sso_gpio_get_dir;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:470:4: error: incomplete definition of type 'struct gpio_chip'
gc->direction_output = sso_gpio_dir_out;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:471:4: error: incomplete definition of type 'struct gpio_chip'
gc->get = sso_gpio_get;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:472:4: error: incomplete definition of type 'struct gpio_chip'
gc->set = sso_gpio_set;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:474:4: error: incomplete definition of type 'struct gpio_chip'
gc->label = "lgm-sso";
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:475:4: error: incomplete definition of type 'struct gpio_chip'
gc->base = -1;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:477:4: error: incomplete definition of type 'struct gpio_chip'
gc->ngpio = priv->gpio.pins;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:478:4: error: incomplete definition of type 'struct gpio_chip'
gc->parent = dev;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
drivers/leds/blink/leds-lgm-sso.c:479:4: error: incomplete definition of type 'struct gpio_chip'
gc->owner = THIS_MODULE;
~~^
include/linux/gpio.h:107:8: note: forward declaration of 'struct gpio_chip'
struct gpio_chip;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
17 warnings and 20 errors generated.
vim +123 drivers/leds/blink/leds-lgm-sso.c
121
122 struct sso_gpio {
> 123 struct gpio_chip chip;
124 int shift_clk_freq;
125 int edge;
126 int freq;
127 u32 pins;
128 u32 alloc_bitmap;
129 };
130
131 struct sso_led_priv {
132 struct regmap *mmap;
133 struct device *dev;
134 struct platform_device *pdev;
135 struct clk *gclk;
136 struct clk *fpid_clk;
137 u32 fpid_clkrate;
138 u32 gptc_clkrate;
139 u32 freq[MAX_FREQ_RANK];
140 struct list_head led_list;
141 struct sso_gpio gpio;
142 };
143
144 static int sso_get_blink_rate_idx(struct sso_led_priv *priv, u32 rate)
145 {
146 int i;
147
148 for (i = 0; i < MAX_FREQ_RANK; i++) {
149 if (rate <= priv->freq[i])
150 return i;
151 }
152
153 return -1;
154 }
155
156 static unsigned int sso_led_pin_to_group(u32 pin)
157 {
158 if (pin < LED_GRP0_PIN_MAX)
159 return LED_GRP0_0_23;
160 else if (pin < LED_GRP1_PIN_MAX)
161 return LED_GRP1_24_28;
162 else
163 return LED_GRP2_29_31;
164 }
165
166 static u32 sso_led_get_freq_src(int freq_idx)
167 {
168 if (freq_idx < MAX_FPID_FREQ_RANK)
169 return CLK_SRC_FPID;
170 else if (freq_idx < MAX_GPTC_FREQ_RANK)
171 return CLK_SRC_GPTC;
172 else
173 return CLK_SRC_GPTC_HS;
174 }
175
176 static u32 sso_led_pin_blink_off(u32 pin, unsigned int group)
177 {
178 if (group == LED_GRP2_29_31)
179 return pin - LED_GRP1_PIN_MAX;
180 else if (group == LED_GRP1_24_28)
181 return pin - LED_GRP0_PIN_MAX;
182 else /* led 0 - 23 in led 32 location */
183 return SSO_LED_MAX_NUM - LED_GRP1_PIN_MAX;
184 }
185
186 static struct sso_led
187 *cdev_to_sso_led_data(struct led_classdev *led_cdev)
188 {
189 return container_of(led_cdev, struct sso_led, cdev);
190 }
191
192 static void sso_led_freq_set(struct sso_led_priv *priv, u32 pin, int freq_idx)
193 {
194 u32 reg, off, freq_src, val_freq;
195 u32 low, high, val;
196 unsigned int group;
197
198 if (!freq_idx)
199 return;
200
201 group = sso_led_pin_to_group(pin);
202 freq_src = sso_led_get_freq_src(freq_idx);
203 off = sso_led_pin_blink_off(pin, group);
204
205 if (group == LED_GRP0_0_23)
206 return;
207 else if (group == LED_GRP1_24_28)
208 reg = LED_BLINK_H8_0;
209 else
210 reg = LED_BLINK_H8_1;
211
212 if (freq_src == CLK_SRC_FPID)
213 val_freq = freq_idx - 1;
214 else if (freq_src == CLK_SRC_GPTC)
215 val_freq = freq_idx - MAX_FPID_FREQ_RANK;
216
217 /* set blink rate idx */
218 if (freq_src != CLK_SRC_GPTC_HS) {
219 low = GET_FREQ_OFFSET(off, freq_src);
220 high = low + 2;
221 val = val_freq << high;
222 regmap_update_bits(priv->mmap, reg, GENMASK(high, low), val);
223 }
224
225 /* select clock source */
226 low = GET_SRC_OFFSET(off);
227 high = low + 2;
228 val = freq_src << high;
229 regmap_update_bits(priv->mmap, reg, GENMASK(high, low), val);
230 }
231
232 static void sso_led_brightness_set(struct led_classdev *led_cdev,
233 enum led_brightness brightness)
234 {
235 struct sso_led_priv *priv;
236 struct sso_led_desc *desc;
237 struct sso_led *led;
238 int val;
239
240 led = cdev_to_sso_led_data(led_cdev);
241 priv = led->priv;
242 desc = &led->desc;
243
244 desc->brightness = brightness;
245 regmap_write(priv->mmap, DUTY_CYCLE(desc->pin), brightness);
246
247 if (brightness == LED_OFF)
248 val = 0;
249 else
250 val = 1;
251
252 /* HW blink off */
253 if (desc->hw_blink && !val && desc->blinking) {
254 desc->blinking = 0;
255 regmap_update_bits(priv->mmap, SSO_CON2, BIT(desc->pin), 0);
256 } else if (desc->hw_blink && val && !desc->blinking) {
257 desc->blinking = 1;
258 regmap_update_bits(priv->mmap, SSO_CON2, BIT(desc->pin),
259 1 << desc->pin);
260 }
261
262 if (!desc->hw_trig && led->gpiod)
> 263 gpiod_set_value(led->gpiod, val);
264 }
265
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip