linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
@ 2008-04-09  2:19 Trent Piepho
  2008-04-09  3:44 ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 2+ messages in thread
From: Trent Piepho @ 2008-04-09  2:19 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Trent Piepho

Why?  Because:
A) It's not modified and so it can be made const.  const is good.
B) If one has a function that was given a const pci_bus pointer and you
want to get a pointer to its pci_controller, you'll get a warning from gcc
when you use pci_bus_to_host().  This is the right way to stop that
warning.

Signed-off-by: Trent Piepho <tpiepho@freescale.com>
---
 include/asm-powerpc/pci-bridge.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
index e5802c6..b95d033 100644
--- a/include/asm-powerpc/pci-bridge.h
+++ b/include/asm-powerpc/pci-bridge.h
@@ -117,7 +117,7 @@ struct pci_controller {
 
 #ifndef CONFIG_PPC64
 
-static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
+static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
 {
 	return bus->sysdata;
 }
@@ -235,7 +235,7 @@ extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus);
 
 extern int pcibios_remove_root_bus(struct pci_controller *phb);
 
-static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
+static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
 {
 	struct device_node *busdn = bus->sysdata;
 
-- 
1.5.4.1

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

* Re: [PATCH] [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const
  2008-04-09  2:19 [PATCH] [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const Trent Piepho
@ 2008-04-09  3:44 ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 2+ messages in thread
From: Benjamin Herrenschmidt @ 2008-04-09  3:44 UTC (permalink / raw)
  To: Trent Piepho; +Cc: linuxppc-dev


On Tue, 2008-04-08 at 19:19 -0700, Trent Piepho wrote:
> Why?  Because:
> A) It's not modified and so it can be made const.  const is good.
> B) If one has a function that was given a const pci_bus pointer and you
> want to get a pointer to its pci_controller, you'll get a warning from gcc
> when you use pci_bus_to_host().  This is the right way to stop that
> warning.
> 
> Signed-off-by: Trent Piepho <tpiepho@freescale.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> ---
>  include/asm-powerpc/pci-bridge.h |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/asm-powerpc/pci-bridge.h b/include/asm-powerpc/pci-bridge.h
> index e5802c6..b95d033 100644
> --- a/include/asm-powerpc/pci-bridge.h
> +++ b/include/asm-powerpc/pci-bridge.h
> @@ -117,7 +117,7 @@ struct pci_controller {
>  
>  #ifndef CONFIG_PPC64
>  
> -static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
> +static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
>  {
>  	return bus->sysdata;
>  }
> @@ -235,7 +235,7 @@ extern void pcibios_fixup_new_pci_devices(struct pci_bus *bus);
>  
>  extern int pcibios_remove_root_bus(struct pci_controller *phb);
>  
> -static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
> +static inline struct pci_controller *pci_bus_to_host(const struct pci_bus *bus)
>  {
>  	struct device_node *busdn = bus->sysdata;
>  

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

end of thread, other threads:[~2008-04-09  3:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-09  2:19 [PATCH] [POWERPC] Make pci_bus_to_host()'s struct pci_bus * argument const Trent Piepho
2008-04-09  3:44 ` Benjamin Herrenschmidt

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).