qdev/prop: convert smbus_eeprom.c to helper macros.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> Message-Id:
This commit is contained in:
parent
18c637dccb
commit
bf2782d7d3
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
typedef struct SMBusEEPROMDevice {
|
typedef struct SMBusEEPROMDevice {
|
||||||
SMBusDevice smbusdev;
|
SMBusDevice smbusdev;
|
||||||
uint8_t *data;
|
void *data;
|
||||||
uint8_t offset;
|
uint8_t offset;
|
||||||
} SMBusEEPROMDevice;
|
} SMBusEEPROMDevice;
|
||||||
|
|
||||||
@ -54,7 +54,8 @@ static void eeprom_send_byte(SMBusDevice *dev, uint8_t val)
|
|||||||
static uint8_t eeprom_receive_byte(SMBusDevice *dev)
|
static uint8_t eeprom_receive_byte(SMBusDevice *dev)
|
||||||
{
|
{
|
||||||
SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
|
SMBusEEPROMDevice *eeprom = (SMBusEEPROMDevice *) dev;
|
||||||
uint8_t val = eeprom->data[eeprom->offset++];
|
uint8_t *data = eeprom->data;
|
||||||
|
uint8_t val = data[eeprom->offset++];
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n",
|
printf("eeprom_receive_byte: addr=0x%02x val=0x%02x\n",
|
||||||
dev->i2c.address, val);
|
dev->i2c.address, val);
|
||||||
@ -106,12 +107,8 @@ static SMBusDeviceInfo smbus_eeprom_info = {
|
|||||||
.i2c.qdev.name = "smbus-eeprom",
|
.i2c.qdev.name = "smbus-eeprom",
|
||||||
.i2c.qdev.size = sizeof(SMBusEEPROMDevice),
|
.i2c.qdev.size = sizeof(SMBusEEPROMDevice),
|
||||||
.i2c.qdev.props = (Property[]) {
|
.i2c.qdev.props = (Property[]) {
|
||||||
{
|
DEFINE_PROP_PTR("data", SMBusEEPROMDevice, data),
|
||||||
.name = "data",
|
DEFINE_PROP_END_OF_LIST(),
|
||||||
.info = &qdev_prop_ptr,
|
|
||||||
.offset = offsetof(SMBusEEPROMDevice, data),
|
|
||||||
},
|
|
||||||
{/* end of list */}
|
|
||||||
},
|
},
|
||||||
.init = smbus_eeprom_init,
|
.init = smbus_eeprom_init,
|
||||||
.quick_cmd = eeprom_quick_cmd,
|
.quick_cmd = eeprom_quick_cmd,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user