Skip to contentSkip to conversation

hw/nvram: use at24 macro

PATCH Applied Patrick Venture 4 participants 5 messages Jan 19, 2022 – Feb 21, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/nvram: use at24 macro

Use the macro for going from I2CSlave to EEPROMState.

---
 hw/nvram/eeprom_at24c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvram/eeprom_at24c.c +1 -1
index af6f5dbb99..da435500ba 100644
@@ -54,7 +54,7 @@ struct EEPROMState {
 static
 int at24c_eeprom_event(I2CSlave *s, enum i2c_event event)
 {
-    EEPROMState *ee = container_of(s, EEPROMState, parent_obj);
+    EEPROMState *ee = AT24C_EE(s);
 
     switch (event) {
     case I2C_START_SEND:
Signature · 1 line
2.34.1.703.g22d0c6ccf7-goog
#2 lore raw
In reply to Patrick Venture
Quoted 21 lines · Patrick Venture

Use the macro for going from I2CSlave to EEPROMState.

---
 hw/nvram/eeprom_at24c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvram/eeprom_at24c.c +1 -2
index af6f5dbb99..da435500ba 100644
@@ -54,7 +54,7 @@ struct EEPROMState {
 static
 int at24c_eeprom_event(I2CSlave *s, enum i2c_event event)
 {
-    EEPROMState *ee = container_of(s, EEPROMState, parent_obj);
+    EEPROMState *ee = AT24C_EE(s);
 
     switch (event) {
     case I2C_START_SEND:
--
Quoted 2 lines

2.34.1.703.g22d0c6ccf7-goog

+Corey - thanks!

#3 lore raw
In reply to Patrick Venture
Quoted 12 lines · Patrick Venture

Use the macro for going from I2CSlave to EEPROMState.

---
  hw/nvram/eeprom_at24c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/nvram/eeprom_at24c.c +0 -0
index af6f5dbb99..da435500ba 100644

hw/nvram/eeprom_at24c.c struct EEPROMState { · line 60

Quoted 8 lines
hw/nvram/eeprom_at24c.c +1 -1
@@ -54,7 +54,7 @@ struct EEPROMState {
  static
  int at24c_eeprom_event(I2CSlave *s, enum i2c_event event)
  {
-    EEPROMState *ee = container_of(s, EEPROMState, parent_obj);
+    EEPROMState *ee = AT24C_EE(s);
 
      switch (event) {
      case I2C_START_SEND:
#4 lore raw

Le 25/01/2022 à 10:20, Paolo Bonzini a écrit :

Quoted 8 lines · Patrick Venture
Quoted 7 lines

Use the macro for going from I2CSlave to EEPROMState.

---
  hw/nvram/eeprom_at24c.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 15 lines
Quoted 5 lines
hw/nvram/eeprom_at24c.c +0 -0
index af6f5dbb99..da435500ba 100644
@@ -54,7 +54,7 @@ struct EEPROMState {
Quoted 7 lines

  static
  int at24c_eeprom_event(I2CSlave *s, enum i2c_event event) {
-    EEPROMState *ee = container_of(s, EEPROMState, parent_obj); +    EEPROMState *ee = AT24C_EE(s);
      switch (event) {
      case I2C_START_SEND:

Applied to my trivial-patches branch.

Thanks,
Laurent