All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Cc: libvir-list@redhat.com, Prasad J Pandit <ppandit@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] qdev: add deprecation_reason to DeviceClass
Date: Thu, 25 Oct 2018 13:12:15 +0200	[thread overview]
Message-ID: <34baf361-0f1a-cdb2-9b2e-bef68dbfd154@redhat.com> (raw)
In-Reply-To: <20181025085256.20522-2-kraxel@redhat.com>

Hi Gerd,

On 25/10/18 10:52, Gerd Hoffmann wrote:
> Simliar to deprecated machine types.

"Similar"

> Print a warning when creating a deprecated device.
> Add deprecation notice to -device help.
> 
> TODO: add to intospection.

"introspection"

Do we want the TODO in the git history?

> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   hw/core/qdev.c         | 9 ++++++++-
>   include/hw/qdev-core.h | 1 +
>   qdev-monitor.c         | 7 +++++++
>   3 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/core/qdev.c b/hw/core/qdev.c
> index 046d8f1..3b27a74 100644
> --- a/hw/core/qdev.c
> +++ b/hw/core/qdev.c
> @@ -133,11 +133,18 @@ DeviceState *qdev_create(BusState *bus, const char *name)
>   
>   DeviceState *qdev_try_create(BusState *bus, const char *type)
>   {
> +    DeviceClass *dc;
>       DeviceState *dev;
>   
> -    if (object_class_by_name(type) == NULL) {
> +    dc = DEVICE_CLASS(object_class_by_name(type));
> +    if (dc == NULL) {
>           return NULL;
>       }
> +    if (dc->deprecation_reason) {
> +        warn_report("device %s is deprecated (%s)",
> +                    type, dc->deprecation_reason);
> +    }
> +
>       dev = DEVICE(object_new(type));
>       if (!dev) {
>           return NULL;
> diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
> index a24d0dd..a352eaa 100644
> --- a/include/hw/qdev-core.h
> +++ b/include/hw/qdev-core.h
> @@ -105,6 +105,7 @@ typedef struct DeviceClass {
>        */
>       bool user_creatable;
>       bool hotpluggable;
> +    const char *deprecation_reason;
>   
>       /* callbacks */
>       DeviceReset reset;
> diff --git a/qdev-monitor.c b/qdev-monitor.c
> index 802c18a..bbba2bc 100644
> --- a/qdev-monitor.c
> +++ b/qdev-monitor.c
> @@ -128,6 +128,9 @@ static void qdev_print_devinfo(DeviceClass *dc)
>       if (!dc->user_creatable) {
>           out_printf(", no-user");
>       }
> +    if (!dc->deprecation_reason) {

This is the opposite condition:

        if (dc->deprecation_reason) {
            out_printf(", deprecated");

With it fixed:
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

> +        out_printf(", deprecated");
> +    }
>       out_printf("\n");
>   }
>   
> @@ -579,6 +582,10 @@ DeviceState *qdev_device_add(QemuOpts *opts, Error **errp)
>       if (!dc) {
>           return NULL;
>       }
> +    if (dc->deprecation_reason) {
> +        warn_report("device %s is deprecated (%s)",
> +                    driver, dc->deprecation_reason);
> +    }
>   
>       /* find bus */
>       path = qemu_opt_get(opts, "bus");
> 

  parent reply	other threads:[~2018-10-25 11:12 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-25  8:52 [Qemu-devel] [PATCH 0/3] RfC: add support for deprecated devices Gerd Hoffmann
2018-10-25  8:52 ` [Qemu-devel] [PATCH 1/3] qdev: add deprecation_reason to DeviceClass Gerd Hoffmann
2018-10-25 10:50   ` P J P
2018-10-25 11:12   ` Philippe Mathieu-Daudé [this message]
2018-10-29  9:19     ` Gerd Hoffmann
2018-10-25  8:52 ` [Qemu-devel] [PATCH 2/3] adlib: mark as insecure and deprecated Gerd Hoffmann
2018-10-25 10:56   ` P J P
2018-10-25 20:40     ` [Qemu-devel] [libvirt] " Daniel P. Berrangé
2018-10-26  7:08       ` P J P
2018-10-26  9:54         ` Daniel P. Berrangé
2018-10-26 12:35           ` P J P
2018-10-25 11:15   ` [Qemu-devel] " Philippe Mathieu-Daudé
2018-10-25 20:27   ` Thomas Huth
2018-10-26  8:48   ` Paolo Bonzini
2018-10-26  9:34     ` P J P
2018-10-26 10:01       ` Paolo Bonzini
2018-10-26 11:53         ` P J P
2018-10-29  9:05           ` Gerd Hoffmann
2018-10-25  8:52 ` [Qemu-devel] [PATCH 3/3] cirrus: mark as deprecated Gerd Hoffmann
2018-10-25 10:59   ` P J P
2018-10-25 11:17   ` Philippe Mathieu-Daudé
2018-10-25 20:28   ` Thomas Huth
2018-10-25 20:37   ` Daniel P. Berrangé
2018-10-26  7:03     ` P J P
2018-10-26  9:42       ` Daniel P. Berrangé
2018-10-26  9:59         ` Daniel P. Berrangé
2018-10-26 10:03           ` Paolo Bonzini
2018-10-26 14:14             ` Daniel P. Berrangé
2018-10-26 18:56               ` P J P
2018-10-26 10:40         ` Dr. David Alan Gilbert
2018-10-26 13:25         ` [Qemu-devel] [libvirt] " Christian Borntraeger
2018-10-26  8:48     ` Cole Robinson
2018-10-26  9:43       ` Daniel P. Berrangé
2018-10-29  9:12     ` [Qemu-devel] " Gerd Hoffmann
2018-10-30 18:00       ` Daniel P. Berrangé

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=34baf361-0f1a-cdb2-9b2e-bef68dbfd154@redhat.com \
    --to=philmd@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=libvir-list@redhat.com \
    --cc=ppandit@redhat.com \
    --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.