Skip to contentSkip to conversation

Sparse warning in AHCI

DISCUSSION Stephen Hemminger 2 participants 3 messages Sep 8, 2008 libata

lore
Share & tools
lore
#0 lore raw

Not sure how you want to fix this:

CHECK drivers/acpi/pci_irq.c
drivers/ata/ahci.c:323:2: warning: Initializer entry defined twice
drivers/ata/ahci.c:324:3: also defined here

This happens because macro ATA_BASE_SHT(drv_name) defines .can_queue then then later in the initializer for ahci_sht, it gets redefined.

Granted it probably works now, but sparse is correct to complain that this is bad usage.

#1 lore raw
Quoted 6 lines · Stephen Hemminger

Not sure how you want to fix this:

CHECK drivers/acpi/pci_irq.c
drivers/ata/ahci.c:323:2: warning: Initializer entry defined twice
drivers/ata/ahci.c:324:3: also defined here

Quoted 6 lines

This happens because macro ATA_BASE_SHT(drv_name) defines .can_queue then then later in the initializer for ahci_sht, it gets redefined.

Granted it probably works now, but sparse is correct to complain that this is bad usage.

Hmm... That use is pretty much intentional to provide generic default initial value and allow specific drivers to override if necessary and I believe it's a valid C usage, no?

Thanks.

Signature · 1 line
tejun
#2 lore raw
Quoted 10 lines · On Mon, 08 Sep 2008 21:12:10 +0200 Tejun Heo <[email protected]> wrote:
Quoted 9 lines · Stephen Hemminger

Not sure how you want to fix this:

CHECK drivers/acpi/pci_irq.c
drivers/ata/ahci.c:323:2: warning: Initializer entry defined twice
drivers/ata/ahci.c:324:3: also defined here

This happens because macro ATA_BASE_SHT(drv_name) defines .can_queue then then later in the initializer for ahci_sht, it gets redefined.

Quoted 7 lines
Quoted 3 lines

Granted it probably works now, but sparse is correct to complain that this is bad usage.

Hmm... That use is pretty much intentional to provide generic default initial value and allow specific drivers to override if necessary and I believe it's a valid C usage, no?

IANAL as Viro