qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block()
@ 2023-10-30  9:31 Philippe Mathieu-Daudé
  2023-10-30  9:46 ` David Hildenbrand
  0 siblings, 1 reply; 2+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-10-30  9:31 UTC (permalink / raw)
  To: qemu-devel
  Cc: Thomas Huth, Richard Henderson, Ilya Leoshkevich, qemu-s390x,
	David Hildenbrand, Philippe Mathieu-Daudé

We already have a global 'first_cpu' variable storing a pointer
to the first CPU, no need to use a static one.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 target/s390x/cpu_models.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
index 4dead48650..540d445023 100644
--- a/target/s390x/cpu_models.c
+++ b/target/s390x/cpu_models.c
@@ -196,11 +196,7 @@ uint32_t s390_get_ibc_val(void)
 
 void s390_get_feat_block(S390FeatType type, uint8_t *data)
 {
-    static S390CPU *cpu;
-
-    if (!cpu) {
-        cpu = S390_CPU(qemu_get_cpu(0));
-    }
+    S390CPU *cpu = S390_CPU(first_cpu);
 
     if (!cpu || !cpu->model) {
         return;
-- 
2.41.0



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

* Re: [PATCH] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block()
  2023-10-30  9:31 [PATCH] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block() Philippe Mathieu-Daudé
@ 2023-10-30  9:46 ` David Hildenbrand
  0 siblings, 0 replies; 2+ messages in thread
From: David Hildenbrand @ 2023-10-30  9:46 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Thomas Huth, Richard Henderson, Ilya Leoshkevich, qemu-s390x

On 30.10.23 10:31, Philippe Mathieu-Daudé wrote:
> We already have a global 'first_cpu' variable storing a pointer
> to the first CPU, no need to use a static one.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   target/s390x/cpu_models.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/target/s390x/cpu_models.c b/target/s390x/cpu_models.c
> index 4dead48650..540d445023 100644
> --- a/target/s390x/cpu_models.c
> +++ b/target/s390x/cpu_models.c
> @@ -196,11 +196,7 @@ uint32_t s390_get_ibc_val(void)
>   
>   void s390_get_feat_block(S390FeatType type, uint8_t *data)
>   {
> -    static S390CPU *cpu;
> -
> -    if (!cpu) {
> -        cpu = S390_CPU(qemu_get_cpu(0));
> -    }
> +    S390CPU *cpu = S390_CPU(first_cpu);
>   
>       if (!cpu || !cpu->model) {
>           return;

Reviewed-by: David Hildenbrand <david@redhat.com>

-- 
Cheers,

David / dhildenb



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

end of thread, other threads:[~2023-10-30  9:47 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-30  9:31 [PATCH] target/s390x/cpu_models: Use 'first_cpu' in s390_get_feat_block() Philippe Mathieu-Daudé
2023-10-30  9:46 ` David Hildenbrand

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