All of lore.kernel.org
 help / color / mirror / Atom feed
From: Gavin Shan <shangw@linux.vnet.ibm.com>
To: Michael Ellerman <michael@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org, Gavin Shan <shangw@linux.vnet.ibm.com>
Subject: Re: [PATCH 3/3] powerpc/powernv: Patch MSI EOI handler on P8
Date: Tue, 23 Apr 2013 12:14:41 +0800	[thread overview]
Message-ID: <20130423041441.GA2846@shangw.(null)> (raw)
In-Reply-To: <20130422233415.GB17406@concordia>

On Tue, Apr 23, 2013 at 09:34:16AM +1000, Michael Ellerman wrote:
>On Mon, Apr 22, 2013 at 07:06:17PM +0800, Gavin Shan wrote:
>> On Mon, Apr 22, 2013 at 12:56:37PM +1000, Michael Ellerman wrote:
>> >On Mon, Apr 22, 2013 at 09:45:33AM +0800, Gavin Shan wrote:
>> >> On Mon, Apr 22, 2013 at 09:34:36AM +1000, Michael Ellerman wrote:
>> >> >On Fri, Apr 19, 2013 at 05:32:45PM +0800, Gavin Shan wrote:

.../...

>> >> >> diff --git a/arch/powerpc/sysdev/xics/icp-native.c b/arch/powerp=
c/sysdev/xics/icp-native.c
>> >> >> index 48861d3..289355e 100644
>> >> >> --- a/arch/powerpc/sysdev/xics/icp-native.c
>> >> >> +++ b/arch/powerpc/sysdev/xics/icp-native.c
>> >> >> @@ -27,6 +27,10 @@
>> >> >>  #include <asm/xics.h>
>> >> >>  #include <asm/kvm_ppc.h>
>> >> >> =20
>> >> >> +#if defined(CONFIG_PPC_POWERNV) && defined(CONFIG_PCI_MSI)
>> >> >> +extern int pnv_pci_msi_eoi(unsigned int hw_irq);
>> >> >> +#endif
>> >> >
>> >> >You don't need to #ifdef the extern. But it should be in a header,=
 not
>> >> >here.
>> >> >
>> >>=20
>> >> Ok. I'll put it into asm/xics.h, but I want to confirm we needn't
>> >> #ifdef when moving it to asm/xics.h?
>> >
>> >No you don't need it #ifdef'd. It's just extra noise in the file, and
>> >doesn't really add anything IMHO.
>> >
>>=20
>> Michael, I'm a bit confused about your point. asm/xics.h is shared bet=
ween
>> PowerNV and pSeries platform, and pnv_pci_msi_eoi() is only implemente=
d on
>> PowerNV platform, so the code should look like this (with newly introd=
uced
>> option - CONFIG_POWERNV_MSI)
>>=20
>> #ifdef CONFIG_POWERNV_MSI
>> extern int pnv_pci_msi_eoi(unsigned int hw_irq);
>> #endif
>
>You can do that. But there's not much value added by adding an
>#ifdef around the extern.
>
>Assuming the body of pnv_pci_msi_eoi() is only available when
>CONFIG_POWERNV_MSI is defined (which is the whole point), imagine there
>is code in platforms/pseries which accidentally calls it.
>
>If we have the extern protected by an ifdef we will get a warning that
>we are calling an undeclared function, eg something like:
>
>  pseries.c:30:2: warning: implicit declaration of function =E2=80=98pnv=
_pci_msi_eoi=E2=80=99 [-Wimplicit-function-declaration]
>
>But more importantly we will not be able to link the kernel, because the
>body of pnv_pci_msi_eoi() is missing (because CONFIG_POWERNV_MSI=3Dn).
>
>If we have the extern visible in the header, ie. not inside #ifdef, then
>we will not see the warning because the compiler can see the
>declaration.
>
>But even so the kernel will still not link.
>
>So my point is that having the #ifdef around the extern just gives you
>an extra warning, which is not all that useful because you are going to
>notice anyway as soon as the kernel fails to link.
>
>Anyway it's a minor point so don't worry about it too much :)
>

Thanks for your time to explain it with details, Michael. I will
remove that "#ifdef" ;-)

Thanks,
Gavin

      reply	other threads:[~2013-04-23  4:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-19  9:32 [PATCH 1/3] powerpc/powernv: Supports PHB3 Gavin Shan
2013-04-19  9:32 ` [PATCH 2/3] powerpc/powernv: Configure IODA2 tables explicitly Gavin Shan
2013-04-19  9:32 ` [PATCH 3/3] powerpc/powernv: Patch MSI EOI handler on P8 Gavin Shan
2013-04-21 23:34   ` Michael Ellerman
2013-04-22  1:45     ` Gavin Shan
2013-04-22  2:56       ` Michael Ellerman
2013-04-22 11:06         ` Gavin Shan
2013-04-22 23:34           ` Michael Ellerman
2013-04-23  4:14             ` Gavin Shan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='20130423041441.GA2846@shangw.(null)' \
    --to=shangw@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=michael@ellerman.id.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.