qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] arm: Add const attribute to function parameter
@ 2011-06-15 21:22 Stefan Weil
  2011-06-15 22:37 ` Peter Maydell
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2011-06-15 21:22 UTC (permalink / raw)
  To: QEMU Developers

Parameter 'info' is const, so add the missing
attribute.

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/arm-misc.h |    2 +-
 hw/arm_boot.c |    4 ++--
 hw/nseries.c  |    4 ++--
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..9aeeaea 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -31,7 +31,7 @@ struct arm_boot_info {
     target_phys_addr_t smp_priv_base;
     int nb_cpus;
     int board_id;
-    int (*atag_board)(struct arm_boot_info *info, void *p);
+    int (*atag_board)(const struct arm_boot_info *info, void *p);
     /* Used internally by arm_boot.c */
     int is_linux;
     target_phys_addr_t initrd_size;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index bfac982..7e286c4 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -49,7 +49,7 @@ static uint32_t smpboot[] = {
     p += 4;                       \
 } while (0)
 
-static void set_kernel_args(struct arm_boot_info *info,
+static void set_kernel_args(const struct arm_boot_info *info,
                 int initrd_size, target_phys_addr_t base)
 {
     target_phys_addr_t p;
@@ -102,7 +102,7 @@ static void set_kernel_args(struct arm_boot_info *info,
     WRITE_WORD(p, 0);
 }
 
-static void set_kernel_args_old(struct arm_boot_info *info,
+static void set_kernel_args_old(const struct arm_boot_info *info,
                 int initrd_size, target_phys_addr_t base)
 {
     target_phys_addr_t p;
diff --git a/hw/nseries.c b/hw/nseries.c
index 2f6f473..2f84f53 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -1254,12 +1254,12 @@ static int n8x0_atag_setup(void *p, int model)
     return (void *) w - p;
 }
 
-static int n800_atag_setup(struct arm_boot_info *info, void *p)
+static int n800_atag_setup(const struct arm_boot_info *info, void *p)
 {
     return n8x0_atag_setup(p, 800);
 }
 
-static int n810_atag_setup(struct arm_boot_info *info, void *p)
+static int n810_atag_setup(const struct arm_boot_info *info, void *p)
 {
     return n8x0_atag_setup(p, 810);
 }
-- 
1.7.2.5

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

* Re: [Qemu-devel] [PATCH] arm: Add const attribute to function parameter
  2011-06-15 21:22 [Qemu-devel] [PATCH] arm: Add const attribute to function parameter Stefan Weil
@ 2011-06-15 22:37 ` Peter Maydell
  2011-06-23 15:53   ` [Qemu-devel] [PATCH] arm: Add const attribute to some arm_boot_info pointers Stefan Weil
  0 siblings, 1 reply; 4+ messages in thread
From: Peter Maydell @ 2011-06-15 22:37 UTC (permalink / raw)
  To: Stefan Weil; +Cc: QEMU Developers

On 15 June 2011 22:22, Stefan Weil <weil@mail.berlios.de> wrote:
> Parameter 'info' is const, so add the missing
> attribute.
>
> Cc: Andrzej Zaborowski <balrogg@gmail.com>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>

You could take this a step further and add 'const' to
the local variable info in do_cpu_reset() and also
to the boot_info field in CPUARMState.

-- PMM

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

* [Qemu-devel] [PATCH] arm: Add const attribute to some arm_boot_info pointers
  2011-06-15 22:37 ` Peter Maydell
@ 2011-06-23 15:53   ` Stefan Weil
  2011-07-04 20:12     ` andrzej zaborowski
  0 siblings, 1 reply; 4+ messages in thread
From: Stefan Weil @ 2011-06-23 15:53 UTC (permalink / raw)
  To: QEMU Developers; +Cc: Peter Maydell

Parameter 'info' is const, so add the missing attribute.

v2:
Add 'const' to the local variable info in do_cpu_reset() and to
the boot_info field in CPUARMState (suggested by Peter Maydell).

Cc: Andrzej Zaborowski <balrogg@gmail.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 hw/arm-misc.h    |    2 +-
 hw/arm_boot.c    |    6 +++---
 hw/nseries.c     |    4 ++--
 target-arm/cpu.h |    2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/hw/arm-misc.h b/hw/arm-misc.h
