qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
To: qemu-devel@nongnu.org
Cc: "Corey Minyard" <cminyard@mvista.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Peter Maydell" <peter.maydell@linaro.org>,
	"Titus Rwantare" <titusr@google.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Hao Wu" <wuhaotsh@google.com>,
	qemu-trivial@nongnu.org,
	"John Wang" <wangzhiqiang.bj@bytedance.com>,
	"Joel Stanley" <joel@jms.id.au>,
	qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
	"Bin Meng" <bmeng.cn@gmail.com>,
	"Cédric Le Goater" <clg@kaod.org>
Subject: [PATCH v2] hw: Add a 'Sensor devices' qdev category
Date: Wed, 27 Oct 2021 07:06:25 +0200	[thread overview]
Message-ID: <20211027050625.1265828-1-f4bug@amsat.org> (raw)

Sensors models are listed in the 'Misc devices' category.
Move them to their own category.

Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Hao Wu <wuhaotsh@google.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
v2: Only include hw/sensor/, removed AER915 device from hw/arm/z2.c
---
 include/hw/qdev-core.h | 1 +
 hw/sensor/adm1272.c    | 1 +
 hw/sensor/dps310.c     | 1 +
 hw/sensor/emc141x.c    | 1 +
 hw/sensor/max34451.c   | 2 ++
 hw/sensor/tmp105.c     | 1 +
 hw/sensor/tmp421.c     | 1 +
 softmmu/qdev-monitor.c | 1 +
 8 files changed, 9 insertions(+)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index 1bad07002df..2fd6b73bd8b 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -26,6 +26,7 @@ typedef enum DeviceCategory {
     DEVICE_CATEGORY_SOUND,
     DEVICE_CATEGORY_MISC,
     DEVICE_CATEGORY_CPU,
+    DEVICE_CATEGORY_SENSOR,
     DEVICE_CATEGORY_MAX
 } DeviceCategory;
 
diff --git a/hw/sensor/adm1272.c b/hw/sensor/adm1272.c
index 7310c769be2..2942ac75f90 100644
--- a/hw/sensor/adm1272.c
+++ b/hw/sensor/adm1272.c
@@ -518,6 +518,7 @@ static void adm1272_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     PMBusDeviceClass *k = PMBUS_DEVICE_CLASS(klass);
 
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
     dc->desc = "Analog Devices ADM1272 Hot Swap controller";
     dc->vmsd = &vmstate_adm1272;
     k->write_data = adm1272_write_data;
diff --git a/hw/sensor/dps310.c b/hw/sensor/dps310.c
index d60a18ac41b..1e24a499b38 100644
--- a/hw/sensor/dps310.c
+++ b/hw/sensor/dps310.c
@@ -208,6 +208,7 @@ static void dps310_class_init(ObjectClass *klass, void *data)
     k->send = dps310_tx;
     dc->reset = dps310_reset;
     dc->vmsd = &vmstate_dps310;
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
 }
 
 static const TypeInfo dps310_info = {
diff --git a/hw/sensor/emc141x.c b/hw/sensor/emc141x.c
index 7ce8f4e9794..4202d8f185a 100644
--- a/hw/sensor/emc141x.c
+++ b/hw/sensor/emc141x.c
@@ -270,6 +270,7 @@ static void emc141x_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
 
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
     dc->reset = emc141x_reset;
     k->event = emc141x_event;
     k->recv = emc141x_rx;
diff --git a/hw/sensor/max34451.c b/hw/sensor/max34451.c
index a91d8bd487c..8300bf4ff43 100644
--- a/hw/sensor/max34451.c
+++ b/hw/sensor/max34451.c
@@ -751,6 +751,8 @@ static void max34451_class_init(ObjectClass *klass, void *data)
     ResettableClass *rc = RESETTABLE_CLASS(klass);
     DeviceClass *dc = DEVICE_CLASS(klass);
     PMBusDeviceClass *k = PMBUS_DEVICE_CLASS(klass);
+
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
     dc->desc = "Maxim MAX34451 16-Channel V/I monitor";
     dc->vmsd = &vmstate_max34451;
     k->write_data = max34451_write_data;
diff --git a/hw/sensor/tmp105.c b/hw/sensor/tmp105.c
index 20564494899..43d79b9eeec 100644
--- a/hw/sensor/tmp105.c
+++ b/hw/sensor/tmp105.c
@@ -305,6 +305,7 @@ static void tmp105_class_init(ObjectClass *klass, void *data)
     DeviceClass *dc = DEVICE_CLASS(klass);
     I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
 
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
     dc->realize = tmp105_realize;
     k->event = tmp105_event;
     k->recv = tmp105_rx;
diff --git a/hw/sensor/tmp421.c b/hw/sensor/tmp421.c
index a3db57dcb5a..c328978af9c 100644
--- a/hw/sensor/tmp421.c
+++ b/hw/sensor/tmp421.c
@@ -343,6 +343,7 @@ static void tmp421_class_init(ObjectClass *klass, void *data)
     I2CSlaveClass *k = I2C_SLAVE_CLASS(klass);
     TMP421Class *sc = TMP421_CLASS(klass);
 
+    set_bit(DEVICE_CATEGORY_SENSOR, dc->categories);
     dc->realize = tmp421_realize;
     k->event = tmp421_event;
     k->recv = tmp421_rx;
diff --git a/softmmu/qdev-monitor.c b/softmmu/qdev-monitor.c
index 4851de51a5c..a411af03c5c 100644
--- a/softmmu/qdev-monitor.c
+++ b/softmmu/qdev-monitor.c
@@ -164,6 +164,7 @@ static void qdev_print_devinfos(bool show_no_user)
         [DEVICE_CATEGORY_SOUND]   = "Sound",
         [DEVICE_CATEGORY_MISC]    = "Misc",
         [DEVICE_CATEGORY_CPU]     = "CPU",
+        [DEVICE_CATEGORY_SENSOR]  = "Sensor",
         [DEVICE_CATEGORY_MAX]     = "Uncategorized",
     };
     GSList *list, *elt;
-- 
2.31.1



             reply	other threads:[~2021-10-27  5:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-27  5:06 Philippe Mathieu-Daudé [this message]
2021-11-01 10:21 ` [PATCH v2] hw: Add a 'Sensor devices' qdev category Philippe Mathieu-Daudé

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=20211027050625.1265828-1-f4bug@amsat.org \
    --to=f4bug@amsat.org \
    --cc=berrange@redhat.com \
    --cc=bmeng.cn@gmail.com \
    --cc=clg@kaod.org \
    --cc=cminyard@mvista.com \
    --cc=ehabkost@redhat.com \
    --cc=joel@jms.id.au \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=titusr@google.com \
    --cc=wangzhiqiang.bj@bytedance.com \
    --cc=wuhaotsh@google.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).