include/eeprom.h: fix build errors
PATCH 1/1 include/eeprom.h: fix build errors
CMD_EEPROM and ENV_IS_IN_EEPROM can be selected independently, and cmd/eeprom.o gets built in either case, so whether to declare the real prototypes needs to follow the same logic as whether cmd/eeprom.c is built. Otherwise a ENV_IS_IN_EEPROM=y, CMD_EEPROM=n build fails
cmd/eeprom.c:73:1: error: expected identifier or ?(? before ?{? token
{
While at it, fix the dummy replacements (at least assuming they are meant to allow the code to compile) - they need to have the same type as the expression they replace, or one gets errors such as
env/eeprom.c: In function ?eeprom_bus_read?:env/eeprom.c:37:8: error: void value not ignored as it ought to be
rcode = eeprom_read(dev_addr, offset, buffer, cnt);
--- include/eeprom.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/eeprom.h +3 -3
@@ -7,7 +7,7 @@#ifndef __EEPROM_LEGACY_H#define __EEPROM_LEGACY_H -#ifdef CONFIG_CMD_EEPROM +#if defined(CONFIG_CMD_EEPROM ) || defined(CONFIG_ENV_IS_IN_EEPROM )void eeprom_init (int bus);int eeprom_read (uint dev_addr,uint offset,uchar *buffer,uint cnt);int eeprom_write (uint dev_addr,uint offset,uchar *buffer,uint cnt);
@@ -17,8 +17,8 @@ int eeprom_write(uint dev_addr, uint offset, uchar *buffer, uint cnt);* some macros here so we don't have to touch every one of those uses */ #define eeprom_init (bus) -#define eeprom_read (dev_addr, offset, buffer, cnt) ((void)-ENOSYS) -#define eeprom_write (dev_addr, offset, buffer, cnt) ((void)-ENOSYS) +#define eeprom_read (dev_addr, offset, buffer, cnt) (-ENOSYS) +#define eeprom_write (dev_addr, offset, buffer, cnt) (-ENOSYS)#endif #if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C ) && defined(CONFIG_SYS_I2C_EEPROM_ADDR )
Signature · 1 line
2.23.0
PATCH 1/1 include/eeprom.h: fix build errors
Quoted 35 lines · Rasmus Villemoes
CMD_EEPROMandENV_IS_IN_EEPROMcan be selected independently, andcmd/eeprom.ogets built in either case, so whether to declare the real prototypes needs to follow the same logic as whethercmd/eeprom.cis built. Otherwise a ENV_IS_IN_EEPROM=y, CMD_EEPROM=n build fails
cmd/eeprom.c:73:1: error: expected identifier or ?(? before ?{? token
{While at it, fix the dummy replacements (at least assuming they are meant to allow the code to compile) - they need to have the same type as the expression they replace, or one gets errors such as
env/eeprom.c: In function ?eeprom_bus_read?:env/eeprom.c:37:8: error: void value not ignored as it ought to be
rcode =eeprom_read(dev_addr, offset, buffer, cnt);Signed-off-by Rasmus Villemoes <[email protected]>--- include/eeprom.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)include/eeprom.h +1
-1@@ -7,7 +7,7 @@#ifndef __EEPROM_LEGACY_H#define __EEPROM_LEGACY_H -#ifdef CONFIG_CMD_EEPROM +#if defined(CONFIG_CMD_EEPROM ) || defined(CONFIG_ENV_IS_IN_EEPROM )void eeprom_init (int bus);int eeprom_read (uint dev_addr,uint offset,uchar *buffer,uint cnt);int eeprom_write (uint dev_addr,uint offset,uchar *buffer,uint cnt);
include/eeprom.h int eeprom_write(uint dev_addr, uint offset, uchar *buffer, uint cnt); · line 24
Quoted 10 lines
include/eeprom.h +2
-2@@ -17,8 +17,8 @@ int eeprom_write(uint dev_addr, uint offset, uchar *buffer, uint cnt);* some macros here so we don't have to touch every one of those uses */ #define eeprom_init (bus) -#define eeprom_read (dev_addr, offset, buffer, cnt) ((void)-ENOSYS) -#define eeprom_write (dev_addr, offset, buffer, cnt) ((void)-ENOSYS) +#define eeprom_read (dev_addr, offset, buffer, cnt) (-ENOSYS) +#define eeprom_write (dev_addr, offset, buffer, cnt) (-ENOSYS)#endif #if !defined(CONFIG_ENV_EEPROM_IS_ON_I2C ) && defined(CONFIG_SYS_I2C_EEPROM_ADDR )
But while you're in here, can you make a follow-up patch that splits the common parts of cmd/eeprom.c out and in to common/eeprom/eeprom.c or something better named? Thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200218/87be389b/attachment.sig>
PATCH 1/1 include/eeprom.h: fix build errors
In reply to Rasmus VillemoesQuoted 12 lines · Rasmus Villemoes
CMD_EEPROMandENV_IS_IN_EEPROMcan be selected independently, andcmd/eeprom.ogets built in either case, so whether to declare the real prototypes needs to follow the same logic as whethercmd/eeprom.cis built. Otherwise a ENV_IS_IN_EEPROM=y, CMD_EEPROM=n build fails
cmd/eeprom.c:73:1: error: expected identifier or ?(? before ?{? token
{While at it, fix the dummy replacements (at least assuming they are meant to allow the code to compile) - they need to have the same type as the expression they replace, or one gets errors such as
Quoted 6 lines
env/eeprom.c: In function ?eeprom_bus_read?:env/eeprom.c:37:8: error: void value not ignored as it ought to be
rcode =eeprom_read(dev_addr, offset, buffer, cnt);Signed-off-by Rasmus Villemoes <[email protected]>Reviewed-by Tom Rini <[email protected]>
[I had asked for a follow-up cleanup, but this is still worth taking, so...]
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200507/ba117e73/attachment.sig>
PATCH 1/1 include/eeprom.h: fix build errors
Quoted 8 lines · Tom Rini
Quoted 2 lines · Rasmus Villemoes
Signed-off-by Rasmus Villemoes <[email protected]>Reviewed-by Tom Rini <[email protected]>[I had asked for a follow-up cleanup, but this is still worth taking, so...]
Yeah, sorry, been rather busy, dunno when or if I'll find time to look at that extra cleanup.
Thanks,
Rasmus