qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] pci: Add missing 'const' in argument to pci_get_xxx
@ 2010-01-11 20:20 Stefan Weil
  2010-01-11 20:37 ` [Qemu-devel] " Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Weil @ 2010-01-11 20:20 UTC (permalink / raw)
  To: QEMU Developers, Michael S . Tsirkin

pci_get_byte, pci_get_word, pci_get_long and pci_get_quad
all take a const uint8_t pointer, because they only read
the configuration data.

Their prototypes should reflect this fact.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/pci.h |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/pci.h b/hw/pci.h
index 9b5ae97..025eb9f 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -245,7 +245,7 @@ pci_set_byte(uint8_t *config, uint8_t val)
 }
 
 static inline uint8_t
-pci_get_byte(uint8_t *config)
+pci_get_byte(const uint8_t *config)
 {
     return *config;
 }
@@ -257,9 +257,9 @@ pci_set_word(uint8_t *config, uint16_t val)
 }
 
 static inline uint16_t
-pci_get_word(uint8_t *config)
+pci_get_word(const uint8_t *config)
 {
-    return le16_to_cpupu((uint16_t *)config);
+    return le16_to_cpupu((const uint16_t *)config);
 }
 
 static inline void
@@ -269,9 +269,9 @@ pci_set_long(uint8_t *config, uint32_t val)
 }
 
 static inline uint32_t
-pci_get_long(uint8_t *config)
+pci_get_long(const uint8_t *config)
 {
-    return le32_to_cpupu((uint32_t *)config);
+    return le32_to_cpupu((const uint32_t *)config);
 }
 
 static inline void
@@ -281,9 +281,9 @@ pci_set_quad(uint8_t *config, uint64_t val)
 }
 
 static inline uint64_t
-pci_get_quad(uint8_t *config)
+pci_get_quad(const uint8_t *config)
 {
-    return le64_to_cpup((uint64_t *)config);
+    return le64_to_cpup((const uint64_t *)config);
 }
 
 static inline void
-- 
1.6.5

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

* [Qemu-devel] Re: [PATCH] pci: Add missing 'const' in argument to pci_get_xxx
  2010-01-11 20:20 [Qemu-devel] [PATCH] pci: Add missing 'const' in argument to pci_get_xxx Stefan Weil
@ 2010-01-11 20:37 ` Michael S. Tsirkin
  0 siblings, 0 replies; 2+ messages in thread
From: Michael S. Tsirkin @ 2010-01-11 20:37 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

On Mon, Jan 11, 2010 at 09:20:13PM +0100, Stefan Weil wrote:
> pci_get_byte, pci_get_word, pci_get_long and pci_get_quad
> all take a const uint8_t pointer, because they only read
> the configuration data.
> 
> Their prototypes should reflect this fact.
> 
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

Applied, thanks!

> ---
>  hw/pci.h |   14 +++++++-------
>  1 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/hw/pci.h b/hw/pci.h
> index 9b5ae97..025eb9f 100644
> --- a/hw/pci.h
> +++ b/hw/pci.h
> @@ -245,7 +245,7 @@ pci_set_byte(uint8_t *config, uint8_t val)
>  }
>  
>  static inline uint8_t
> -pci_get_byte(uint8_t *config)
> +pci_get_byte(const uint8_t *config)
>  {
>      return *config;
>  }
> @@ -257,9 +257,9 @@ pci_set_word(uint8_t *config, uint16_t val)
>  }
>  
>  static inline uint16_t
> -pci_get_word(uint8_t *config)
> +pci_get_word(const uint8_t *config)
>  {
> -    return le16_to_cpupu((uint16_t *)config);
> +    return le16_to_cpupu((const uint16_t *)config);
>  }
>  
>  static inline void
> @@ -269,9 +269,9 @@ pci_set_long(uint8_t *config, uint32_t val)
>  }
>  
>  static inline uint32_t
> -pci_get_long(uint8_t *config)
> +pci_get_long(const uint8_t *config)
>  {
> -    return le32_to_cpupu((uint32_t *)config);
> +    return le32_to_cpupu((const uint32_t *)config);
>  }
>  
>  static inline void
> @@ -281,9 +281,9 @@ pci_set_quad(uint8_t *config, uint64_t val)
>  }
>  
>  static inline uint64_t
> -pci_get_quad(uint8_t *config)
> +pci_get_quad(const uint8_t *config)
>  {
> -    return le64_to_cpup((uint64_t *)config);
> +    return le64_to_cpup((const uint64_t *)config);
>  }
>  
>  static inline void
> -- 
> 1.6.5

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

end of thread, other threads:[~2010-01-11 20:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-11 20:20 [Qemu-devel] [PATCH] pci: Add missing 'const' in argument to pci_get_xxx Stefan Weil
2010-01-11 20:37 ` [Qemu-devel] " Michael S. Tsirkin

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