Marc-André converted properties "pin" and "led" to QAPI enums in his
"qom/qdev: associate properties with QAPI schema types". I dropped
this part from v8, which has since been merged in commit c5fee4d93fd.
I'm now bringing it back, reworked.
PATCH 1-5 convert these properties to class properties. See commit
7674a1880890 (qom: deprecate use of instance level properties) for
why.
PATCH 6 is Marc-André's "[PATCH v7 48/65] hw/gpio/pca955x: use QAPI
enums for led and pin properties" with the following tweaks:
* I don't change their @type in output of qom-list,
qom-list-properties, qom-list-get, because that what the merged
version of his series did.
* I replaced identical QAPI enums Pca9552PinState and Pca9554PinState
by a single enum GpioPinState.
PATCH 7+8 replace Marc-André's "[PATCH v7 50/65] hw/gpio/pca955x:
convert pin/led property to QAPI-aware enum". Marc-André's used
object_property_add_qapi_enum() (which has since been folded into
object_property_add_enum()), but to be able to use it, he had to bake
the index into getter and the setter functions. He generated them
with the preprocessor. My version sticks to
object_class_property_add(), so we can pass the index to getter and
setter via parameter @opaque. Getter and setter remain slightly more
complex, but don't turn into macros (decorated with backslashes) for
sixteenfold duplication.
Perhaps object_class_property_add_enum() should support passing an
opaque value to getter and setter.
Based-on: <20261105080310.1656968-1-armbru@redhat.com>
Marc-André Lureau (1):
hw/gpio/pca955x: use QAPI enums for led and pin properties
Markus Armbruster (7):
hw/gpio/pca9552: Convert pin and led properties to class properties
hw/gpio/pca9554: Move most code from .h to .c
hw/gpio/pca9554: Simplify QOM type creation
hw/gpio/pca9554: New abstract base "pca9554-base"
hw/gpio/pca9554: Convert pin properties to class properties
hw/gpio/pca955x: Improve @qapi-type reported by qom-list etc.
hw/gpio/pca955x: Simplify pin and led getters and setters
qapi/machine.json | 29 ++++++++
include/hw/gpio/pca9554.h | 26 +------
hw/gpio/pca9552.c | 149 +++++++++++++------------------------
hw/gpio/pca9554.c | 151 +++++++++++++++++++-------------------
4 files changed, 160 insertions(+), 195 deletions(-)
--
2.55.0