index 010acb4..9aeeaea 100644
--- a/hw/arm-misc.h
+++ b/hw/arm-misc.h
@@ -31,7 +31,7 @@ struct arm_boot_info {
     target_phys_addr_t smp_priv_base;
     int nb_cpus;
     int board_id;
-    int (*atag_board)(struct arm_boot_info *info, void *p);
+    int (*atag_board)(const struct arm_boot_info *info, void *p);
     /* Used internally by arm_boot.c */
     int is_linux;
     target_phys_addr_t initrd_size;
diff --git a/hw/arm_boot.c b/hw/arm_boot.c
index bfac982..e021576 100644
--- a/hw/arm_boot.c
+++ b/hw/arm_boot.c
@@ -49,7 +49,7 @@ static uint32_t smpboot[] = {
     p += 4;                       \
 } while (0)
 
-static void set_kernel_args(struct arm_boot_info *info,
+static void set_kernel_args(const struct arm_boot_info *info,
                 int initrd_size, target_phys_addr_t base)
 {
     target_phys_addr_t p;
@@ -102,7 +102,7 @@ static void set_kernel_args(struct arm_boot_info *info,
     WRITE_WORD(p, 0);
 }
 
-static void set_kernel_args_old(struct arm_boot_info *info,
+static void set_kernel_args_old(const struct arm_boot_info *info,
                 int initrd_size, target_phys_addr_t base)
 {
     target_phys_addr_t p;
@@ -178,7 +178,7 @@ static void set_kernel_args_old(struct arm_boot_info *info,
 static void do_cpu_reset(void *opaque)
 {
     CPUState *env = opaque;
-    struct arm_boot_info *info = env->boot_info;
+    const struct arm_boot_info *info = env->boot_info;
 
     cpu_reset(env);
     if (info) {
diff --git a/hw/nseries.c b/hw/nseries.c
index 2f6f473..2f84f53 100644
--- a/hw/nseries.c
+++ b/hw/nseries.c
@@ -1254,12 +1254,12 @@ static int n8x0_atag_setup(void *p, int model)
     return (void *) w - p;
 }
 
-static int n800_atag_setup(struct arm_boot_info *info, void *p)
+static int n800_atag_setup(const struct arm_boot_info *info, void *p)
 {
     return n8x0_atag_setup(p, 800);
 }
 
-static int n810_atag_setup(struct arm_boot_info *info, void *p)
+static int n810_atag_setup(const struct arm_boot_info *info, void *p)
 {
     return n8x0_atag_setup(p, 810);
 }
diff --git a/target-arm/cpu.h b/target-arm/cpu.h
index 01f5b57..a9fdf6e 100644
--- a/target-arm/cpu.h
+++ b/target-arm/cpu.h
@@ -221,7 +221,7 @@ typedef struct CPUARMState {
         void *opaque;
     } cp[15];
     void *nvic;
-    struct arm_boot_info *boot_info;
+    const struct arm_boot_info *boot_info;
 } CPUARMState;
 
 CPUARMState *cpu_arm_init(const char *cpu_model);
-- 
1.7.2.5

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

* Re: [Qemu-devel] [PATCH] arm: Add const attribute to some arm_boot_info pointers
  2011-06-23 15:53   ` [Qemu-devel] [PATCH] arm: Add const attribute to some arm_boot_info pointers Stefan Weil
@ 2011-07-04 20:12     ` andrzej zaborowski
  0 siblings, 0 replies; 4+ messages in thread
From: andrzej zaborowski @ 2011-07-04 20:12 UTC (permalink / raw)
  To: Stefan Weil; +Cc: Peter Maydell, QEMU Developers

On 23 June 2011 17:53, Stefan Weil <weil@mail.berlios.de> wrote:
> Parameter 'info' is const, so add the missing attribute.
>
> v2:
> Add 'const' to the local variable info in do_cpu_reset() and to
> the boot_info field in CPUARMState (suggested by Peter Maydell).

I pushed this version, thanks.

Cheers

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

end of thread, other threads:[~2011-07-04 20:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-15 21:22 [Qemu-devel] [PATCH] arm: Add const attribute to function parameter Stefan Weil
2011-06-15 22:37 ` Peter Maydell
2011-06-23 15:53   ` [Qemu-devel] [PATCH] arm: Add const attribute to some arm_boot_info pointers Stefan Weil
2011-07-04 20:12     ` andrzej zaborowski

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