All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <marcandre.lureau@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Peter Maydell <peter.maydell@linaro.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>
Subject: Re: [PULL 36/37] qdev: remove QDEV_PROP_PTR
Date: Mon, 6 Jul 2020 14:01:19 +0400	[thread overview]
Message-ID: <CAMxuvaxx0bM5yhZcmc7LPmpMt-qvuB+zjhRR1mpUiNm=DyasoQ@mail.gmail.com> (raw)
In-Reply-To: <13c91f97-a7e6-adbd-9c23-2464f2b1b46e@amsat.org>

Hi

On Mon, Jul 6, 2020 at 12:44 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> On 1/7/20 4:04 PM, Marc-André Lureau wrote:
> > No longer used in the tree. The comment about user_creatable is still
> > quite relevant, but there is already a similar comment in qdev-core.h.
> >
> > Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> >  include/hw/qdev-properties.h | 22 ----------------------
> >  hw/core/qdev-properties.c    | 18 ------------------
> >  2 files changed, 40 deletions(-)
> >
> > diff --git a/include/hw/qdev-properties.h b/include/hw/qdev-properties.h
> > index 16837ab5dd..a90a9cec80 100644
> > --- a/include/hw/qdev-properties.h
> > +++ b/include/hw/qdev-properties.h
> > @@ -18,7 +18,6 @@ extern const PropertyInfo qdev_prop_size;
> >  extern const PropertyInfo qdev_prop_string;
> >  extern const PropertyInfo qdev_prop_chr;
> >  extern const PropertyInfo qdev_prop_tpm;
> > -extern const PropertyInfo qdev_prop_ptr;
> >  extern const PropertyInfo qdev_prop_macaddr;
> >  extern const PropertyInfo qdev_prop_on_off_auto;
> >  extern const PropertyInfo qdev_prop_losttickpolicy;
> > @@ -171,25 +170,6 @@ extern const PropertyInfo qdev_prop_pcie_link_width;
> >  #define DEFINE_PROP_PCI_DEVFN(_n, _s, _f, _d)                   \
> >      DEFINE_PROP_SIGNED(_n, _s, _f, _d, qdev_prop_pci_devfn, int32_t)
> >
> > -/*
> > - * Please avoid pointer properties.  If you must use them, you must
> > - * cover them in their device's class init function as follows:
> > - *
> > - * - If the property must be set, the device cannot be used with
> > - *   device_add, so add code like this:
> > - *   |* Reason: pointer property "NAME-OF-YOUR-PROP" *|
> > - *   DeviceClass *dc = DEVICE_CLASS(class);
> > - *   dc->user_creatable = false;
> > - *
> > - * - If the property may safely remain null, document it like this:
> > - *   |*
> > - *    * Note: pointer property "interrupt_vector" may remain null, thus
> > - *    * no need for dc->user_creatable = false;
> > - *    *|
> > - */
> > -#define DEFINE_PROP_PTR(_n, _s, _f)             \
> > -    DEFINE_PROP(_n, _s, _f, qdev_prop_ptr, void*)
>
> So the replacement is DEFINE_PROP_LINK()? It is not documented, but
> it takes a TYPENAME argument, so I assume we can only LINK QOM types.
> Can the documentation be improved?

Certainly, although we already have some documentation in
object_property_add_link(). It's annoying that we have several places
documenting similar/close API, or API docs in docs/ that quickly
becomes outdated, or more difficult to find. Root of the issue is that
there are at least 3 ways to add props: object_{,class}_property &
QDEV_PROPS ...

> Yet another sneaky way to force forks to either update to QOM or die...

You can't blame upstream from doing cleanups and modernization, or
stagnating. Forks are forks, with all the pain they carry. If they
want to avoid the maintenance cost, they have to do the extra effort
to get it upstream. This is also a "sneaky way" to remind them that
effort is better spent in this direction.

