hw/gpio: Convert GPIO devices to Resettable interface
Subsystems (5)
cover hw/gpio: Convert GPIO devices to Resettable interface
Convert all remaining GPIO device models in hw/gpio away from the deprecated device_class_set_legacy_reset() wrapper to the ResettableClass interface (hold phase), moving towards removing the legacy_reset callback from DeviceClass once all callers are migrated (as noted in include/hw/core/qdev.h).
---
Oscar Alejandro Sánchez Lucero (12):
hw/gpio/allwinner-gpio: Convert to Resettable interface hw/gpio/bcm2835_gpio: Convert to Resettable interface hw/gpio/bcm2838_gpio: Convert to Resettable interface hw/gpio/cadence_gpio: Convert to Resettable interface hw/gpio/gpio_key: Convert to Resettable interface hw/gpio/imx_gpio: Convert to Resettable interface hw/gpio/mpc8xxx: Convert to Resettable interface hw/gpio/nrf51_gpio: Convert to Resettable interface hw/gpio/omap_gpio: Convert to Resettable interface hw/gpio/pca9554: Convert to Resettable interface hw/gpio/pcf8574: Convert to Resettable interface hw/gpio/sifive_gpio: Convert to Resettable interface
hw/gpio/allwinner-gpio.c | 7 ++++--- hw/gpio/bcm2835_gpio.c | 7 ++++--- hw/gpio/bcm2838_gpio.c | 7 ++++--- hw/gpio/cadence_gpio.c | 7 ++++--- hw/gpio/gpio_key.c | 7 ++++--- hw/gpio/imx_gpio.c | 7 ++++--- hw/gpio/mpc8xxx.c | 7 ++++--- hw/gpio/nrf51_gpio.c | 7 ++++--- hw/gpio/omap_gpio.c | 7 ++++--- hw/gpio/pca9554.c | 7 ++++--- hw/gpio/pcf8574.c | 7 ++++--- hw/gpio/sifive_gpio.c | 7 ++++--- 12 files changed, 48 insertions(+), 36 deletions(-)
---
base-commit: bbece0805c03c25f51a8cd89c39142f4f76a6567
change-id: 20261202-gpio-resettable-48db03e05854
Best regards,
Signature · 1 line
Oscar Alejandro Sánchez Lucero <[email protected]>
PATCH 1/12 hw/gpio/allwinner-gpio: Convert to Resettable interface
Replace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in allwinner_gpio_reset_hold().
--- hw/gpio/allwinner-gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/allwinner-gpio.c +4 -3
@@ -391,9 +391,9 @@ static const VMStateDescription vmstate_allwinner_gpio = { } }; -static void allwinner_gpio_reset (DeviceState *dev) +static void allwinner_gpio_reset_hold (Object *obj,ResetType type) { -AWGPIOState *s =AW_GPIO (dev); +AWGPIOState *s =AW_GPIO (obj);AWPortsOverlay *o = (AWPortsOverlay *)s->regs;memset (s->regs,0 ,AW_GPIO_IOSIZE );
@@ -428,9 +428,10 @@ static void allwinner_gpio_realize(DeviceState *dev, Error **errp)static void allwinner_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->realize = allwinner_gpio_realize; -device_class_set_legacy_reset (dc, allwinner_gpio_reset); + rc->phases.hold = allwinner_gpio_reset_hold; dc->vmsd = &vmstate_allwinner_gpio; dc->desc ="Allwinner GPIO controller" ; }
Signature · 1 line
2.53.0
PATCH 2/12 hw/gpio/bcm2835_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in bcm2835_gpio_reset_hold().
--- hw/gpio/bcm2835_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/bcm2835_gpio.c +4 -3
@@ -256,9 +256,9 @@ err_out: __func__, offset); } -static void bcm2835_gpio_reset (DeviceState *dev) +static void bcm2835_gpio_reset_hold (Object *obj,ResetType type) { -BCM2835GpioState *s =BCM2835_GPIO (dev); +BCM2835GpioState *s =BCM2835_GPIO (obj);int i;for (i =0 ; i <6 ; i++) {
@@ -322,10 +322,11 @@ static void bcm2835_gpio_realize(DeviceState *dev, Error **errp)static void bcm2835_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->vmsd = &vmstate_bcm2835_gpio; dc->realize = &bcm2835_gpio_realize; -device_class_set_legacy_reset (dc, bcm2835_gpio_reset); + rc->phases.hold = bcm2835_gpio_reset_hold; }static const TypeInfo bcm2835_gpio_info = {
Signature · 1 line
2.53.0
PATCH 3/12 hw/gpio/bcm2838_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in bcm2838_gpio_reset_hold().
--- hw/gpio/bcm2838_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/bcm2838_gpio.c +4 -3
@@ -295,9 +295,9 @@ static void bcm2838_gpio_write(void *opaque, hwaddr offset, uint64_t value, } } -static void bcm2838_gpio_reset (DeviceState *dev) +static void bcm2838_gpio_reset_hold (Object *obj,ResetType type) { -BCM2838GpioState *s =BCM2838_GPIO (dev); +BCM2838GpioState *s =BCM2838_GPIO (obj);memset (s->fsel,0 ,sizeof (s->fsel));
@@ -367,10 +367,11 @@ static void bcm2838_gpio_realize(DeviceState *dev, Error **errp)static void bcm2838_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->vmsd = &vmstate_bcm2838_gpio; dc->realize = &bcm2838_gpio_realize; -device_class_set_legacy_reset (dc, bcm2838_gpio_reset); + rc->phases.hold = bcm2838_gpio_reset_hold; }static const TypeInfo bcm2838_gpio_info = {
Signature · 1 line
2.53.0
PATCH 4/12 hw/gpio/cadence_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in cdns_gpio_reset_hold().
--- hw/gpio/cadence_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/cadence_gpio.c +4 -3
@@ -237,9 +237,9 @@ static const VMStateDescription vmstate_cdns_gpio = { } }; -static void cdns_gpio_reset (DeviceState *dev) +static void cdns_gpio_reset_hold (Object *obj,ResetType type) { -CadenceGPIOState *s =CADENCE_GPIO (dev); +CadenceGPIOState *s =CADENCE_GPIO (obj); s->bmr =0 ; s->dmr =0 ;
@@ -270,8 +270,9 @@ static void cdns_gpio_init(Object *obj)static void cdns_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); -device_class_set_legacy_reset (dc, cdns_gpio_reset); + rc->phases.hold = cdns_gpio_reset_hold; dc->vmsd = &vmstate_cdns_gpio; dc->desc ="Cadence GPIO controller" ; }
Signature · 1 line
2.53.0
PATCH 5/12 hw/gpio/gpio_key: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in gpio_key_reset_hold().
--- hw/gpio/gpio_key.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/gpio_key.c +4 -3
@@ -51,9 +51,9 @@ static const VMStateDescription vmstate_gpio_key = { } }; -static void gpio_key_reset (DeviceState *dev) +static void gpio_key_reset_hold (Object *obj,ResetType type) { -GPIOKEYState *s =GPIOKEY (dev); +GPIOKEYState *s =GPIOKEY (obj);timer_del (s->timer); }
@@ -88,10 +88,11 @@ static void gpio_key_realize(DeviceState *dev, Error **errp)static void gpio_key_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->realize = gpio_key_realize; dc->vmsd = &vmstate_gpio_key; -device_class_set_legacy_reset (dc, gpio_key_reset); + rc->phases.hold = gpio_key_reset_hold; }static const TypeInfo gpio_key_info = {
Signature · 1 line
2.53.0
PATCH 6/12 hw/gpio/imx_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in imx_gpio_reset_hold().
--- hw/gpio/imx_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/imx_gpio.c +4 -3
@@ -290,9 +290,9 @@ static const Property imx_gpio_properties[] = { false), }; -static void imx_gpio_reset (DeviceState *dev) +static void imx_gpio_reset_hold (Object *obj,ResetType type) { -IMXGPIOState *s =IMX_GPIO (dev); +IMXGPIOState *s =IMX_GPIO (obj); s->dr =0 ; s->gdir =0 ;
@@ -324,9 +324,10 @@ static void imx_gpio_realize(DeviceState *dev, Error **errp)static void imx_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->realize = imx_gpio_realize; -device_class_set_legacy_reset (dc, imx_gpio_reset); + rc->phases.hold = imx_gpio_reset_hold;device_class_set_props (dc, imx_gpio_properties); dc->vmsd = &vmstate_imx_gpio; dc->desc ="i.MX GPIO controller" ;
Signature · 1 line
2.53.0
PATCH 7/12 hw/gpio/mpc8xxx: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in mpc8xxx_gpio_reset_hold().
--- hw/gpio/mpc8xxx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/mpc8xxx.c +4 -3
@@ -146,9 +146,9 @@ static void mpc8xxx_gpio_write(void *opaque, hwaddr offset,mpc8xxx_gpio_update (s); } -static void mpc8xxx_gpio_reset (DeviceState *dev) +static void mpc8xxx_gpio_reset_hold (Object *obj,ResetType type) { -MPC8XXXGPIOState *s =MPC8XXX_GPIO (dev); +MPC8XXXGPIOState *s =MPC8XXX_GPIO (obj); s->dir =0 ; s->odr =0 ;
@@ -202,9 +202,10 @@ static void mpc8xxx_gpio_initfn(Object *obj)static void mpc8xxx_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->vmsd = &vmstate_mpc8xxx_gpio; -device_class_set_legacy_reset (dc, mpc8xxx_gpio_reset); + rc->phases.hold = mpc8xxx_gpio_reset_hold; }static const TypeInfo mpc8xxx_gpio_types[] = {
Signature · 1 line
2.53.0
PATCH 8/12 hw/gpio/nrf51_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in nrf51_gpio_reset_hold().
--- hw/gpio/nrf51_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/nrf51_gpio.c +4 -3
@@ -258,9 +258,9 @@ static void nrf51_gpio_set(void *opaque, int line, int value)update_state (s); } -static void nrf51_gpio_reset (DeviceState *dev) +static void nrf51_gpio_reset_hold (Object *obj,ResetType type) { -NRF51GPIOState *s =NRF51_GPIO (dev); +NRF51GPIOState *s =NRF51_GPIO (obj);size_t i; s->out =0 ;
@@ -307,9 +307,10 @@ static void nrf51_gpio_init(Object *obj)static void nrf51_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->vmsd = &vmstate_nrf51_gpio; -device_class_set_legacy_reset (dc, nrf51_gpio_reset); + rc->phases.hold = nrf51_gpio_reset_hold; dc->desc ="nRF51 GPIO" ; }
Signature · 1 line
2.53.0
PATCH 9/12 hw/gpio/omap_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in omap_gpif_reset_hold().
--- hw/gpio/omap_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/omap_gpio.c +4 -3
@@ -192,9 +192,9 @@ static void omap_gpio_reset(struct omap_gpio_s *s) s->pins = ~0 ; } -static void omap_gpif_reset (DeviceState *dev) +static void omap_gpif_reset_hold (Object *obj,ResetType type) { -Omap1GpioState *s =OMAP1_GPIO (dev); +Omap1GpioState *s =OMAP1_GPIO (obj);omap_gpio_reset (&s->omap1); }
@@ -230,9 +230,10 @@ void omap_gpio_set_clk(Omap1GpioState *gpio, omap_clk clk)static void omap_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); dc->realize = omap_gpio_realize; -device_class_set_legacy_reset (dc, omap_gpif_reset); + rc->phases.hold = omap_gpif_reset_hold;/* Reason: pointer property "clk" */ dc->user_creatable = false; }
Signature · 1 line
2.53.0
PATCH 10/12 hw/gpio/pca9554: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in pca9554_reset_hold().
--- hw/gpio/pca9554.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/pca9554.c +4 -3
@@ -254,9 +254,9 @@ static const VMStateDescription pca9554_vmstate = { } }; -static void pca9554_reset (DeviceState *dev) +static void pca9554_reset_hold (Object *obj,ResetType type) { -PCA9554State *s =PCA9554 (dev); +PCA9554State *s =PCA9554 (obj);PCA9554Class *pc =PCA9554_GET_CLASS (s);uint8_t pin_mask = (1 << pc->pin_count) -1 ;
@@ -320,12 +320,13 @@ static void pca9554_class_init(ObjectClass *klass, const void *data)DeviceClass *dc =DEVICE_CLASS (klass);I2CSlaveClass *k =I2C_SLAVE_CLASS (klass);PCA9554Class *pc =PCA9554_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); k->event = pca9554_event; k->recv = pca9554_recv; k->send = pca9554_send; dc->realize = pca9554_realize; -device_class_set_legacy_reset (dc, pca9554_reset); + rc->phases.hold = pca9554_reset_hold; dc->vmsd = &pca9554_vmstate;device_class_set_props (dc, pca9554_properties);
Signature · 1 line
2.53.0
PATCH 11/12 hw/gpio/pcf8574: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in pcf8574_reset_hold().
--- hw/gpio/pcf8574.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/pcf8574.c +4 -3
@@ -47,9 +47,9 @@ struct PCF8574State {qemu_irq intrq;/* External irq request */ }; -static void pcf8574_reset (DeviceState *dev) +static void pcf8574_reset_hold (Object *obj,ResetType type) { -PCF8574State *s =PCF8574 (dev); +PCF8574State *s =PCF8574 (obj); s->lastrq =MAKE_64BIT_MASK (0 ,PORTS_COUNT ); s->input =MAKE_64BIT_MASK (0 ,PORTS_COUNT ); s->output =MAKE_64BIT_MASK (0 ,PORTS_COUNT );
@@ -142,11 +142,12 @@ static void pcf8574_class_init(ObjectClass *klass, const void *data) {DeviceClass *dc =DEVICE_CLASS (klass);I2CSlaveClass *k =I2C_SLAVE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass); k->recv = pcf8574_rx; k->send = pcf8574_tx; dc->realize = pcf8574_realize; -device_class_set_legacy_reset (dc, pcf8574_reset); + rc->phases.hold = pcf8574_reset_hold; dc->vmsd = &vmstate_pcf8574; }
Signature · 1 line
2.53.0
PATCH 12/12 hw/gpio/sifive_gpio: Convert to Resettable interface
In reply to Oscar Alejandro Sánchez LuceroReplace the deprecated device_class_set_legacy_reset() with the Resettable interface by implementing the hold phase in sifive_gpio_reset_hold().
--- hw/gpio/sifive_gpio.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/gpio/sifive_gpio.c +4 -3
@@ -297,9 +297,9 @@ static void sifive_gpio_set(void *opaque, int line, int value)update_state (s); } -static void sifive_gpio_reset (DeviceState *dev) +static void sifive_gpio_reset_hold (Object *obj,ResetType type) { -SIFIVEGPIOState *s =SIFIVE_GPIO (dev); +SIFIVEGPIOState *s =SIFIVE_GPIO (obj); s->value =0 ; s->input_en =0 ;
@@ -373,11 +373,12 @@ static void sifive_gpio_realize(DeviceState *dev, Error **errp)static void sifive_gpio_class_init (ObjectClass *klass,const void *data) {DeviceClass *dc =DEVICE_CLASS (klass); +ResettableClass *rc =RESETTABLE_CLASS (klass);device_class_set_props (dc, sifive_gpio_properties); dc->vmsd = &vmstate_sifive_gpio; dc->realize = sifive_gpio_realize; -device_class_set_legacy_reset (dc, sifive_gpio_reset); + rc->phases.hold = sifive_gpio_reset_hold; dc->desc ="SiFive GPIO" ; }
Signature · 1 line
2.53.0