qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: kumar sourav <sourav.jb1988@gmail.com>, qemu-trivial@nongnu.org
Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x
Date: Mon, 28 Jan 2019 09:37:29 +0100	[thread overview]
Message-ID: <33a499ed-6f6a-ccd2-a1f8-48646b6be6c9@redhat.com> (raw)
In-Reply-To: <20190127101836.15451-1-sourav.jb1988@gmail.com>

 Hi,

On 2019-01-27 11:18, kumar sourav wrote:
> Sets the category of lm832x as DEVICE_CATEGORY_INPUT
> Devices should be assigned to one of DEVICE_CATEGORY_XXXX
> 
> Signed-off-by: kumar sourav <sourav.jb1988@gmail.com>
> ---
>  hw/input/lm832x.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/input/lm832x.c b/hw/input/lm832x.c
> index cffbf586d4..07ae5e0aee 100644
> --- a/hw/input/lm832x.c
> +++ b/hw/input/lm832x.c
> @@ -509,6 +509,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data)
>      k->recv = lm_i2c_rx;
>      k->send = lm_i2c_tx;
>      dc->vmsd = &vmstate_lm_kbd;
> +    set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
>  }

This device already has DEVICE_CATEGORY_MISC set since it is derived
from TYPE_I2C_SLAVE. If you now set another category bit here, the
device shows up twice in the output of "-device help". That's not so nice.

I see multiple options here:

1) Drop this patch since the device already has a category

2) Make sure to clear_bit() the MISC category here again

3) Remove the set_bit(DEVICE_CATEGORY_MISC, k->categories) in
   hw/i2c/core.c - it does not make that much sense to set the
   MISC category for an abstract parent class.

4) Introduce a new DEVICE_CATEGORY_I2C which could be used
   instead of the DEVICE_CATEGORY_MISC in hw/i2c/core.c

One of the last two options sound most appealing to me.

 Thomas

  reply	other threads:[~2019-01-28  8:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-27 10:18 [Qemu-devel] [PATCH] hw/input/lm832x: set device category of lm832x kumar sourav
2019-01-28  8:37 ` Thomas Huth [this message]
2019-01-28 11:10   ` Philippe Mathieu-Daudé
2019-02-06 11:00     ` Thomas Huth

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=33a499ed-6f6a-ccd2-a1f8-48646b6be6c9@redhat.com \
    --to=thuth@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=sourav.jb1988@gmail.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).