From: Peter Maydell <peter.maydell@linaro.org>
To: Markus Armbruster <armbru@redhat.com>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
"Eduardo Habkost" <ehabkost@redhat.com>,
"David Hildenbrand" <david@redhat.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"QEMU Developers" <qemu-devel@nongnu.org>,
"Greg Kurz" <groug@kaod.org>,
"Alistair Francis" <alistair.francis@wdc.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@redhat.com>,
"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [for-5.0 PATCH v2 1/3] cpu: Introduce CPUReset callback typedef
Date: Tue, 10 Dec 2019 10:42:51 +0000 [thread overview]
Message-ID: <CAFEAcA8rVxtHbvEenxRsSFQWY7bE47e060NdxdVPXpCTrEOYHw@mail.gmail.com> (raw)
In-Reply-To: <87pngw31ob.fsf@dusky.pond.sub.org>
On Tue, 10 Dec 2019 at 10:39, Markus Armbruster <armbru@redhat.com> wrote:
>
> Greg Kurz <groug@kaod.org> writes:
> > diff --git a/include/hw/core/cpu.h b/include/hw/core/cpu.h
> > index 77c6f0529903..047e3972ecaf 100644
> > --- a/include/hw/core/cpu.h
> > +++ b/include/hw/core/cpu.h
> > @@ -74,6 +74,8 @@ typedef struct CPUWatchpoint CPUWatchpoint;
> >
> > struct TranslationBlock;
> >
> > +typedef void (*CPUReset)(CPUState *cpu);
> > +
> > /**
> > * CPUClass:
> > * @class_by_name: Callback to map -cpu command line model name to an
> > @@ -165,7 +167,7 @@ typedef struct CPUClass {
> > ObjectClass *(*class_by_name)(const char *cpu_model);
> > void (*parse_features)(const char *typename, char *str, Error **errp);
> >
> > - void (*reset)(CPUState *cpu);
> > + CPUReset reset;
> > int reset_dump_flags;
> > bool (*has_work)(CPUState *cpu);
> > void (*do_interrupt)(CPUState *cpu);
> [...]
>
> Opinion, not objection: such typedefs make the code less obvious.
It's particularly odd here where this class has several
methods but we've only chosen one to privilege with a typedef.
Personal preference: if you use a typedef, typedef the
function type, not the pointer-to-the-function-type.
But I would just leave it be.
thanks
-- PMM
next prev parent reply other threads:[~2019-12-10 10:43 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-09 17:55 [for-5.0 PATCH v2 0/3] cpu: Clarify overloading of reset QOM methods Greg Kurz
2019-12-09 17:55 ` [for-5.0 PATCH v2 1/3] cpu: Introduce CPUReset callback typedef Greg Kurz
2019-12-09 18:17 ` Cornelia Huck
2019-12-10 10:39 ` Markus Armbruster
2019-12-10 10:42 ` Peter Maydell [this message]
2019-12-10 16:32 ` Greg Kurz
2019-12-10 16:29 ` Greg Kurz
2019-12-09 17:55 ` [for-5.0 PATCH v2 2/3] cpu: Introduce cpu_class_set_parent_reset() Greg Kurz
2019-12-09 17:55 ` [for-5.0 PATCH v2 3/3] cpu: Use cpu_class_set_parent_reset() Greg Kurz
2019-12-09 18:20 ` Cornelia Huck
2019-12-09 18:21 ` [for-5.0 PATCH v2 0/3] cpu: Clarify overloading of reset QOM methods Cornelia Huck
2019-12-09 21:02 ` Greg Kurz
2019-12-10 10:40 ` David Hildenbrand
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=CAFEAcA8rVxtHbvEenxRsSFQWY7bE47e060NdxdVPXpCTrEOYHw@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=cohuck@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=david@redhat.com \
--cc=ehabkost@redhat.com \
--cc=groug@kaod.org \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=philmd@redhat.com \
--cc=qemu-devel@nongnu.org \
/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 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).