[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/6] hw/nvram/eeprom_at24c: Add header w/ init helper
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH 1/6] hw/nvram/eeprom_at24c: Add header w/ init helper |
Date: |
Mon, 16 Jan 2023 13:23:01 +0100 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 |
On 14/1/23 18:01, Peter Delevoryas wrote:
Signed-off-by: Peter Delevoryas <peter@pjd.dev>
---
hw/nvram/eeprom_at24c.c | 10 ++++++++++
include/hw/nvram/eeprom_at24c.h | 10 ++++++++++
2 files changed, 20 insertions(+)
create mode 100644 include/hw/nvram/eeprom_at24c.h
+void at24c_eeprom_init(I2CBus *bus, uint8_t address, uint32_t rom_size)
+{
+ I2CSlave *i2c_dev = i2c_slave_new("at24c-eeprom", address);
Please use the type definition: TYPE_AT24C_EE.
+ DeviceState *dev = DEVICE(i2c_dev);
+
+ qdev_prop_set_uint32(dev, "rom-size", rom_size);
+ i2c_slave_realize_and_unref(i2c_dev, bus, &error_abort);
Although the allocated object is somehow reachable from the i2c bus
object, it would be simpler to deallocate allowing the parent to keep
a reference to it. So consider this prototype instead:
I2CSlave *at24c_eeprom_create(I2CBus *bus, uint8_t address,
uint32_t rom_size);
+}
- [PATCH 0/6] hw/nvram/eeprom_at24c: Cleanup + FRUID EEPROM init example, Peter Delevoryas, 2023/01/14
- [PATCH 2/6] hw/arm/aspeed: Remove local copy of at24c_eeprom_init, Peter Delevoryas, 2023/01/14
- [PATCH 1/6] hw/nvram/eeprom_at24c: Add header w/ init helper, Peter Delevoryas, 2023/01/14
- [PATCH 3/6] hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init, Peter Delevoryas, 2023/01/14
- [PATCH 5/6] hw/nvram/eeprom_at24c: Add I2C write helper, Peter Delevoryas, 2023/01/14
- [PATCH 6/6] hw/arm/aspeed: Init fby35 BMC FRUID EEPROM, Peter Delevoryas, 2023/01/14