From 4f67d30b5e74e060b8dbe10528829b47345cd6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 10 Jan 2020 19:30:32 +0400 Subject: qdev: set properties with device_class_set_props() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The following patch will need to handle properties registration during class_init time. Let's use a device_class_set_props() setter. spatch --macro-file scripts/cocci-macro-file.h --sp-file ./scripts/coccinelle/qdev-set-props.cocci --keep-comments --in-place --dir . @@ typedef DeviceClass; DeviceClass *d; expression val; @@ - d->props = val + device_class_set_props(d, val) Signed-off-by: Marc-André Lureau Message-Id: <20200110153039.1379601-20-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- hw/char/bcm2835_aux.c | 2 +- hw/char/cadence_uart.c | 2 +- hw/char/cmsdk-apb-uart.c | 2 +- hw/char/debugcon.c | 2 +- hw/char/digic-uart.c | 2 +- hw/char/escc.c | 2 +- hw/char/etraxfs_ser.c | 2 +- hw/char/exynos4210_uart.c | 2 +- hw/char/grlib_apbuart.c | 2 +- hw/char/imx_serial.c | 2 +- hw/char/ipoctal232.c | 2 +- hw/char/lm32_juart.c | 2 +- hw/char/lm32_uart.c | 2 +- hw/char/mcf_uart.c | 2 +- hw/char/milkymist-uart.c | 2 +- hw/char/nrf51_uart.c | 2 +- hw/char/parallel.c | 2 +- hw/char/pl011.c | 2 +- hw/char/sclpconsole-lm.c | 2 +- hw/char/sclpconsole.c | 2 +- hw/char/serial-isa.c | 2 +- hw/char/serial-pci-multi.c | 4 ++-- hw/char/serial-pci.c | 2 +- hw/char/serial.c | 4 ++-- hw/char/spapr_vty.c | 2 +- hw/char/stm32f2xx_usart.c | 2 +- hw/char/terminal3270.c | 2 +- hw/char/virtio-console.c | 2 +- hw/char/virtio-serial-bus.c | 4 ++-- hw/char/xilinx_uartlite.c | 2 +- 30 files changed, 33 insertions(+), 33 deletions(-) (limited to 'hw/char') diff --git a/hw/char/bcm2835_aux.c b/hw/char/bcm2835_aux.c index a6fc1bf..ee3dd40 100644 --- a/hw/char/bcm2835_aux.c +++ b/hw/char/bcm2835_aux.c @@ -299,7 +299,7 @@ static void bcm2835_aux_class_init(ObjectClass *oc, void *data) dc->realize = bcm2835_aux_realize; dc->vmsd = &vmstate_bcm2835_aux; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - dc->props = bcm2835_aux_props; + device_class_set_props(dc, bcm2835_aux_props); } static const TypeInfo bcm2835_aux_info = { diff --git a/hw/char/cadence_uart.c b/hw/char/cadence_uart.c index 51791bd..22e4797 100644 --- a/hw/char/cadence_uart.c +++ b/hw/char/cadence_uart.c @@ -550,7 +550,7 @@ static void cadence_uart_class_init(ObjectClass *klass, void *data) dc->realize = cadence_uart_realize; dc->vmsd = &vmstate_cadence_uart; dc->reset = cadence_uart_reset; - dc->props = cadence_uart_properties; + device_class_set_props(dc, cadence_uart_properties); } static const TypeInfo cadence_uart_info = { diff --git a/hw/char/cmsdk-apb-uart.c b/hw/char/cmsdk-apb-uart.c index 9e1aa43..626b68f 100644 --- a/hw/char/cmsdk-apb-uart.c +++ b/hw/char/cmsdk-apb-uart.c @@ -389,7 +389,7 @@ static void cmsdk_apb_uart_class_init(ObjectClass *klass, void *data) dc->realize = cmsdk_apb_uart_realize; dc->vmsd = &cmsdk_apb_uart_vmstate; dc->reset = cmsdk_apb_uart_reset; - dc->props = cmsdk_apb_uart_properties; + device_class_set_props(dc, cmsdk_apb_uart_properties); } static const TypeInfo cmsdk_apb_uart_info = { diff --git a/hw/char/debugcon.c b/hw/char/debugcon.c index 5c592e0..c8d938e 100644 --- a/hw/char/debugcon.c +++ b/hw/char/debugcon.c @@ -125,7 +125,7 @@ static void debugcon_isa_class_initfn(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->realize = debugcon_isa_realizefn; - dc->props = debugcon_isa_properties; + device_class_set_props(dc, debugcon_isa_properties); set_bit(DEVICE_CATEGORY_MISC, dc->categories); } diff --git a/hw/char/digic-uart.c b/hw/char/digic-uart.c index 033eba0..e130cb4 100644 --- a/hw/char/digic-uart.c +++ b/hw/char/digic-uart.c @@ -183,7 +183,7 @@ static void digic_uart_class_init(ObjectClass *klass, void *data) dc->realize = digic_uart_realize; dc->reset = digic_uart_reset; dc->vmsd = &vmstate_digic_uart; - dc->props = digic_uart_properties; + device_class_set_props(dc, digic_uart_properties); } static const TypeInfo digic_uart_info = { diff --git a/hw/char/escc.c b/hw/char/escc.c index c40c1d2..7d16ee8 100644 --- a/hw/char/escc.c +++ b/hw/char/escc.c @@ -865,7 +865,7 @@ static void escc_class_init(ObjectClass *klass, void *data) dc->reset = escc_reset; dc->realize = escc_realize; dc->vmsd = &vmstate_escc; - dc->props = escc_properties; + device_class_set_props(dc, escc_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/etraxfs_ser.c b/hw/char/etraxfs_ser.c index f34f767..947bdb6 100644 --- a/hw/char/etraxfs_ser.c +++ b/hw/char/etraxfs_ser.c @@ -244,7 +244,7 @@ static void etraxfs_ser_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->reset = etraxfs_ser_reset; - dc->props = etraxfs_ser_properties; + device_class_set_props(dc, etraxfs_ser_properties); dc->realize = etraxfs_ser_realize; } diff --git a/hw/char/exynos4210_uart.c b/hw/char/exynos4210_uart.c index 7e5c5ce..238aa0a 100644 --- a/hw/char/exynos4210_uart.c +++ b/hw/char/exynos4210_uart.c @@ -645,7 +645,7 @@ static void exynos4210_uart_class_init(ObjectClass *klass, void *data) dc->realize = exynos4210_uart_realize; dc->reset = exynos4210_uart_reset; - dc->props = exynos4210_uart_properties; + device_class_set_props(dc, exynos4210_uart_properties); dc->vmsd = &vmstate_exynos4210_uart; } diff --git a/hw/char/grlib_apbuart.c b/hw/char/grlib_apbuart.c index 8e59c3b..16d0fea 100644 --- a/hw/char/grlib_apbuart.c +++ b/hw/char/grlib_apbuart.c @@ -285,7 +285,7 @@ static void grlib_apbuart_class_init(ObjectClass *klass, void *data) dc->realize = grlib_apbuart_realize; dc->reset = grlib_apbuart_reset; - dc->props = grlib_apbuart_properties; + device_class_set_props(dc, grlib_apbuart_properties); } static const TypeInfo grlib_apbuart_info = { diff --git a/hw/char/imx_serial.c b/hw/char/imx_serial.c index d09c210..731b8fc 100644 --- a/hw/char/imx_serial.c +++ b/hw/char/imx_serial.c @@ -372,7 +372,7 @@ static void imx_serial_class_init(ObjectClass *klass, void *data) dc->reset = imx_serial_reset_at_boot; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); dc->desc = "i.MX series UART"; - dc->props = imx_serial_properties; + device_class_set_props(dc, imx_serial_properties); } static const TypeInfo imx_serial_info = { diff --git a/hw/char/ipoctal232.c b/hw/char/ipoctal232.c index 80e9dff..d7c497b 100644 --- a/hw/char/ipoctal232.c +++ b/hw/char/ipoctal232.c @@ -588,7 +588,7 @@ static void ipoctal_class_init(ObjectClass *klass, void *data) set_bit(DEVICE_CATEGORY_INPUT, dc->categories); dc->desc = "GE IP-Octal 232 8-channel RS-232 IndustryPack"; - dc->props = ipoctal_properties; + device_class_set_props(dc, ipoctal_properties); dc->vmsd = &vmstate_ipoctal; } diff --git a/hw/char/lm32_juart.c b/hw/char/lm32_juart.c index da9dd56..3f34861 100644 --- a/hw/char/lm32_juart.c +++ b/hw/char/lm32_juart.c @@ -146,7 +146,7 @@ static void lm32_juart_class_init(ObjectClass *klass, void *data) dc->reset = juart_reset; dc->vmsd = &vmstate_lm32_juart; - dc->props = lm32_juart_properties; + device_class_set_props(dc, lm32_juart_properties); dc->realize = lm32_juart_realize; } diff --git a/hw/char/lm32_uart.c b/hw/char/lm32_uart.c index 8d7a475..b0b1092 100644 --- a/hw/char/lm32_uart.c +++ b/hw/char/lm32_uart.c @@ -293,7 +293,7 @@ static void lm32_uart_class_init(ObjectClass *klass, void *data) dc->reset = uart_reset; dc->vmsd = &vmstate_lm32_uart; - dc->props = lm32_uart_properties; + device_class_set_props(dc, lm32_uart_properties); dc->realize = lm32_uart_realize; } diff --git a/hw/char/mcf_uart.c b/hw/char/mcf_uart.c index 2de3680..97e4bbc 100644 --- a/hw/char/mcf_uart.c +++ b/hw/char/mcf_uart.c @@ -320,7 +320,7 @@ static void mcf_uart_class_init(ObjectClass *oc, void *data) dc->realize = mcf_uart_realize; dc->reset = mcf_uart_reset; - dc->props = mcf_uart_properties; + device_class_set_props(dc, mcf_uart_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/milkymist-uart.c b/hw/char/milkymist-uart.c index 1c7b614..1439efb 100644 --- a/hw/char/milkymist-uart.c +++ b/hw/char/milkymist-uart.c @@ -239,7 +239,7 @@ static void milkymist_uart_class_init(ObjectClass *klass, void *data) dc->realize = milkymist_uart_realize; dc->reset = milkymist_uart_reset; dc->vmsd = &vmstate_milkymist_uart; - dc->props = milkymist_uart_properties; + device_class_set_props(dc, milkymist_uart_properties); } static const TypeInfo milkymist_uart_info = { diff --git a/hw/char/nrf51_uart.c b/hw/char/nrf51_uart.c index b67fd21..d1fef77 100644 --- a/hw/char/nrf51_uart.c +++ b/hw/char/nrf51_uart.c @@ -314,7 +314,7 @@ static void nrf51_uart_class_init(ObjectClass *klass, void *data) dc->reset = nrf51_uart_reset; dc->realize = nrf51_uart_realize; - dc->props = nrf51_uart_properties; + device_class_set_props(dc, nrf51_uart_properties); dc->vmsd = &nrf51_uart_vmstate; } diff --git a/hw/char/parallel.c b/hw/char/parallel.c index 40174ee..8dd67d1 100644 --- a/hw/char/parallel.c +++ b/hw/char/parallel.c @@ -627,7 +627,7 @@ static void parallel_isa_class_initfn(ObjectClass *klass, void *data) dc->realize = parallel_isa_realizefn; dc->vmsd = &vmstate_parallel_isa; - dc->props = parallel_isa_properties; + device_class_set_props(dc, parallel_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 23cd544..13e784f 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -356,7 +356,7 @@ static void pl011_class_init(ObjectClass *oc, void *data) dc->realize = pl011_realize; dc->vmsd = &vmstate_pl011; - dc->props = pl011_properties; + device_class_set_props(dc, pl011_properties); } static const TypeInfo pl011_arm_info = { diff --git a/hw/char/sclpconsole-lm.c b/hw/char/sclpconsole-lm.c index 3926062..c420dc0 100644 --- a/hw/char/sclpconsole-lm.c +++ b/hw/char/sclpconsole-lm.c @@ -342,7 +342,7 @@ static void console_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); SCLPEventClass *ec = SCLP_EVENT_CLASS(klass); - dc->props = console_properties; + device_class_set_props(dc, console_properties); dc->reset = console_reset; dc->vmsd = &vmstate_sclplmconsole; ec->init = console_init; diff --git a/hw/char/sclpconsole.c b/hw/char/sclpconsole.c index da126f0..1fa124d 100644 --- a/hw/char/sclpconsole.c +++ b/hw/char/sclpconsole.c @@ -258,7 +258,7 @@ static void console_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); SCLPEventClass *ec = SCLP_EVENT_CLASS(klass); - dc->props = console_properties; + device_class_set_props(dc, console_properties); dc->reset = console_reset; dc->vmsd = &vmstate_sclpconsole; ec->init = console_init; diff --git a/hw/char/serial-isa.c b/hw/char/serial-isa.c index db86445..f9b6eed 100644 --- a/hw/char/serial-isa.c +++ b/hw/char/serial-isa.c @@ -106,7 +106,7 @@ static void serial_isa_class_initfn(ObjectClass *klass, void *data) dc->realize = serial_isa_realizefn; dc->vmsd = &vmstate_isa_serial; - dc->props = serial_isa_properties; + device_class_set_props(dc, serial_isa_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/serial-pci-multi.c b/hw/char/serial-pci-multi.c index e343a12..1742cb7 100644 --- a/hw/char/serial-pci-multi.c +++ b/hw/char/serial-pci-multi.c @@ -161,7 +161,7 @@ static void multi_2x_serial_pci_class_initfn(ObjectClass *klass, void *data) pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial; - dc->props = multi_2x_serial_pci_properties; + device_class_set_props(dc, multi_2x_serial_pci_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } @@ -176,7 +176,7 @@ static void multi_4x_serial_pci_class_initfn(ObjectClass *klass, void *data) pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_multi_serial; - dc->props = multi_4x_serial_pci_properties; + device_class_set_props(dc, multi_4x_serial_pci_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/serial-pci.c b/hw/char/serial-pci.c index b6a73c6..743552c 100644 --- a/hw/char/serial-pci.c +++ b/hw/char/serial-pci.c @@ -100,7 +100,7 @@ static void serial_pci_class_initfn(ObjectClass *klass, void *data) pc->revision = 1; pc->class_id = PCI_CLASS_COMMUNICATION_SERIAL; dc->vmsd = &vmstate_pci_serial; - dc->props = serial_pci_properties; + device_class_set_props(dc, serial_pci_properties); set_bit(DEVICE_CATEGORY_INPUT, dc->categories); } diff --git a/hw/char/serial.c b/hw/char/serial.c index d167c43..9298881 100644 --- a/hw/char/serial.c +++ b/hw/char/serial.c @@ -1044,7 +1044,7 @@ static void serial_class_init(ObjectClass *klass, void* data) dc->realize = serial_realize; dc->unrealize = serial_unrealize; dc->vmsd = &vmstate_serial; - dc->props = serial_properties; + device_class_set_props(dc, serial_properties); } static const TypeInfo serial_info = { @@ -1159,7 +1159,7 @@ static void serial_mm_class_init(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); - dc->props = serial_mm_properties; + device_class_set_props(dc, serial_mm_properties); dc->realize = serial_mm_realize; } diff --git a/hw/char/spapr_vty.c b/hw/char/spapr_vty.c index 8f4d9fe..ecb94f5 100644 --- a/hw/char/spapr_vty.c +++ b/hw/char/spapr_vty.c @@ -193,7 +193,7 @@ static void spapr_vty_class_init(ObjectClass *klass, void *data) k->dt_type = "serial"; k->dt_compatible = "hvterm1"; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); - dc->props = spapr_vty_properties; + device_class_set_props(dc, spapr_vty_properties); dc->vmsd = &vmstate_spapr_vty; } diff --git a/hw/char/stm32f2xx_usart.c b/hw/char/stm32f2xx_usart.c index 4ec843d..0d661be 100644 --- a/hw/char/stm32f2xx_usart.c +++ b/hw/char/stm32f2xx_usart.c @@ -222,7 +222,7 @@ static void stm32f2xx_usart_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); dc->reset = stm32f2xx_usart_reset; - dc->props = stm32f2xx_usart_properties; + device_class_set_props(dc, stm32f2xx_usart_properties); dc->realize = stm32f2xx_usart_realize; } diff --git a/hw/char/terminal3270.c b/hw/char/terminal3270.c index f7aba12..2c47ebf 100644 --- a/hw/char/terminal3270.c +++ b/hw/char/terminal3270.c @@ -288,7 +288,7 @@ static void terminal_class_init(ObjectClass *klass, void *data) DeviceClass *dc = DEVICE_CLASS(klass); EmulatedCcw3270Class *ck = EMULATED_CCW_3270_CLASS(klass); - dc->props = terminal_properties; + device_class_set_props(dc, terminal_properties); dc->vmsd = &terminal3270_vmstate; ck->init = terminal_init; ck->read_payload_3270 = read_payload_3270; diff --git a/hw/char/virtio-console.c b/hw/char/virtio-console.c index a7d34fe..b010c21 100644 --- a/hw/char/virtio-console.c +++ b/hw/char/virtio-console.c @@ -287,7 +287,7 @@ static void virtserialport_class_init(ObjectClass *klass, void *data) k->set_guest_connected = set_guest_connected; k->enable_backend = virtconsole_enable_backend; k->guest_writable = guest_writable; - dc->props = virtserialport_properties; + device_class_set_props(dc, virtserialport_properties); } static const TypeInfo virtserialport_info = { diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c index e1cbce3..941ed5a 100644 --- a/hw/char/virtio-serial-bus.c +++ b/hw/char/virtio-serial-bus.c @@ -1110,7 +1110,7 @@ static void virtio_serial_port_class_init(ObjectClass *klass, void *data) k->bus_type = TYPE_VIRTIO_SERIAL_BUS; k->realize = virtser_port_device_realize; k->unrealize = virtser_port_device_unrealize; - k->props = virtser_props; + device_class_set_props(k, virtser_props); } static const TypeInfo virtio_serial_port_type_info = { @@ -1179,7 +1179,7 @@ static void virtio_serial_class_init(ObjectClass *klass, void *data) QLIST_INIT(&vserdevices.devices); - dc->props = virtio_serial_properties; + device_class_set_props(dc, virtio_serial_properties); dc->vmsd = &vmstate_virtio_console; set_bit(DEVICE_CATEGORY_INPUT, dc->categories); vdc->realize = virtio_serial_device_realize; diff --git a/hw/char/xilinx_uartlite.c b/hw/char/xilinx_uartlite.c index aa6bf02..c651228 100644 --- a/hw/char/xilinx_uartlite.c +++ b/hw/char/xilinx_uartlite.c @@ -236,7 +236,7 @@ static void xilinx_uartlite_class_init(ObjectClass *klass, void *data) dc->reset = xilinx_uartlite_reset; dc->realize = xilinx_uartlite_realize; - dc->props = xilinx_uartlite_properties; + device_class_set_props(dc, xilinx_uartlite_properties); } static const TypeInfo xilinx_uartlite_info = { -- cgit v1.1