[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 13/25] hw/gpio/max7310: Simplify max7310_realize()
From: |
Peter Maydell |
Subject: |
[PULL 13/25] hw/gpio/max7310: Simplify max7310_realize() |
Date: |
Mon, 27 Feb 2023 14:00:50 +0000 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
Since &I2C_SLAVE(dev)->qdev == dev, no need to go back and
forth with QOM type casting. Directly use 'dev'.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20230220115114.25237-2-philmd@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/gpio/max7310.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/hw/gpio/max7310.c b/hw/gpio/max7310.c
index db6b5e3d764..031482d9398 100644
--- a/hw/gpio/max7310.c
+++ b/hw/gpio/max7310.c
@@ -183,11 +183,10 @@ static void max7310_gpio_set(void *opaque, int line, int
level)
* but also accepts sequences that are not SMBus so return an I2C device. */
static void max7310_realize(DeviceState *dev, Error **errp)
{
- I2CSlave *i2c = I2C_SLAVE(dev);
MAX7310State *s = MAX7310(dev);
- qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8);
- qdev_init_gpio_out(&i2c->qdev, s->handler, 8);
+ qdev_init_gpio_in(dev, max7310_gpio_set, ARRAY_SIZE(s->handler));
+ qdev_init_gpio_out(dev, s->handler, ARRAY_SIZE(s->handler));
}
static void max7310_class_init(ObjectClass *klass, void *data)
--
2.34.1
- [PULL 10/25] target/arm: Don't access TCG code when debugging with KVM, (continued)
- [PULL 10/25] target/arm: Don't access TCG code when debugging with KVM, Peter Maydell, 2023/02/27
- [PULL 12/25] tests/avocado: add machine:none tag to version.py, Peter Maydell, 2023/02/27
- [PULL 03/25] target/arm: Wrap TCG-only code in debug_helper.c, Peter Maydell, 2023/02/27
- [PULL 16/25] hw/char/xilinx_uartlite: Expose XILINX_UARTLITE QOM type, Peter Maydell, 2023/02/27
- [PULL 20/25] hw/intc/armv7m_nvic: Use QOM cast CPU() macro, Peter Maydell, 2023/02/27
- [PULL 22/25] iothread: Remove unused IOThreadClass / IOTHREAD_CLASS, Peter Maydell, 2023/02/27
- [PULL 23/25] hw/irq: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE(), Peter Maydell, 2023/02/27
- [PULL 06/25] target/arm: Move psci.c into the tcg directory, Peter Maydell, 2023/02/27
- [PULL 04/25] target/arm: move translate modules to tcg/, Peter Maydell, 2023/02/27
- [PULL 11/25] cpu-defs.h: Expose CPUTLBEntryFull to non-TCG code, Peter Maydell, 2023/02/27
- [PULL 13/25] hw/gpio/max7310: Simplify max7310_realize(),
Peter Maydell <=
- [PULL 19/25] hw/timer/cmsdk-apb-timer: Remove unused 'qdev-properties.h' header, Peter Maydell, 2023/02/27
- [PULL 18/25] hw/char/cmsdk-apb-uart: Open-code cmsdk_apb_uart_create(), Peter Maydell, 2023/02/27
- [PULL 24/25] hw/or-irq: Declare QOM macros using OBJECT_DECLARE_SIMPLE_TYPE(), Peter Maydell, 2023/02/27
- Re: [PULL 00/25] target-arm queue, Peter Maydell, 2023/02/27