summary refs log tree commit diff stats
path: root/include/hw/i2c
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <philmd@linaro.org>2023-05-12 10:20:52 +0200
committerPhilippe Mathieu-Daudé <philmd@linaro.org>2023-08-31 19:47:43 +0200
commitf0e4588fd4ae39d1ad46f19c76ed298f89e61d6a (patch)
tree27761ab4f9b07aa47157452f3fd68b989155cbda /include/hw/i2c
parent077388523620c7de05bac5fb98339bf3d101e6a5 (diff)
downloadfocaccia-qemu-f0e4588fd4ae39d1ad46f19c76ed298f89e61d6a.tar.gz
focaccia-qemu-f0e4588fd4ae39d1ad46f19c76ed298f89e61d6a.zip
hw/i2c/pmbus_device: Fix modifying QOM class internals from instance
QOM object instance should not modify its class state (because
all other objects instanciated from this class get affected).

Instead of modifying the PMBusDeviceClass 'device_num_pages' field
the first time a instance is initialized (in pmbus_pages_alloc),
introduce a new pmbus_pages_num() helper which returns the page
number from the class without modifying the class state.

The code logic become slighly simplified.

Inspired-by: Bernhard Beschow <shentey@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230523064408.57941-4-philmd@linaro.org>
Diffstat (limited to 'include/hw/i2c')
0 files changed, 0 insertions, 0 deletions