qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Hao Wu via <qemu-devel@nongnu.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Corey Minyard" <minyard@acm.org>,
	"Patrick Venture" <venture@google.com>,
	"Havard Skinnemoen" <hskinnemoen@google.com>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	"CS20 KFTing" <kfting@nuvoton.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	"IS20 Avi Fishman" <Avi.Fishman@nuvoton.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>
Subject: Re: [PATCH v3 4/5] hw/misc: Add a PWM module for NPCM7XX
Date: Wed, 16 Dec 2020 11:57:59 -0800	[thread overview]
Message-ID: <CAGcCb10PXNFT+oxUi1OD=XcvdybOM2s5YHcjDSA+XARSXVNKmw@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA_Nd0TNjiXkPXp7T29BYO2PnQLQUAFhEg+AR87B8YP+kA@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

Thanks for the review. We can add a patch in this patchset to fix this
issue.

On Wed, Dec 16, 2020 at 11:02 AM Peter Maydell <peter.maydell@linaro.org>
wrote:

> On Tue, 15 Dec 2020 at 00:13, Hao Wu <wuhaotsh@google.com> wrote:
> >
> > The PWM module is part of NPCM7XX module. Each NPCM7XX module has two
> > identical PWM modules. Each module contains 4 PWM entries. Each PWM has
> > two outputs: frequency and duty_cycle. Both are computed using inputs
> > from software side.
> >
> > This module does not model detail pulse signals since it is expensive.
> > It also does not model interrupts and watchdogs that are dependant on
> > the detail models. The interfaces for these are left in the module so
> > that anyone in need for these functionalities can implement on their
> > own.
> >
> > The user can read the duty cycle and frequency using qom-get command.
> >
> > Reviewed-by: Havard Skinnemoen <hskinnemoen@google.com>
> > Reviewed-by: Tyrone Ting <kfting@nuvoton.com>
> > Signed-off-by: Hao Wu <wuhaotsh@google.com>
>
>
> > +static void npcm7xx_pwm_init(Object *obj)
> > +{
> > +    NPCM7xxPWMState *s = NPCM7XX_PWM(obj);
> > +    SysBusDevice *sbd = &s->parent;
>
> This isn't right. A device shouldn't be poking around
> in the 'parent' or 'parentobj' member of its struct --
> that is a QOM internal. If you want "this device, cast
> to a SysBusDevice", the way to write that is:
>    SysBusDevice *sbd = SYS_BUS_DEVICE(s);
>
> (or you could pass 'obj'; same thing).
>
> Looking at the code currently in the tree it also is making this
> same mistake:
>
> $ git grep -- '->parent' hw/*/npcm*
> hw/arm/npcm7xx_boards.c:    MachineClass *mc = &nmc->parent;
> hw/mem/npcm7xx_mc.c:    sysbus_init_mmio(&s->parent, &s->mmio);
> hw/misc/npcm7xx_clk.c:    sysbus_init_mmio(&s->parent, &s->iomem);
> hw/misc/npcm7xx_gcr.c:    sysbus_init_mmio(&s->parent, &s->iomem);
> hw/misc/npcm7xx_rng.c:    sysbus_init_mmio(&s->parent, &s->iomem);
> hw/nvram/npcm7xx_otp.c:    SysBusDevice *sbd = &s->parent;
> hw/ssi/npcm7xx_fiu.c:    SysBusDevice *sbd = &s->parent;
> hw/timer/npcm7xx_timer.c:    SysBusDevice *sbd = &s->parent;
>
> These all should be using QOM cast macros. Would somebody
> who's working on these devices like to send a patch ?
>
> thanks
> -- PMM
>

[-- Attachment #2: Type: text/html, Size: 3198 bytes --]

  reply	other threads:[~2020-12-16 19:59 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-15  0:13 [PATCH v3 0/5] Additional NPCM7xx devices Hao Wu via
2020-12-15  0:13 ` [PATCH v3 1/5] hw/misc: Add clock converter in NPCM7XX CLK module Hao Wu via
2020-12-15  0:16   ` Hao Wu via
2020-12-15  0:13 ` [PATCH v3 2/5] hw/timer: Refactor NPCM7XX Timer to use CLK clock Hao Wu via
2020-12-15  0:16   ` Hao Wu via
2020-12-15  0:13 ` [PATCH v3 3/5] hw/adc: Add an ADC module for NPCM7XX Hao Wu via
2020-12-15  0:16   ` Hao Wu via
2020-12-15  0:13 ` [PATCH v3 4/5] hw/misc: Add a PWM " Hao Wu via
2020-12-15  0:17   ` Hao Wu via
2020-12-16 19:02   ` Peter Maydell
2020-12-16 19:57     ` Hao Wu via [this message]
2020-12-15  0:13 ` [PATCH v3 5/5] hw/misc: Add QTest for NPCM7XX PWM Module Hao Wu via
2020-12-15  0:16   ` Hao Wu via
2020-12-15  0:15 ` [PATCH v3 0/5] Additional NPCM7xx devices Hao Wu via
2020-12-15 15:17 ` Philippe Mathieu-Daudé
2020-12-15 17:13   ` Hao Wu via

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='CAGcCb10PXNFT+oxUi1OD=XcvdybOM2s5YHcjDSA+XARSXVNKmw@mail.gmail.com' \
    --to=qemu-devel@nongnu.org \
    --cc=Avi.Fishman@nuvoton.com \
    --cc=f4bug@amsat.org \
    --cc=hskinnemoen@google.com \
    --cc=kfting@nuvoton.com \
    --cc=minyard@acm.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=venture@google.com \
    --cc=wuhaotsh@google.com \
    /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).