> > -
> >  #define DEFINE_PROP_CHR(_n, _s, _f)             \
> >      DEFINE_PROP(_n, _s, _f, qdev_prop_chr, CharBackend)
> >  #define DEFINE_PROP_STRING(_n, _s, _f)             \
> > @@ -262,8 +242,6 @@ void qdev_prop_set_drive(DeviceState *dev, const char *name,
> >  void qdev_prop_set_macaddr(DeviceState *dev, const char *name,
> >                             const uint8_t *value);
> >  void qdev_prop_set_enum(DeviceState *dev, const char *name, int value);
> > -/* FIXME: Remove opaque pointer properties.  */
> > -void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value);
> >
> >  void qdev_prop_register_global(GlobalProperty *prop);
> >  int qdev_prop_check_globals(void);
> > diff --git a/hw/core/qdev-properties.c b/hw/core/qdev-properties.c
> > index ac28890e5a..6ca7697599 100644
> > --- a/hw/core/qdev-properties.c
> > +++ b/hw/core/qdev-properties.c
> > @@ -501,13 +501,6 @@ const PropertyInfo qdev_prop_string = {
> >      .set   = set_string,
> >  };
> >
> > -/* --- pointer --- */
> > -
> > -/* Not a proper property, just for dirty hacks.  TODO Remove it!  */
> > -const PropertyInfo qdev_prop_ptr = {
> > -    .name  = "ptr",
> > -};
> > -
> >  /* --- mac address --- */
> >
> >  /*
> > @@ -1165,17 +1158,6 @@ void qdev_prop_set_enum(DeviceState *dev, const char *name, int value)
> >                              name, &error_abort);
> >  }
> >
> > -void qdev_prop_set_ptr(DeviceState *dev, const char *name, void *value)
> > -{
> > -    Property *prop;
> > -    void **ptr;
> > -
> > -    prop = qdev_prop_find(dev, name);
> > -    assert(prop && prop->info == &qdev_prop_ptr);
> > -    ptr = qdev_get_prop_ptr(dev, prop);
> > -    *ptr = value;
> > -}
> > -
> >  static GPtrArray *global_props(void)
> >  {
> >      static GPtrArray *gp;
> >
>



  reply	other threads:[~2020-07-06 10:02 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-07 15:04 [PULL 00/37] qom-ify serial and remove QDEV_PROP_PTR Marc-André Lureau
2020-01-07 15:04 ` [PULL 01/37] hw/display/sm501: Always map the UART0 Marc-André Lureau
2020-01-07 15:04 ` [PULL 02/37] sysbus: remove unused sysbus_try_create* Marc-André Lureau
2020-01-07 15:04 ` [PULL 03/37] sysbus: remove outdated comment Marc-André Lureau
2020-01-07 15:04 ` [PULL 04/37] chardev: generate an internal id when none given Marc-André Lureau
2020-01-07 15:04 ` [PULL 05/37] serial-pci-multi: factor out multi_serial_get_port_count() Marc-André Lureau
2020-01-07 15:04 ` [PULL 06/37] serial: initial qom-ification Marc-André Lureau
2020-01-07 15:04 ` [PULL 07/37] serial: register vmsd with DeviceClass Marc-André Lureau
2020-01-07 15:04 ` [PULL 08/37] serial: add "chardev" property Marc-André Lureau
2020-01-07 15:04 ` [PULL 09/37] serial: add "baudbase" property Marc-André Lureau
2020-01-07 15:04 ` [PULL 10/37] serial: realize the serial device Marc-André Lureau
2020-01-07 15:04 ` [PULL 11/37] serial: replace serial_exit_core() with unrealize Marc-André Lureau
2020-01-07 15:04 ` [PULL 12/37] serial: start making SerialMM a sysbus device Marc-André Lureau
2020-01-07 15:04 ` [PULL 13/37] serial-mm: add "regshift" property Marc-André Lureau
2020-01-07 15:04 ` [PULL 14/37] serial-mm: add endianness property Marc-André Lureau
2020-01-07 15:04 ` [PULL 15/37] serial-mm: use sysbus facilities Marc-André Lureau
2020-01-07 15:04 ` [PULL 16/37] serial: make SerialIO a sysbus device Marc-André Lureau
2020-01-07 15:04 ` [PULL 17/37] mips: inline serial_init() Marc-André Lureau
2020-01-07 15:04 ` [PULL 18/37] mips: baudbase is 115200 by default Marc-André Lureau
2020-01-07 15:04 ` [PULL 19/37] mips: use sysbus_add_io() Marc-André Lureau
2020-01-07 15:04 ` [PULL 20/37] mips: use sysbus_mmio_get_region() instead of internal fields Marc-André Lureau
2020-01-07 15:04 ` [PULL 21/37] sm501: make SerialMM a child, export chardev property Marc-André Lureau
2020-01-07 15:04 ` [PULL 22/37] vmmouse: replace PROP_PTR with PROP_LINK Marc-André Lureau
2020-01-07 15:04 ` [PULL 23/37] lance: " Marc-André Lureau
2020-01-07 15:04 ` [PULL 24/37] etraxfs: remove PROP_PTR usage Marc-André Lureau
2020-01-07 15:04 ` [PULL 25/37] dp8393x: replace PROP_PTR with PROP_LINK Marc-André Lureau
2020-01-07 15:04 ` [PULL 26/37] leon3: use qemu_irq framework instead of callback as property Marc-André Lureau
2020-01-07 15:04 ` [PULL 27/37] leon3: use qdev gpio facilities for the PIL Marc-André Lureau
2020-01-07 15:04 ` [PULL 28/37] qdev: use g_strcmp0() instead of open-coding it Marc-André Lureau
2020-01-07 15:04 ` [PULL 29/37] mips/cps: fix setting saar property Marc-André Lureau
2020-01-07 15:04 ` [PULL 30/37] cris: improve passing PIC interrupt vector to the CPU Marc-André Lureau
2020-01-07 15:04 ` [PULL 31/37] smbus-eeprom: remove PROP_PTR Marc-André Lureau
2020-01-07 15:04 ` [PULL 32/37] omap-intc: " Marc-André Lureau
2020-01-07 15:04 ` [PULL 33/37] omap-i2c: " Marc-André Lureau
2020-01-07 15:04 ` [PULL 34/37] omap-gpio: " Marc-André Lureau
2020-01-07 15:04 ` [PULL 35/37] qdev: remove PROP_MEMORY_REGION Marc-André Lureau
2020-01-07 15:04 ` [PULL 36/37] qdev: remove QDEV_PROP_PTR Marc-André Lureau
2020-07-06  8:44   ` Philippe Mathieu-Daudé
2020-07-06 10:01     ` Marc-André Lureau [this message]
2020-07-06 10:13       ` Philippe Mathieu-Daudé
2020-07-06 12:03         ` Markus Armbruster
2020-01-07 15:04 ` [PULL 37/37] qdev/qom: remove some TODO limitations now that PROP_PTR is gone Marc-André Lureau
2020-01-10 10:31 ` [PULL 00/37] qom-ify serial and remove QDEV_PROP_PTR Peter Maydell

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='CAMxuvaxx0bM5yhZcmc7LPmpMt-qvuB+zjhRR1mpUiNm=DyasoQ@mail.gmail.com' \
    --to=marcandre.lureau@redhat.com \
    --cc=armbru@redhat.com \
    --cc=f4bug@amsat.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 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.