From: "Edgar E. Iglesias" <edgar.iglesias@gmail.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH 02/17] hw/onenand: Qdevify
Date: Sun, 28 Aug 2011 16:16:11 +0200 [thread overview]
Message-ID: <20110828141611.GD11446@zapo> (raw)
In-Reply-To: <CAFEAcA_AhhgbTBeGBQ0Rsm3mvk13UJBfQoosbSMcV5JW2n9aHg@mail.gmail.com>
On Sun, Aug 28, 2011 at 02:21:29PM +0100, Peter Maydell wrote:
> On 27 August 2011 18:38, Edgar E. Iglesias <edgar.iglesias@gmail.com> wrote:
> > On Thu, Aug 25, 2011 at 09:04:56PM +0100, Peter Maydell wrote:
> >> @@ -659,7 +713,7 @@ static void onenand_write(void *opaque, target_phys_addr_t addr,
> >> if (s->intstatus & (1 << 15))
> >> break;
> >> s->command = value;
> >> - onenand_command(s, s->command);
> >> + onenand_command(s);
> >> break;
> >
> >
> > This s->command change doesnt seem related, is there a reason for it that
> > I'm missing?
>
> Are you objecting to the change itself or the fact it's in this
> patch rather than its own patch? (I'm happy to split it out into
> a separate patch if you prefer.)
>
> I think the change itself is right -- in a qdev device these
> functions are basically methods on the qdev object, and it
> doesn't make sense to pass a method one of the object's own
> fields as a method argument. So either we should have
> onenand_command(s, value);
> and make onenand_command do the setting of s->command;
> or we do what this patch does and let onenand_command()
> read the member field.
OK thanks, I see them more like stylistic changes and would have
probably left them out for the sake of reviewability. But it doesn't
matter, my main concern was that I was missing something more important
here. No need to respin just for this..
> >> +DeviceState *onenand_init(BlockDriverState *bdrv,
> >> + uint16_t man_id, uint16_t dev_id, uint16_t ver_id,
> >> + int regshift, qemu_irq irq)
> >> {
> >> - OneNANDState *s = (OneNANDState *) opaque;
> >> + DeviceState *dev = qdev_create(NULL, "onenand");
> >> + qdev_prop_set_uint16(dev, "manufacturer_id", man_id);
> >> + qdev_prop_set_uint16(dev, "device_id", dev_id);
> >> + qdev_prop_set_uint16(dev, "version_id", ver_id);
> >> + qdev_prop_set_int32(dev, "shift", regshift);
> >> + if (bdrv) {
> >> + qdev_prop_set_drive_nofail(dev, "drive", bdrv);
> >> + }
> >> + qdev_init_nofail(dev);
> >> + sysbus_connect_irq(sysbus_from_qdev(dev), 0, irq);
> >> + return dev;
> >> +}
> >
> > Personally Im not a fan of having code that conceptually runs above Qdev,
> > embedded in qdev models. But there seems to be a lack of agreement on this
> > and its commonly done elsewere. I'm not NAKing but if you agree, and would
> > like to move it out, I'd appreciate it.
>
> I think they're really just utility functions which are working around
> the problem qdev has that instantiating, configuring and wiring up
> a qdev model is so verbose. But I'm happy to lose this one, especially
> since it's only used once. (well, twice once I get the n900 model in
> a submittable state...)
Thanks. Please note that I'm not opposed to the helpers per se, but more
with the placement of them. It was shortly discussed here (a long while ago):
http://lists.gnu.org/archive/html/qemu-devel/2009-09/msg00843.html
Cheers
next prev parent reply other threads:[~2011-08-28 14:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-25 20:04 [Qemu-devel] [PATCH 00/17] onenand, omap_gpmc fixes, features Peter Maydell
2011-08-25 20:04 ` [Qemu-devel] [PATCH 01/17] hw/sysbus: Add sysbus_mmio_get_region() Peter Maydell
2011-08-25 20:04 ` [Qemu-devel] [PATCH 02/17] hw/onenand: Qdevify Peter Maydell
2011-08-27 17:38 ` Edgar E. Iglesias
2011-08-28 13:21 ` Peter Maydell
2011-08-28 14:16 ` Edgar E. Iglesias [this message]
2011-08-25 20:04 ` [Qemu-devel] [PATCH 03/17] hw/onenand: Minor spacing fixes Peter Maydell
2011-08-25 20:04 ` [Qemu-devel] [PATCH 04/17] omap_gpmc: Clean up omap_gpmc_attach MemoryRegion conversion Peter Maydell
2011-08-25 20:04 ` [Qemu-devel] [PATCH 05/17] omap_gpmc: Refactor omap_gpmc_cs_map and omap_gpmc_cs_unmap Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 06/17] omap_gpmc: GPMC_IRQSTATUS is write-one-to-clear Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 07/17] omap_gpmc: Wire up the GPMC IRQ correctly Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 08/17] omap_gpmc: Fix handling of FIFOTHRESHOLDSTATUS bit Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 09/17] omap_gpmc: Take omap_mpu_state* in omap_gpmc_init Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 10/17] omap_gpmc: Calculate revision from OMAP model Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 11/17] omap_gpmc: Reindent misindented switch statements Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 12/17] omap_gpmc: Support NAND devices Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 13/17] hw/omap.h: Add OMAP 3630 to omap_mpu_model enumeration Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 14/17] omap_gpmc: Accept a zero mask field on omap3630 Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 15/17] omap_gpmc: Pull prefetch engine data into sub-struct Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 16/17] omap: Wire up the DMA request line to the GPMC Peter Maydell
2011-08-25 20:05 ` [Qemu-devel] [PATCH 17/17] omap_gpmc: Implement prefetch engine Peter Maydell
2011-08-27 2:30 ` [Qemu-devel] [PATCH 00/17] onenand, omap_gpmc fixes, features Edgar E. Iglesias
2011-08-27 12:19 ` Peter Maydell
2011-08-28 8:38 ` Edgar E. Iglesias
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=20110828141611.GD11446@zapo \
--to=edgar.iglesias@gmail.com \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--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).