Hi Bartosz,
My loongson-2 configure file is enable CONFIG_OF_GPIO by default, so
there is no
compilation error, and I will add select OF_GPIO for GPIO_LOONGSON_64BIT.
About the warning that happen on arch/hexagon/, It should be related to
architecture
file. My patch was base on LoongArch architecture and compile it no any
warning that
use W=1.
Thanks,
Yinbo
在 2022/12/4 1:20, kernel test robot 写道:
tree: https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git gpio/for-next
head: 96010045bb9eb70dcb67937e4e6ac182bdb2b1be
commit: d9cfe5825bb342548a5abd57ad37c7523b9ef446 [63/65] gpio: loongson: add gpio driver support
config: hexagon-buildonly-randconfig-r002-20221203
compiler: clang version 16.0.0 (https://github.com/llvm/llvm-project 6e4cea55f0d1104408b26ac574566a0e4de48036)
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
# https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git/commit/?id=d9cfe5825bb342548a5abd57ad37c7523b9ef446
git remote add brgl https://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
git fetch --no-tags brgl gpio/for-next
git checkout d9cfe5825bb342548a5abd57ad37c7523b9ef446
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/gpio/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
All errors (new ones prefixed by >>):
In file included from drivers/gpio/gpio-loongson-64bit.c:14:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/gpio/gpio-loongson-64bit.c:14:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/gpio/gpio-loongson-64bit.c:14:
In file included from include/linux/gpio/driver.h:6:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:13:
In file included from arch/hexagon/include/asm/io.h:334:
include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
drivers/gpio/gpio-loongson-64bit.c:263:15: error: no member named 'of_node' in 'struct gpio_chip'; did you mean 'fwnode'?
lgpio->chip.of_node = np;
^~~~~~~
fwnode
include/linux/gpio/driver.h:411:24: note: 'fwnode' declared here
struct fwnode_handle *fwnode;
^
6 warnings and 1 error generated.
vim +263 drivers/gpio/gpio-loongson-64bit.c
234
235 static int loongson_gpio_init(
236 struct device *dev, struct loongson_gpio_chip *lgpio,
237 struct device_node *np, void __iomem *reg_base)
238 {
239 int ret;
240 u32 ngpios;
241 struct irq_domain *parent;
242 struct gpio_irq_chip *girq;
243 struct device_node *irq_parent;
244
245 lgpio->reg_base = reg_base;
246
247 if (lgpio->chip_data->mode == BIT_CTRL_MODE) {
248 ret = bgpio_init(&lgpio->chip, dev, 8,
249 LOONGSON_GPIO_IN(lgpio),
250 LOONGSON_GPIO_OUT(lgpio), 0,
251 LOONGSON_GPIO_OEN(lgpio), NULL, 0);
252 if (ret) {
253 dev_err(dev, "unable to init generic GPIO\n");
254 return ret;
255 }
256 } else {
257 lgpio->chip.direction_input = loongson_gpio_direction_input;
258 lgpio->chip.get = loongson_gpio_get;
259 lgpio->chip.get_direction = loongson_gpio_get_direction;
260 lgpio->chip.direction_output = loongson_gpio_direction_output;
261 lgpio->chip.set = loongson_gpio_set;
262 lgpio->chip.can_sleep = 0;
> 263 lgpio->chip.of_node = np;
264 lgpio->chip.parent = dev;
265 spin_lock_init(&lgpio->lock);
266 }
267
268 device_property_read_u32(dev, "ngpios", &ngpios);
269
270 lgpio->chip.ngpio = ngpios;
271 lgpio->chip.label = lgpio->chip_data->label;
272
273 if (lgpio->chip_data->support_irq == true) {
274 lgpio->chip.to_irq = loongson_gpio_to_irq;
275 irq_parent = of_irq_find_parent(np);
276 if (irq_parent)
277 parent = irq_find_host(irq_parent);
278
279 lgpio->fwnode = of_node_to_fwnode(np);
280
281 girq = &lgpio->chip.irq;
282 gpio_irq_chip_set_chip(girq, &loongson_gpio_irqchip);
283 girq->fwnode = lgpio->fwnode;
284 girq->parent_domain = parent;
285 girq->child_to_parent_hwirq = loongson_gpio_child_to_parent_hwirq;
286 girq->handler = handle_bad_irq;
287 girq->default_type = IRQ_TYPE_NONE;
288 }
289
290 return devm_gpiochip_add_data(dev, &lgpio->chip, lgpio);
291 }
292