Message ID | e9a9b7f8c4530109b083bf19c547532f14db32a1.1629799776.git.fthain@linux-m68k.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [RFC,01/10] hw/mos6522: Remove get_load_time() methods and functions | expand |
On 8/24/21 12:09 PM, Finn Thain wrote: > This improves readability. > > Signed-off-by: Finn Thain <fthain@linux-m68k.org> > --- > hw/misc/mos6522.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
On 24/08/2021 11:09, Finn Thain wrote: > This improves readability. > > Signed-off-by: Finn Thain <fthain@linux-m68k.org> > --- > hw/misc/mos6522.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) > > diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c > index 1d4a56077e..c0d6bee4cc 100644 > --- a/hw/misc/mos6522.c > +++ b/hw/misc/mos6522.c > @@ -154,7 +154,7 @@ static void mos6522_timer2_update(MOS6522State *s, MOS6522Timer *ti, > } > } > > -static void mos6522_timer1(void *opaque) > +static void mos6522_timer1_expired(void *opaque) > { > MOS6522State *s = opaque; > MOS6522Timer *ti = &s->timers[0]; > @@ -164,7 +164,7 @@ static void mos6522_timer1(void *opaque) > mos6522_update_irq(s); > } > > -static void mos6522_timer2(void *opaque) > +static void mos6522_timer2_expired(void *opaque) > { > MOS6522State *s = opaque; > MOS6522Timer *ti = &s->timers[1]; > @@ -445,8 +445,10 @@ static void mos6522_init(Object *obj) > s->timers[i].index = i; > } > > - s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer1, s); > - s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer2, s); > + s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, > + mos6522_timer1_expired, s); > + s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, > + mos6522_timer2_expired, s); > } > > static void mos6522_finalize(Object *obj) I'm not overly keen on this one: the general QEMU convention for a timer callback is for it to be named *_timer() rather than *_expired(), so I'd prefer to keep this consistent with the rest of the codebase. ATB, Mark.
On 8/25/21 9:11 AM, Mark Cave-Ayland wrote: > On 24/08/2021 11:09, Finn Thain wrote: > >> This improves readability. >> >> Signed-off-by: Finn Thain <fthain@linux-m68k.org> >> --- >> hw/misc/mos6522.c | 10 ++++++---- >> 1 file changed, 6 insertions(+), 4 deletions(-) >> >> diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c >> index 1d4a56077e..c0d6bee4cc 100644 >> --- a/hw/misc/mos6522.c >> +++ b/hw/misc/mos6522.c >> @@ -154,7 +154,7 @@ static void mos6522_timer2_update(MOS6522State *s, >> MOS6522Timer *ti, >> } >> } >> -static void mos6522_timer1(void *opaque) >> +static void mos6522_timer1_expired(void *opaque) >> { >> MOS6522State *s = opaque; >> MOS6522Timer *ti = &s->timers[0]; >> @@ -164,7 +164,7 @@ static void mos6522_timer1(void *opaque) >> mos6522_update_irq(s); >> } >> -static void mos6522_timer2(void *opaque) >> +static void mos6522_timer2_expired(void *opaque) >> { >> MOS6522State *s = opaque; >> MOS6522Timer *ti = &s->timers[1]; >> @@ -445,8 +445,10 @@ static void mos6522_init(Object *obj) >> s->timers[i].index = i; >> } >> - s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, >> mos6522_timer1, s); >> - s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, >> mos6522_timer2, s); >> + s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, >> + mos6522_timer1_expired, s); >> + s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, >> + mos6522_timer2_expired, s); >> } >> static void mos6522_finalize(Object *obj) > > I'm not overly keen on this one: the general QEMU convention for a timer > callback is for it to be named *_timer() rather than *_expired(), so I'd > prefer to keep this consistent with the rest of the codebase. I can not find any convention, and 'git grep -A1 \ timer_new' doesn't show any conventional pattern neither.
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c index 1d4a56077e..c0d6bee4cc 100644 --- a/hw/misc/mos6522.c +++ b/hw/misc/mos6522.c @@ -154,7 +154,7 @@ static void mos6522_timer2_update(MOS6522State *s, MOS6522Timer *ti, } } -static void mos6522_timer1(void *opaque) +static void mos6522_timer1_expired(void *opaque) { MOS6522State *s = opaque; MOS6522Timer *ti = &s->timers[0]; @@ -164,7 +164,7 @@ static void mos6522_timer1(void *opaque) mos6522_update_irq(s); } -static void mos6522_timer2(void *opaque) +static void mos6522_timer2_expired(void *opaque) { MOS6522State *s = opaque; MOS6522Timer *ti = &s->timers[1]; @@ -445,8 +445,10 @@ static void mos6522_init(Object *obj) s->timers[i].index = i; } - s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer1, s); - s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, mos6522_timer2, s); + s->timers[0].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, + mos6522_timer1_expired, s); + s->timers[1].timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, + mos6522_timer2_expired, s); } static void mos6522_finalize(Object *obj)
This improves readability. Signed-off-by: Finn Thain <fthain@linux-m68k.org> --- hw/misc/mos6522.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)