All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Corey Minyard" <cminyard@mvista.com>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Joel Stanley" <joel@jms.id.au>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>,
	qemu-arm <qemu-arm@nongnu.org>, qemu-ppc <qemu-ppc@nongnu.org>,
	"Cédric Le Goater" <clg@kaod.org>,
	"Jan Kiszka" <jan.kiszka@web.de>,
	"David Gibson" <david@gibson.dropbear.id.au>
Subject: Re: [PATCH 5/5] hw/i2c: Document the I2C qdev helpers
Date: Tue, 14 Jul 2020 09:05:56 +0200	[thread overview]
Message-ID: <87pn8y8tkb.fsf@dusky.pond.sub.org> (raw)
In-Reply-To: <CAFEAcA9cajf=MKv4ZD6ivyDTrK4hWLfBP_9T2mJ6LrWjwGMFGA@mail.gmail.com> (Peter Maydell's message of "Tue, 30 Jun 2020 14:16:45 +0100")

Peter Maydell <peter.maydell@linaro.org> writes:

> On Tue, 30 Jun 2020 at 11:15, Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Philippe Mathieu-Daudé <f4bug@amsat.org> writes:
>>
>> > In commit d88c42ff2c we added new prototype but neglected to
>> > add their documentation. Fix that.
>> >
>> > Reported-by: Peter Maydell <peter.maydell@linaro.org>
>> > Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>
>> > + * This function is useful if you have created @dev via qdev_new(),
>> > + * i2c_slave_new() or i2c_slave_try_new() (which take a reference to
>> > + * the device it returns to you), so that you can set properties on it
>> > + * before realizing it. If you don't need to set properties then
>> > + * i2c_slave_create_simple() is probably better (as it does the create,
>> > + * init and realize in one step).
>> > + *
>> > + * If you are embedding the I2C slave into another QOM device and
>> > + * initialized it via some variant on object_initialize_child() then
>> > + * do not use this function, because that family of functions arrange
>> > + * for the only reference to the child device to be held by the parent
>> > + * via the child<> property, and so the reference-count-drop done here
>> > + * would be incorrect.  (Instead you would want i2c_slave_realize(),
>> > + * which doesn't currently exist but would be trivial to create if we
>> > + * had any code that wanted it.)
>> > + */
>>
>> The advice on use is more elaborate qdev_realize_and_unref()'s.  That
>> one simply shows intended use.  I doubt we need more.  But as the person
>> who wrote qdev_realize_and_unref(), I'm singularly unqualified judging
>> the need ;)
>
> If qdev_realize_and_unref() has documentation which gives
> the use-cases similar to the text above, then we could make
> this text say "This function follows the patterns and
> intended usecases for qdev_realize_and_unref(); see the
> documentation for that function for whether you would be
> better off using i2c_realize() or (the not-yet-existing)
> i2c_slave_realize()" or similar. I originally wrote the
> version of the above text for ssi_realize_and_unref()
> as essentially the documentation I would have liked
> qdev_realize_and_unref() to have, ie including the nuances
> which I had to figure out for myself.

To document wrappers as simple as ssi_realize_and_unref(), pointing to
the wrapped function should suffice.  When more elaborate documentation
is wanted, it's probably wanted for the wrapped function.

Since you felt a need for a more elaborate ssi_realize_and_unref() doc
comment, you should probably propose a patch for
qdev_realize_and_unref()'s doc comment :)


  reply	other threads:[~2020-07-14  7:06 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-29 17:38 [PATCH 0/5] hw/i2c: Rename method names for consistency and add documentation Philippe Mathieu-Daudé
2020-06-29 17:38 ` Philippe Mathieu-Daudé
2020-06-29 17:38 ` [PATCH 1/5] hw/i2c/aspeed_i2c: Simplify aspeed_i2c_get_bus() Philippe Mathieu-Daudé
2020-06-29 17:38   ` Philippe Mathieu-Daudé
2020-06-30  9:28   ` Markus Armbruster
2020-07-13 12:23   ` Cédric Le Goater
2020-07-13 12:23     ` Cédric Le Goater
2020-06-29 17:38 ` [PATCH 2/5] hw/i2c: Rename i2c_try_create_slave() as i2c_slave_new() Philippe Mathieu-Daudé
2020-06-29 17:38   ` Philippe Mathieu-Daudé
2020-06-29 21:29   ` Corey Minyard
2020-06-29 21:37   ` BALATON Zoltan
2020-06-29 21:37     ` BALATON Zoltan
2020-06-30  8:29     ` Philippe Mathieu-Daudé
2020-06-30  8:29       ` Philippe Mathieu-Daudé
2020-06-30  9:37     ` Markus Armbruster
2020-06-29 17:38 ` [PATCH 3/5] hw/i2c: Rename i2c_realize_and_unref() as i2c_slave_realize_and_unref() Philippe Mathieu-Daudé
2020-06-29 17:38   ` Philippe Mathieu-Daudé
2020-06-29 21:29   ` Corey Minyard
2020-06-29 17:38 ` [PATCH 4/5] hw/i2c: Rename i2c_create_slave() as i2c_slave_create_simple() Philippe Mathieu-Daudé
2020-06-29 17:38   ` Philippe Mathieu-Daudé
2020-06-29 21:29   ` Corey Minyard
2020-06-30  9:48   ` Markus Armbruster
2020-06-29 17:38 ` [PATCH 5/5] hw/i2c: Document the I2C qdev helpers Philippe Mathieu-Daudé
2020-06-29 17:38   ` Philippe Mathieu-Daudé
2020-06-29 21:30   ` Corey Minyard
2020-06-30 10:15   ` Markus Armbruster
2020-06-30 10:45     ` Philippe Mathieu-Daudé
2020-06-30 13:16     ` Peter Maydell
2020-07-14  7:05       ` Markus Armbruster [this message]
2020-07-14  9:32         ` Peter Maydell
2020-06-29 21:28 ` [PATCH 0/5] hw/i2c: Rename method names for consistency and add documentation Corey Minyard

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=87pn8y8tkb.fsf@dusky.pond.sub.org \
    --to=armbru@redhat.com \
    --cc=andrew@aj.id.au \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=f4bug@amsat.org \
    --cc=jan.kiszka@web.de \
    --cc=joel@jms.id.au \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.