Re: [PATCH] PCI: Remove unused includes and superfluous struct declaration

From: kbuild test robot
Date: Mon Sep 02 2019 - 02:32:18 EST


Hi Krzysztof,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on linus/master]
[cannot apply to v5.3-rc6 next-20190830]
[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/Krzysztof-Wilczynski/PCI-Remove-unused-includes-and-superfluous-struct-declaration/20190902-040019
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gcc (GCC) 7.4.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.4.0 make.cross ARCH=arm64

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@xxxxxxxxx>

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

In file included from include/linux/list.h:9:0,
from include/linux/kobject.h:19,
from include/linux/of.h:17,
from include/linux/irqdomain.h:35,
from include/linux/acpi.h:13,
from include/linux/acpi_iort.h:10,
from drivers/irqchip/irq-gic-v3-its-pci-msi.c:7:
drivers/irqchip/irq-gic-v3-its-pci-msi.c: In function 'its_pci_msi_vec_count':
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:37:12: error: implicit declaration of function 'pci_msi_vec_count'; did you mean 'its_pci_msi_vec_count'? [-Werror=implicit-function-declaration]
msi = max(pci_msi_vec_count(pdev), 0);
^
include/linux/kernel.h:821:22: note: in definition of macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:37:8: note: in expansion of macro 'max'
msi = max(pci_msi_vec_count(pdev), 0);
^~~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:38:13: error: implicit declaration of function 'pci_msix_vec_count'; did you mean 'its_pci_msi_vec_count'? [-Werror=implicit-function-declaration]
msix = max(pci_msix_vec_count(pdev), 0);
^
include/linux/kernel.h:821:22: note: in definition of macro '__typecheck'
(!!(sizeof((typeof(x) *)1 == (typeof(y) *)1)))
^
include/linux/kernel.h:845:24: note: in expansion of macro '__safe_cmp'
__builtin_choose_expr(__safe_cmp(x, y), \
^~~~~~~~~~
include/linux/kernel.h:861:19: note: in expansion of macro '__careful_cmp'
#define max(x, y) __careful_cmp(x, y, >)
^~~~~~~~~~~~~
drivers/irqchip/irq-gic-v3-its-pci-msi.c:38:9: note: in expansion of macro 'max'
msix = max(pci_msix_vec_count(pdev), 0);
^~~
drivers/irqchip/irq-gic-v3-its-pci-msi.c: In function 'its_pci_msi_prepare':
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:60:7: error: implicit declaration of function 'dev_is_pci'; did you mean 'dev_to_psd'? [-Werror=implicit-function-declaration]
if (!dev_is_pci(dev))
^~~~~~~~~~
dev_to_psd
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:65:9: error: implicit declaration of function 'to_pci_dev'; did you mean 'atomic_dec'? [-Werror=implicit-function-declaration]
pdev = to_pci_dev(dev);
^~~~~~~~~~
atomic_dec
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:65:7: warning: assignment makes pointer from integer without a cast [-Wint-conversion]
pdev = to_pci_dev(dev);
^
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:70:2: error: implicit declaration of function 'pci_for_each_dma_alias'; did you mean 'xas_for_each_conflict'? [-Werror=implicit-function-declaration]
pci_for_each_dma_alias(pdev, its_get_pci_alias, &alias_dev);
^~~~~~~~~~~~~~~~~~~~~~
xas_for_each_conflict
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:71:36: error: dereferencing pointer to incomplete type 'struct pci_dev'
if (alias_dev != pdev && alias_dev->subordinate)
^~
>> drivers/irqchip/irq-gic-v3-its-pci-msi.c:72:3: error: implicit declaration of function 'pci_walk_bus' [-Werror=implicit-function-declaration]
pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
^~~~~~~~~~~~
cc1: some warnings being treated as errors
--
drivers/irqchip/irq-gic-v2m.c: In function 'gicv2m_acpi_init':
>> drivers/irqchip/irq-gic-v2m.c:558:2: error: implicit declaration of function 'pci_msi_register_fwnode_provider'; did you mean 'acpi_bus_register_driver'? [-Werror=implicit-function-declaration]
pci_msi_register_fwnode_provider(&gicv2m_get_fwnode);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
acpi_bus_register_driver
cc1: some warnings being treated as errors
--
In file included from drivers/pci/controller/pci-thunder-pem.c:11:0:
include/linux/pci-acpi.h: In function 'acpi_find_root_bridge_handle':
>> include/linux/pci-acpi.h:34:29: error: dereferencing pointer to incomplete type 'struct pci_dev'
struct pci_bus *pbus = pdev->bus;
^~
>> include/linux/pci-acpi.h:37:10: error: implicit declaration of function 'pci_is_root_bus'; did you mean 'acpi_is_root_bridge'? [-Werror=implicit-function-declaration]
while (!pci_is_root_bus(pbus))
^~~~~~~~~~~~~~~
acpi_is_root_bridge
>> include/linux/pci-acpi.h:38:14: error: dereferencing pointer to incomplete type 'struct pci_bus'
pbus = pbus->parent;
^~
In file included from include/linux/acpi.h:32:0,
from include/linux/pci-acpi.h:12,
from drivers/pci/controller/pci-thunder-pem.c:11:
>> include/acpi/acpi_bus.h:411:23: warning: passing argument 1 of 'is_acpi_device_node' makes pointer from integer without a cast [-Wint-conversion]
is_acpi_device_node(__to_acpi_device_node_fwnode) ? \
^
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
return ACPI_HANDLE(pbus->bridge);
^~~~~~~~~~~
include/acpi/acpi_bus.h:399:6: note: expected 'const struct fwnode_handle *' but argument is of type 'int'
bool is_acpi_device_node(const struct fwnode_handle *fwnode);
^~~~~~~~~~~~~~~~~~~
In file included from drivers/pci/controller/pci-thunder-pem.c:7:0:
>> include/linux/kernel.h:972:17: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
void *__mptr = (void *)(ptr); \
^
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
container_of(__to_acpi_device_node_fwnode, \
^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
return ACPI_HANDLE(pbus->bridge);
^~~~~~~~~~~
In file included from include/linux/build_bug.h:5:0,
from include/linux/bitfield.h:10,
from drivers/pci/controller/pci-thunder-pem.c:6:
>> include/linux/kernel.h:973:32: error: invalid type argument of unary '*' (have 'int')
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~
include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:973:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:973:20: note: in expansion of macro '__same_type'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
container_of(__to_acpi_device_node_fwnode, \
^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
^~~~~~~~~~~~~~
>> include/linux/pci-acpi.h:40:9: note: in expansion of macro 'ACPI_HANDLE'
return ACPI_HANDLE(pbus->bridge);
^~~~~~~~~~~
include/linux/kernel.h:974:18: error: invalid type argument of unary '*' (have 'int')
!__same_type(*(ptr), void), \
^~~~~~
include/linux/compiler.h:330:9: note: in definition of macro '__compiletime_assert'
if (!(condition)) \
^~~~~~~~~
include/linux/compiler.h:350:2: note: in expansion of macro '_compiletime_assert'
_compiletime_assert(condition, msg, __compiletime_assert_, __LINE__)
^~~~~~~~~~~~~~~~~~~
include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
#define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
^~~~~~~~~~~~~~~~~~
include/linux/kernel.h:973:2: note: in expansion of macro 'BUILD_BUG_ON_MSG'
BUILD_BUG_ON_MSG(!__same_type(*(ptr), ((type *)0)->member) && \
^~~~~~~~~~~~~~~~
include/linux/kernel.h:974:6: note: in expansion of macro '__same_type'
!__same_type(*(ptr), void), \
^~~~~~~~~~~
>> include/acpi/acpi_bus.h:412:4: note: in expansion of macro 'container_of'
container_of(__to_acpi_device_node_fwnode, \
^~~~~~~~~~~~
>> include/linux/acpi.h:43:30: note: in expansion of macro 'to_acpi_device_node'
#define ACPI_COMPANION(dev) to_acpi_device_node((dev)->fwnode)
^~~~~~~~~~~~~~~~~~~
>> include/linux/acpi.h:46:46: note: in expansion of macro 'ACPI_COMPANION'
#define ACPI_HANDLE(dev) acpi_device_handle(ACPI_COMPANION(dev))
^~~~~~~~~~~~~~

vim +71 drivers/irqchip/irq-gic-v3-its-pci-msi.c

723344dd0b2aa1 Tomasz Nowicki 2016-09-12 @7 #include <linux/acpi_iort.h>
f130420e51df30 Marc Zyngier 2015-07-28 8 #include <linux/msi.h>
f130420e51df30 Marc Zyngier 2015-07-28 9 #include <linux/of.h>
f130420e51df30 Marc Zyngier 2015-07-28 10 #include <linux/of_irq.h>
f130420e51df30 Marc Zyngier 2015-07-28 11 #include <linux/of_pci.h>
f130420e51df30 Marc Zyngier 2015-07-28 12
f130420e51df30 Marc Zyngier 2015-07-28 13 static void its_mask_msi_irq(struct irq_data *d)
f130420e51df30 Marc Zyngier 2015-07-28 14 {
f130420e51df30 Marc Zyngier 2015-07-28 15 pci_msi_mask_irq(d);
f130420e51df30 Marc Zyngier 2015-07-28 16 irq_chip_mask_parent(d);
f130420e51df30 Marc Zyngier 2015-07-28 17 }
f130420e51df30 Marc Zyngier 2015-07-28 18
f130420e51df30 Marc Zyngier 2015-07-28 19 static void its_unmask_msi_irq(struct irq_data *d)
f130420e51df30 Marc Zyngier 2015-07-28 20 {
f130420e51df30 Marc Zyngier 2015-07-28 21 pci_msi_unmask_irq(d);
f130420e51df30 Marc Zyngier 2015-07-28 22 irq_chip_unmask_parent(d);
f130420e51df30 Marc Zyngier 2015-07-28 23 }
f130420e51df30 Marc Zyngier 2015-07-28 24
f130420e51df30 Marc Zyngier 2015-07-28 25 static struct irq_chip its_msi_irq_chip = {
f130420e51df30 Marc Zyngier 2015-07-28 26 .name = "ITS-MSI",
f130420e51df30 Marc Zyngier 2015-07-28 27 .irq_unmask = its_unmask_msi_irq,
f130420e51df30 Marc Zyngier 2015-07-28 28 .irq_mask = its_mask_msi_irq,
f130420e51df30 Marc Zyngier 2015-07-28 29 .irq_eoi = irq_chip_eoi_parent,
f130420e51df30 Marc Zyngier 2015-07-28 30 .irq_write_msi_msg = pci_msi_domain_write_msg,
f130420e51df30 Marc Zyngier 2015-07-28 31 };
f130420e51df30 Marc Zyngier 2015-07-28 32
3403b0259d152c Robin Murphy 2017-05-31 33 static int its_pci_msi_vec_count(struct pci_dev *pdev, void *data)
f130420e51df30 Marc Zyngier 2015-07-28 34 {
3403b0259d152c Robin Murphy 2017-05-31 35 int msi, msix, *count = data;
f130420e51df30 Marc Zyngier 2015-07-28 36
f130420e51df30 Marc Zyngier 2015-07-28 @37 msi = max(pci_msi_vec_count(pdev), 0);
f130420e51df30 Marc Zyngier 2015-07-28 @38 msix = max(pci_msix_vec_count(pdev), 0);
3403b0259d152c Robin Murphy 2017-05-31 39 *count += max(msi, msix);
f130420e51df30 Marc Zyngier 2015-07-28 40
3403b0259d152c Robin Murphy 2017-05-31 41 return 0;
f130420e51df30 Marc Zyngier 2015-07-28 42 }
f130420e51df30 Marc Zyngier 2015-07-28 43
f130420e51df30 Marc Zyngier 2015-07-28 44 static int its_get_pci_alias(struct pci_dev *pdev, u16 alias, void *data)
f130420e51df30 Marc Zyngier 2015-07-28 45 {
3403b0259d152c Robin Murphy 2017-05-31 46 struct pci_dev **alias_dev = data;
f130420e51df30 Marc Zyngier 2015-07-28 47
3403b0259d152c Robin Murphy 2017-05-31 48 *alias_dev = pdev;
f130420e51df30 Marc Zyngier 2015-07-28 49
f130420e51df30 Marc Zyngier 2015-07-28 50 return 0;
f130420e51df30 Marc Zyngier 2015-07-28 51 }
f130420e51df30 Marc Zyngier 2015-07-28 52
f130420e51df30 Marc Zyngier 2015-07-28 53 static int its_pci_msi_prepare(struct irq_domain *domain, struct device *dev,
f130420e51df30 Marc Zyngier 2015-07-28 54 int nvec, msi_alloc_info_t *info)
f130420e51df30 Marc Zyngier 2015-07-28 55 {
3403b0259d152c Robin Murphy 2017-05-31 56 struct pci_dev *pdev, *alias_dev;
54456db9a23753 Marc Zyngier 2015-07-28 57 struct msi_domain_info *msi_info;
30800b3a1fb14c Marc Zyngier 2018-05-31 58 int alias_count = 0, minnvec = 1;
f130420e51df30 Marc Zyngier 2015-07-28 59
f130420e51df30 Marc Zyngier 2015-07-28 @60 if (!dev_is_pci(dev))
f130420e51df30 Marc Zyngier 2015-07-28 61 return -EINVAL;
f130420e51df30 Marc Zyngier 2015-07-28 62
54456db9a23753 Marc Zyngier 2015-07-28 63 msi_info = msi_get_domain_info(domain->parent);
54456db9a23753 Marc Zyngier 2015-07-28 64
f130420e51df30 Marc Zyngier 2015-07-28 @65 pdev = to_pci_dev(dev);
3403b0259d152c Robin Murphy 2017-05-31 66 /*
3403b0259d152c Robin Murphy 2017-05-31 67 * If pdev is downstream of any aliasing bridges, take an upper
3403b0259d152c Robin Murphy 2017-05-31 68 * bound of how many other vectors could map to the same DevID.
3403b0259d152c Robin Murphy 2017-05-31 69 */
3403b0259d152c Robin Murphy 2017-05-31 @70 pci_for_each_dma_alias(pdev, its_get_pci_alias, &alias_dev);
3403b0259d152c Robin Murphy 2017-05-31 @71 if (alias_dev != pdev && alias_dev->subordinate)
3403b0259d152c Robin Murphy 2017-05-31 @72 pci_walk_bus(alias_dev->subordinate, its_pci_msi_vec_count,
3403b0259d152c Robin Murphy 2017-05-31 73 &alias_count);
f130420e51df30 Marc Zyngier 2015-07-28 74
54456db9a23753 Marc Zyngier 2015-07-28 75 /* ITS specific DeviceID, as the core ITS ignores dev. */
ccf91e68a4357e David Daney 2015-10-08 76 info->scratchpad[0].ul = pci_msi_domain_get_msi_rid(domain, pdev);
54456db9a23753 Marc Zyngier 2015-07-28 77
30800b3a1fb14c Marc Zyngier 2018-05-31 78 /*
30800b3a1fb14c Marc Zyngier 2018-05-31 79 * Always allocate a power of 2, and special case device 0 for
30800b3a1fb14c Marc Zyngier 2018-05-31 80 * broken systems where the DevID is not wired (and all devices
30800b3a1fb14c Marc Zyngier 2018-05-31 81 * appear as DevID 0). For that reason, we generously allocate a
30800b3a1fb14c Marc Zyngier 2018-05-31 82 * minimum of 32 MSIs for DevID 0. If you want more because all
30800b3a1fb14c Marc Zyngier 2018-05-31 83 * your devices are aliasing to DevID 0, consider fixing your HW.
30800b3a1fb14c Marc Zyngier 2018-05-31 84 */
147c8f376e5526 Marc Zyngier 2018-05-27 85 nvec = max(nvec, alias_count);
30800b3a1fb14c Marc Zyngier 2018-05-31 86 if (!info->scratchpad[0].ul)
30800b3a1fb14c Marc Zyngier 2018-05-31 87 minnvec = 32;
30800b3a1fb14c Marc Zyngier 2018-05-31 88 nvec = max_t(int, minnvec, roundup_pow_of_two(nvec));
147c8f376e5526 Marc Zyngier 2018-05-27 89 return msi_info->ops->msi_prepare(domain->parent, dev, nvec, info);
f130420e51df30 Marc Zyngier 2015-07-28 90 }
f130420e51df30 Marc Zyngier 2015-07-28 91

:::::: The code at line 71 was first introduced by commit
:::::: 3403b0259d152c3ca67b32bb710f826bc17c0d16 irqchip/gic-v3-its: Fix MSI alias accounting

:::::: TO: Robin Murphy <robin.murphy@xxxxxxx>
:::::: CC: Marc Zyngier <marc.zyngier@xxxxxxx>

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

Attachment: .config.gz
Description: application/gzip