Message ID | 20210128180239.548512-2-lee.jones@linaro.org |
---|---|
State | New |
Headers | show |
Series | [01/20] ata: ahci_dm816: Ignore -Woverride-init | expand |
On Thu, Jan 28, 2021 at 06:02:20PM +0000, Lee Jones wrote: > Some ATA drivers use the SCSI host template, a series of interwoven > macros, to aid with initialisation. Some of these macros conflict, > resulting in the over-writing of previously set values. Please just disable this warning globally. This is a sensible patter and we should not sprinkle per-file options for something that fundamental.
On Thu, 28 Jan 2021, Christoph Hellwig wrote: > On Thu, Jan 28, 2021 at 06:02:20PM +0000, Lee Jones wrote: > > Some ATA drivers use the SCSI host template, a series of interwoven > > macros, to aid with initialisation. Some of these macros conflict, > > resulting in the over-writing of previously set values. > > Please just disable this warning globally. This is a sensible > patter and we should not sprinkle per-file options for something > that fundamental. Will do. Just as soon as I've figured out how. :)
On Thu, Jan 28, 2021 at 7:32 PM Lee Jones <lee.jones@linaro.org> wrote: > > On Thu, 28 Jan 2021, Christoph Hellwig wrote: > > > On Thu, Jan 28, 2021 at 06:02:20PM +0000, Lee Jones wrote: > > > Some ATA drivers use the SCSI host template, a series of interwoven > > > macros, to aid with initialisation. Some of these macros conflict, > > > resulting in the over-writing of previously set values. > > > > Please just disable this warning globally. This is a sensible > > patter and we should not sprinkle per-file options for something > > that fundamental. > > Will do. Just as soon as I've figured out how. :) I have a local patch series doing it like this diff --git a/include/linux/libata.h b/include/linux/libata.h index 5f550eb27f81..4e4cc14a289e 100644 --- a/include/linux/libata.h +++ b/include/linux/libata.h @@ -1390,6 +1390,8 @@ extern struct device_attribute *ata_common_sdev_attrs[]; * edge driver's module reference, otherwise the driver can be unloaded * even if the scsi_device is being accessed. */ +__diag_ignore(GCC, 8, "-Woverride-init", "intentional override") +__diag_ignore(CLANG, 9, "-Winitializer-overrides", "intentional override") #define __ATA_BASE_SHT(drv_name) \ .module = THIS_MODULE, \ .name = drv_name, \ I think this also requires a preparation patch to extend __diag_ignore to additional compiler versions, not sure if that was already merged. Arnd
On Mon, 01 Feb 2021, Arnd Bergmann wrote: > On Thu, Jan 28, 2021 at 7:32 PM Lee Jones <lee.jones@linaro.org> wrote: > > > > On Thu, 28 Jan 2021, Christoph Hellwig wrote: > > > > > On Thu, Jan 28, 2021 at 06:02:20PM +0000, Lee Jones wrote: > > > > Some ATA drivers use the SCSI host template, a series of interwoven > > > > macros, to aid with initialisation. Some of these macros conflict, > > > > resulting in the over-writing of previously set values. > > > > > > Please just disable this warning globally. This is a sensible > > > patter and we should not sprinkle per-file options for something > > > that fundamental. > > > > Will do. Just as soon as I've figured out how. :) > > I have a local patch series doing it like this Can I leave this in your capable hands then? I'll drop all my fixes for this if it can be replaced with just one. > diff --git a/include/linux/libata.h b/include/linux/libata.h > index 5f550eb27f81..4e4cc14a289e 100644 > --- a/include/linux/libata.h > +++ b/include/linux/libata.h > @@ -1390,6 +1390,8 @@ extern struct device_attribute *ata_common_sdev_attrs[]; > * edge driver's module reference, otherwise the driver can be unloaded > * even if the scsi_device is being accessed. > */ > +__diag_ignore(GCC, 8, "-Woverride-init", "intentional override") > +__diag_ignore(CLANG, 9, "-Winitializer-overrides", "intentional override") > #define __ATA_BASE_SHT(drv_name) \ > .module = THIS_MODULE, \ > .name = drv_name, \ > > I think this also requires a preparation patch to extend __diag_ignore to > additional compiler versions, not sure if that was already merged. > > Arnd
diff --git a/drivers/ata/Makefile b/drivers/ata/Makefile index b8aebfb14e825..d24bf4d2b08d6 100644 --- a/drivers/ata/Makefile +++ b/drivers/ata/Makefile @@ -1,5 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 +CFLAGS_ahci_dm816.o = $(call cc-disable-warning, override-init) + obj-$(CONFIG_ATA) += libata.o # non-SFF interface
Some ATA drivers use the SCSI host template, a series of interwoven macros, to aid with initialisation. Some of these macros conflict, resulting in the over-writing of previously set values. This is known behaviour and can be safely ignored. Fixes the following W=1 kernel build warning(s): In file included from drivers/ata/ahci_dm816.c:16: drivers/ata/ahci.h:387:16: warning: initialized field overwritten [-Woverride-init] drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’ drivers/ata/ahci.h:387:16: note: (near initialization for ‘ahci_dm816_platform_sht.can_queue’) drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’ drivers/ata/ahci.h:391:17: warning: initialized field overwritten [-Woverride-init] drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’ drivers/ata/ahci.h:391:17: note: (near initialization for ‘ahci_dm816_platform_sht.sdev_attrs’) drivers/ata/ahci_dm816.c:138:2: note: in expansion of macro ‘AHCI_SHT’ Cc: Jens Axboe <axboe@kernel.dk> Cc: linux-ide@vger.kernel.org Signed-off-by: Lee Jones <lee.jones@linaro.org> --- drivers/ata/Makefile | 2 ++ 1 file changed, 2 insertions(+)