Re: PCI: designware: Use IS_ENABLED()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 8, 2014 at 7:34 PM, Jingoo Han <jg1.han@xxxxxxxxxxx> wrote:
> On Wednesday, July 09, 2014 9:58 AM, Stephen Rothwell wrote:
>>
>> Hi Fabio,
>>
>> [I noticed this in the pci tree in linux-next this morning]
>>
>> On Wed, 18 Jun 2014 12:16:53 -0300 Fabio Estevam <festevam@xxxxxxxxx> wrote:
>> >
>> > From: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
>> >
>> > We can get rid of the 'ifdef' by using the IS_ENABLED() macro.
>> >
>> > Signed-off-by: Fabio Estevam <fabio.estevam@xxxxxxxxxxxxx>
>> > Acked-by: Jingoo Han <jg1.han@xxxxxxxxxxx>
>> > Acked-by: Mohit Kumar <mohit.kumar@xxxxxx>
>> >
>> > ---
>> > drivers/pci/host/pcie-designware.c | 5 ++---
>> >  1 file changed, 2 insertions(+), 3 deletions(-)
>> >
>> > diff --git a/drivers/pci/host/pcie-designware.c b/drivers/pci/host/pcie-designware.c
>> > index 1eaf4df3..dc842fd 100644
>> > --- a/drivers/pci/host/pcie-designware.c
>> > +++ b/drivers/pci/host/pcie-designware.c
>> > @@ -497,9 +497,8 @@ int __init dw_pcie_host_init(struct pcie_port *pp)
>> >
>> >     pci_common_init_dev(pp->dev, &dw_pci);
>> >     pci_assign_unassigned_resources();
>> > -#ifdef CONFIG_PCI_DOMAINS
>> > -   dw_pci.domain++;
>> > -#endif
>> > +   if (IS_ENABLED(CONFIG_PCI_DOMAINS))
>> > +           dw_pci.domain++;
>> >
>> >     return 0;
>> >  }
>>
>> Will this actually compile if CONFIG_PCI_DOMAINS is disabled, since the
>> "domains" field of dw_pci does not even exist in that case (it is
>> ifdeffed out in arch/arm/include/asm/mach/pci.h)?  Even if it works
>> with newer compilers, will it work with older ones i.e. how new does
>> the compiler have to be to elide the code before noticing that
>> "domains" does not exist?
>
> Oops, you're right! It makes build errors when CONFIG_PCI_DOMAINS
> is disabled.
>
> The "domain" variable is guarded by "#ifdef CONFIG_PCI_DOMAINS";
> thus, IS_ENABLED() should NOT be used.
>
> ./arch/arm/include/asm/mach/pci.h
> struct hw_pci {
> #ifdef CONFIG_PCI_DOMAINS
>         int             domain;
> #endif
>
> Bjorn Helgaas,
> Please revert this patch from your pci tree. Thank you.

I dropped it.  Thanks for noticing this, Stephen.

Bjorn
--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux