All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Igor Mammedov <imammedo@redhat.com>
Cc: qemu-devel@nongnu.org, Richard Henderson <rth@twiddle.net>,
	Alexander Graf <agraf@suse.de>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-s390x@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] s390x: move s390x_new_cpu() into board code
Date: Tue, 17 Oct 2017 16:29:27 +0200	[thread overview]
Message-ID: <20171017162927.5ee8b9cd.cohuck@redhat.com> (raw)
In-Reply-To: <1508247680-98800-3-git-send-email-imammedo@redhat.com>

On Tue, 17 Oct 2017 15:41:20 +0200
Igor Mammedov <imammedo@redhat.com> wrote:

> s390-virtio-ccw.c is the sole user of s390x_new_cpu(),
> so move this helper there.
> 
> Signed-off-by: Igor Mammedov <imammedo@redhat.com>
> ---
>  target/s390x/cpu.h         |  1 -
>  hw/s390x/s390-virtio-ccw.c | 21 +++++++++++++++++++++
>  target/s390x/helper.c      | 20 --------------------
>  3 files changed, 21 insertions(+), 21 deletions(-)
> 
> diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
> index 7e864c8..b177be9 100644
> --- a/target/s390x/cpu.h
> +++ b/target/s390x/cpu.h
> @@ -695,7 +695,6 @@ void s390_cpu_list(FILE *f, fprintf_function cpu_fprintf);
>  
>  /* helper.c */
>  #define cpu_init(cpu_model) cpu_generic_init(TYPE_S390_CPU, cpu_model)
> -S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp);
>  
>  #define S390_CPU_TYPE_SUFFIX "-" TYPE_S390_CPU
>  #define S390_CPU_TYPE_NAME(name) (name S390_CPU_TYPE_SUFFIX)
> diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c
> index 32d3f11..f64db51 100644
> --- a/hw/s390x/s390-virtio-ccw.c
> +++ b/hw/s390x/s390-virtio-ccw.c
> @@ -52,6 +52,27 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr)
>      return S390_CPU(ms->possible_cpus->cpus[cpu_addr].cpu);
>  }
>  
> +static
> +S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp)

I don't like this wrap; better wrap the argument list.

> +{
> +    S390CPU *cpu = S390_CPU(object_new(typename));
> +    Error *err = NULL;
> +
> +    object_property_set_int(OBJECT(cpu), core_id, "core-id", &err);
> +    if (err != NULL) {
> +        goto out;
> +    }
> +    object_property_set_bool(OBJECT(cpu), true, "realized", &err);
> +
> +out:
> +    object_unref(OBJECT(cpu));
> +    if (err) {
> +        error_propagate(errp, err);
> +        cpu = NULL;
> +    }
> +    return cpu;
> +}
> +
>  static void s390_init_cpus(MachineState *machine)
>  {
>      MachineClass *mc = MACHINE_GET_CLASS(machine);
> diff --git a/target/s390x/helper.c b/target/s390x/helper.c
> index 64d4c48..52aa64b 100644
> --- a/target/s390x/helper.c
> +++ b/target/s390x/helper.c
> @@ -68,26 +68,6 @@ void s390x_cpu_timer(void *opaque)
>  }
>  #endif
>  
> -S390CPU *s390x_new_cpu(const char *typename, uint32_t core_id, Error **errp)
> -{
> -    S390CPU *cpu = S390_CPU(object_new(typename));
> -    Error *err = NULL;
> -
> -    object_property_set_int(OBJECT(cpu), core_id, "core-id", &err);
> -    if (err != NULL) {
> -        goto out;
> -    }
> -    object_property_set_bool(OBJECT(cpu), true, "realized", &err);
> -
> -out:
> -    object_unref(OBJECT(cpu));
> -    if (err) {
> -        error_propagate(errp, err);
> -        cpu = NULL;
> -    }
> -    return cpu;
> -}
> -
>  #ifndef CONFIG_USER_ONLY
>  
>  hwaddr s390_cpu_get_phys_page_debug(CPUState *cs, vaddr vaddr)

Otherwise, looks sane.

  reply	other threads:[~2017-10-17 14:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17 13:41 [Qemu-devel] [PATCH 0/2] s390x: cpu cleanups Igor Mammedov
2017-10-17 13:41 ` [Qemu-devel] [PATCH 1/2] s390x: fix cpu object referrence leak in s390x_new_cpu() Igor Mammedov
2017-10-17 14:28   ` Cornelia Huck
2017-10-17 15:49   ` Cornelia Huck
2017-10-17 13:41 ` [Qemu-devel] [PATCH 2/2] s390x: move s390x_new_cpu() into board code Igor Mammedov
2017-10-17 14:29   ` Cornelia Huck [this message]
2017-10-17 15:13     ` [Qemu-devel] [PATCH v2 " Igor Mammedov
2017-10-17 15:50       ` Cornelia Huck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171017162927.5ee8b9cd.cohuck@redhat.com \
    --to=cohuck@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=imammedo@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=rth@twiddle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.