Re: [PATCH] powerpc: iommu: fix build when neither PCI or IBMVIO is set
From: Randy Dunlap <rdunlap@infradead.org>
Date: 2021-03-06 20:57:15
Also in:
lkml
On March 2, 2021 3:08:43 AM PST, Michael Ellerman [off-list ref] wrote:
Randy Dunlap [off-list ref] writes:quoted
When neither CONFIG_PCI nor CONFIG_IBMVIO is enabled: ../arch/powerpc/kernel/iommu.c:178:30: error:'fail_iommu_bus_notifier' defined but not used [-Werror=unused-variable]quoted
178 | static struct notifier_block fail_iommu_bus_notifier = { If only that struct is bounded by 2 #if defined() phrases (PCI &&IBMVIO):quoted
../arch/powerpc/kernel/iommu.c:162:12: error: 'fail_iommu_bus_notify'defined but not used [-Werror=unused-function]quoted
162 | static int fail_iommu_bus_notify(struct notifier_block *nb, If that function is also guarded by 2 #if defined() phrases: In file included from ../include/linux/dma-mapping.h:7, from ../arch/powerpc/kernel/iommu.c:19: ../include/linux/device.h:131:26: error: 'dev_attr_fail_iommu'defined but not used [-Werror=unused-variable]quoted
131 | struct device_attribute dev_attr_##_name = __ATTR_RW(_name) ../arch/powerpc/kernel/iommu.c:160:8: note: in expansion of macro'DEVICE_ATTR_RW'quoted
160 | static DEVICE_ATTR_RW(fail_iommu); and the snowball continues to grow. Next I got this one: ../arch/powerpc/kernel/iommu.c: In function 'iommu_range_alloc': ../arch/powerpc/kernel/iommu.c:234:6: error: implicit declaration offunction 'should_fail_iommu'; did you mean 'should_failslab'? [-Werror=implicit-function-declaration]quoted
234 | if (should_fail_iommu(dev)) and ../arch/powerpc/kernel/iommu.c: In function 'should_fail_iommu': ../arch/powerpc/kernel/iommu.c:122:50: error: 'fail_iommu' undeclared(first use in this function)quoted
122 | return dev->archdata.fail_iommu && should_fail(&fail_iommu,1);quoted
So combine CONFIG_FAIL_IOMMU && (CONFIG_PCI || CONFIG_IBMVIO) to decide on building some of this code/data.Couldn't we just make FAIL_IOMMU depend on PCI || IBMVIO? cheers
Yes, I thought of that about 5 seconds after hitting Send. But I can't do it just now -- am away from computer. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.