[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [for-5.0 PATCH v2 1/3] cpu: Introduce CPUReset callback typedef
From: |
Greg Kurz |
Subject: |
Re: [for-5.0 PATCH v2 1/3] cpu: Introduce CPUReset callback typedef |
Date: |
Tue, 10 Dec 2019 17:29:53 +0100 |
On Tue, 10 Dec 2019 11:39:00 +0100
Markus Armbruster <address@hidden> wrote:
> Greg Kurz <address@hidden> writes:
>
> > Use it in include/hw/core/cpu.h and convert all targets to use it as
> > well with:
> >
> > perl -pi \
> > -e 's/void\s+\(\*(parent_reset)\)\(CPUState\s+\*\w+\)/CPUReset \1/;' \
> > $(git ls-files 'target/*.h')
> >
> > Signed-off-by: Greg Kurz <address@hidden>
> > Acked-by: David Gibson <address@hidden>
> > Reviewed-by: Alistair Francis <address@hidden>
> > ---
> > include/hw/core/cpu.h | 4 +++-
> > target/alpha/cpu-qom.h | 2 +-
> > target/arm/cpu-qom.h | 2 +-
> > target/cris/cpu-qom.h | 2 +-
> > target/hppa/cpu-qom.h | 2 +-
> > target/i386/cpu-qom.h | 2 +-
> > target/lm32/cpu-qom.h | 2 +-
> > target/m68k/cpu-qom.h | 2 +-
> > target/microblaze/cpu-qom.h | 2 +-
> > target/mips/cpu-qom.h | 2 +-
> > target/moxie/cpu.h | 2 +-
> > target/nios2/cpu.h | 2 +-
> > target/openrisc/cpu.h | 2 +-
> > target/ppc/cpu-qom.h | 2 +-
> > target/riscv/cpu.h | 2 +-
> > target/s390x/cpu-qom.h | 2 +-
> > target/sh4/cpu-qom.h | 2 +-
> > target/sparc/cpu-qom.h | 2 +-
> > target/tilegx/cpu.h | 2 +-
> > target/tricore/cpu-qom.h | 2 +-
> > target/xtensa/cpu-qom.h | 2 +-
> > 21 files changed, 23 insertions(+), 21 deletions(-)
> >
> > 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.
>
I merely followed what we have in qdev, but I tend to agree. And, as
mentioned by Peter in another mail, it looks odd to only convert the
reset method.
- [for-5.0 PATCH v2 0/3] cpu: Clarify overloading of reset QOM methods, Greg Kurz, 2019/12/09
- [for-5.0 PATCH v2 2/3] cpu: Introduce cpu_class_set_parent_reset(), Greg Kurz, 2019/12/09
- [for-5.0 PATCH v2 3/3] cpu: Use cpu_class_set_parent_reset(), Greg Kurz, 2019/12/09
- Re: [for-5.0 PATCH v2 0/3] cpu: Clarify overloading of reset QOM methods, Cornelia Huck, 2019/12/09
- Re: [for-5.0 PATCH v2 0/3] cpu: Clarify overloading of reset QOM methods, David Hildenbrand, 2019/12/10