[PATCH] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h'

Philippe Mathieu-Daudé posted 1 patch 1 year, 1 month ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20231009092127.49778-1-philmd@linaro.org
Maintainers: "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>
hw/mips/malta.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h'
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
Since commit 93198b6cad ("i2c: Split smbus into parts") the SDRAM
types are enumerated as sdram_type in "hw/i2c/smbus_eeprom.h".

Using the enum removes this global shadow warning:

  hw/mips/malta.c:209:12: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
      enum { SDR = 0x4, DDR2 = 0x8 } type;
             ^
  include/hw/i2c/smbus_eeprom.h:33:19: note: previous declaration is here
  enum sdram_type { SDR = 0x4, DDR = 0x7, DDR2 = 0x8 };
                    ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/mips/malta.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/mips/malta.c b/hw/mips/malta.c
index dac27fad9d..62d04ed113 100644
--- a/hw/mips/malta.c
+++ b/hw/mips/malta.c
@@ -206,7 +206,7 @@ static eeprom24c0x_t spd_eeprom = {
 
 static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t ram_size)
 {
-    enum { SDR = 0x4, DDR2 = 0x8 } type;
+    enum sdram_type type;
     uint8_t *spd = spd_eeprom.contents;
     uint8_t nbanks = 0;
     uint16_t density = 0;
-- 
2.41.0


Re: [PATCH] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h'
Posted by Philippe Mathieu-Daudé 1 year, 1 month ago
On 9/10/23 11:21, Philippe Mathieu-Daudé wrote:
> Since commit 93198b6cad ("i2c: Split smbus into parts") the SDRAM
> types are enumerated as sdram_type in "hw/i2c/smbus_eeprom.h".
> 
> Using the enum removes this global shadow warning:
> 
>    hw/mips/malta.c:209:12: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>        enum { SDR = 0x4, DDR2 = 0x8 } type;
>               ^
>    include/hw/i2c/smbus_eeprom.h:33:19: note: previous declaration is here
>    enum sdram_type { SDR = 0x4, DDR = 0x7, DDR2 = 0x8 };
>                      ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   hw/mips/malta.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Queued to mips-next.


Re: [PATCH] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h'
Posted by Richard Henderson 1 year, 1 month ago
On 10/9/23 02:21, Philippe Mathieu-Daudé wrote:
> Since commit 93198b6cad ("i2c: Split smbus into parts") the SDRAM
> types are enumerated as sdram_type in "hw/i2c/smbus_eeprom.h".
> 
> Using the enum removes this global shadow warning:
> 
>    hw/mips/malta.c:209:12: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>        enum { SDR = 0x4, DDR2 = 0x8 } type;
>               ^
>    include/hw/i2c/smbus_eeprom.h:33:19: note: previous declaration is here
>    enum sdram_type { SDR = 0x4, DDR = 0x7, DDR2 = 0x8 };
>                      ^
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~

Re: [PATCH] hw/mips/malta: Use sdram_type enum from 'hw/i2c/smbus_eeprom.h'
Posted by BALATON Zoltan 1 year, 1 month ago
On Mon, 9 Oct 2023, Philippe Mathieu-Daudé wrote:
> Since commit 93198b6cad ("i2c: Split smbus into parts") the SDRAM
> types are enumerated as sdram_type in "hw/i2c/smbus_eeprom.h".
>
> Using the enum removes this global shadow warning:
>
>  hw/mips/malta.c:209:12: error: declaration shadows a variable in the global scope [-Werror,-Wshadow]
>      enum { SDR = 0x4, DDR2 = 0x8 } type;
>             ^
>  include/hw/i2c/smbus_eeprom.h:33:19: note: previous declaration is here
>  enum sdram_type { SDR = 0x4, DDR = 0x7, DDR2 = 0x8 };
>                    ^
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>

Reviewed-by: BALATON Zoltan <balaton@eik.bme.hu>

> ---
> hw/mips/malta.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/mips/malta.c b/hw/mips/malta.c
> index dac27fad9d..62d04ed113 100644
> --- a/hw/mips/malta.c
> +++ b/hw/mips/malta.c
> @@ -206,7 +206,7 @@ static eeprom24c0x_t spd_eeprom = {
>
> static void generate_eeprom_spd(uint8_t *eeprom, ram_addr_t ram_size)
> {
> -    enum { SDR = 0x4, DDR2 = 0x8 } type;
> +    enum sdram_type type;
>     uint8_t *spd = spd_eeprom.contents;
>     uint8_t nbanks = 0;
>     uint16_t density = 0;
>