linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init()
@ 2021-07-29 23:40 Krzysztof Wilczyński
  2021-07-30 21:19 ` Bjorn Helgaas
  2021-08-12 15:05 ` Thomas Gleixner
  0 siblings, 2 replies; 5+ messages in thread
From: Krzysztof Wilczyński @ 2021-07-29 23:40 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Ingo Molnar, Borislav Petkov, H. Peter Anvin, Bjorn Helgaas, x86,
	linux-pci

At the moment, the function pci_numachip_init() is defined in the
numachip.c file.  Since this function has users outside of this file,
add missing foward declaration to the pci_x86.h file.

This resolves the following sparse and compile time warning:

  arch/x86/pci/numachip.c:108:12: warning: no previous prototype for function 'pci_numachip_init' [-Wmissing-prototypes]
  arch/x86/pci/numachip.c:108:12: warning: symbol 'pci_numachip_init' was not declared. Should it be static?

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 arch/x86/include/asm/pci_x86.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index 490411dba438..906f40cae3fc 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -50,6 +50,10 @@ enum pci_bf_sort_state {
 	pci_dmi_bf,
 };
 
+/* numachip.c */
+
+int pci_numachip_init(void);
+
 /* pci-i386.c */
 
 void pcibios_resource_survey(void);
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init()
  2021-07-29 23:40 [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init() Krzysztof Wilczyński
@ 2021-07-30 21:19 ` Bjorn Helgaas
  2021-08-12 15:14   ` Thomas Gleixner
  2021-08-12 15:05 ` Thomas Gleixner
  1 sibling, 1 reply; 5+ messages in thread
From: Bjorn Helgaas @ 2021-07-30 21:19 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Thomas Gleixner, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	Bjorn Helgaas, x86, linux-pci

On Thu, Jul 29, 2021 at 11:40:59PM +0000, Krzysztof Wilczyński wrote:
> At the moment, the function pci_numachip_init() is defined in the
> numachip.c file.  Since this function has users outside of this file,
> add missing foward declaration to the pci_x86.h file.
> 
> This resolves the following sparse and compile time warning:
> 
>   arch/x86/pci/numachip.c:108:12: warning: no previous prototype for function 'pci_numachip_init' [-Wmissing-prototypes]
>   arch/x86/pci/numachip.c:108:12: warning: symbol 'pci_numachip_init' was not declared. Should it be static?

Thanks for worrying about warnings like this.  They're small but
important.

What should be done with the pci_numachip_init() declaration in
arch/x86/include/asm/numachip/numachip.h?  It doesn't seem like we
should have *two* declarations.

The one in arch/x86/include/asm/numachip/numachip.h is:

  extern int __init pci_numachip_init(void);

I'm not enough of a C language lawyer to know whether "__init" in a
declaration is useful.  It doesn't *seem* like it would be useful
since this is not a definition and the compiler isn't generating code
here.  But "git grep __init include/ arch/*/include" finds quite a few
of them.

> Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
> ---
>  arch/x86/include/asm/pci_x86.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
> index 490411dba438..906f40cae3fc 100644
> --- a/arch/x86/include/asm/pci_x86.h
> +++ b/arch/x86/include/asm/pci_x86.h
> @@ -50,6 +50,10 @@ enum pci_bf_sort_state {
>  	pci_dmi_bf,
>  };
>  
> +/* numachip.c */
> +
> +int pci_numachip_init(void);
> +
>  /* pci-i386.c */
>  
>  void pcibios_resource_survey(void);
> -- 
> 2.32.0
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init()
  2021-07-29 23:40 [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init() Krzysztof Wilczyński
  2021-07-30 21:19 ` Bjorn Helgaas
@ 2021-08-12 15:05 ` Thomas Gleixner
  1 sibling, 0 replies; 5+ messages in thread
From: Thomas Gleixner @ 2021-08-12 15:05 UTC (permalink / raw)
  To: Krzysztof Wilczyński
  Cc: Ingo Molnar, Borislav Petkov, H. Peter Anvin, Bjorn Helgaas, x86,
	linux-pci

On Thu, Jul 29 2021 at 23:40, Krzysztof Wilczyński wrote:
> At the moment, the function pci_numachip_init() is defined in the
> numachip.c file.  Since this function has users outside of this file,
> add missing foward declaration to the pci_x86.h file.
>
> This resolves the following sparse and compile time warning:
>
>   arch/x86/pci/numachip.c:108:12: warning: no previous prototype for function 'pci_numachip_init' [-Wmissing-prototypes]
>   arch/x86/pci/numachip.c:108:12: warning: symbol 'pci_numachip_init'
>   was not declared. Should it be static?

No. arch/x86/pci/numachip.c simply lacks

 #include <asm/numachip/numachip.h>

Thanks,

        tglx

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init()
  2021-07-30 21:19 ` Bjorn Helgaas
@ 2021-08-12 15:14   ` Thomas Gleixner
  2021-08-12 16:11     ` Krzysztof Wilczyński
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas Gleixner @ 2021-08-12 15:14 UTC (permalink / raw)
  To: Bjorn Helgaas, Krzysztof Wilczyński
  Cc: Ingo Molnar, Borislav Petkov, H. Peter Anvin, Bjorn Helgaas, x86,
	linux-pci

On Fri, Jul 30 2021 at 16:19, Bjorn Helgaas wrote:
> On Thu, Jul 29, 2021 at 11:40:59PM +0000, Krzysztof Wilczyński wrote:
> What should be done with the pci_numachip_init() declaration in
> arch/x86/include/asm/numachip/numachip.h?  It doesn't seem like we
> should have *two* declarations.

Right. Include that file in the C file and be done with it.

> The one in arch/x86/include/asm/numachip/numachip.h is:
>
>   extern int __init pci_numachip_init(void);
>
> I'm not enough of a C language lawyer to know whether "__init" in a
> declaration is useful.  It doesn't *seem* like it would be useful
> since this is not a definition and the compiler isn't generating code
> here.  But "git grep __init include/ arch/*/include" finds quite a few
> of them.

__init on the prototype is not having any effect except perhaps
documentary value at least with current compilers.

The attribute magic is vague in both the C specification and the
compiler manuals, but that might change some day in the future. But in
which direction is unknown :)

Thanks,

        tglx


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init()
  2021-08-12 15:14   ` Thomas Gleixner
@ 2021-08-12 16:11     ` Krzysztof Wilczyński
  0 siblings, 0 replies; 5+ messages in thread
From: Krzysztof Wilczyński @ 2021-08-12 16:11 UTC (permalink / raw)
  To: Thomas Gleixner
  Cc: Bjorn Helgaas, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
	Bjorn Helgaas, x86, linux-pci

Hi Thomas,

[...]
> > What should be done with the pci_numachip_init() declaration in
> > arch/x86/include/asm/numachip/numachip.h?  It doesn't seem like we
> > should have *two* declarations.
> 
> Right. Include that file in the C file and be done with it.

I will send v2 shortly with the correct header file included.

Thank you both!

	Krzysztof

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-08-12 16:14 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29 23:40 [PATCH] x86/pci: Add missing forward declaration for pci_numachip_init() Krzysztof Wilczyński
2021-07-30 21:19 ` Bjorn Helgaas
2021-08-12 15:14   ` Thomas Gleixner
2021-08-12 16:11     ` Krzysztof Wilczyński
2021-08-12 15:05 ` Thomas Gleixner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).