[U-Boot,1/4] sunxi: Fix build when CONFIG_CMD_NET is disabled

Message ID 20190209133957.12713-2-megous@megous.com
State Changes Requested
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series
  • Random small sunxi fixes
Related show

Commit Message

Ondřej Jirman Feb. 9, 2019, 1:39 p.m.
From: Ondrej Jirman <megous@megous.com>

Signed-off-by: Ondřej Jirman <megous@megous.com>
---
 board/sunxi/board.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Tomas Novotny Feb. 11, 2019, 12:14 p.m. | #1
Hi Ondřej,

On Sat,  9 Feb 2019 14:39:54 +0100, megous@megous.com <megous@megous.com>
wrote:
> From: Ondrej Jirman <megous@megous.com>
> 
> Signed-off-by: Ondřej Jirman <megous@megous.com>
> ---
>  board/sunxi/board.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> index 98bc3cd0c1..e918bdf36b 100644
> --- a/board/sunxi/board.c
> +++ b/board/sunxi/board.c
> @@ -774,9 +774,12 @@ static void setup_environment(const void *fdt)
>  {
>  	char serial_string[17] = { 0 };
>  	unsigned int sid[4];
> +#if defined CONFIG_CMD_NET
>  	uint8_t mac_addr[6];
>  	char ethaddr[16];
> -	int i, ret;
> +	int i;
> +#endif
> +	int ret;
>  
>  	ret = sunxi_get_sid(sid);
>  	if (ret == 0 && sid[0] != 0) {
> @@ -801,6 +804,7 @@ static void setup_environment(const void *fdt)
>  		if ((sid[3] & 0xffffff) == 0)
>  			sid[3] |= 0x800000;
>  
> +#if defined CONFIG_CMD_NET
>  		for (i = 0; i < 4; i++) {
>  			sprintf(ethaddr, "ethernet%d", i);
>  			if (!fdt_get_alias(fdt, ethaddr))
> @@ -824,6 +828,7 @@ static void setup_environment(const void *fdt)
>  
>  			eth_env_set_enetaddr(ethaddr, mac_addr);
>  		}
> +#endif
>  
>  		if (!env_get("serial#")) {
>  			snprintf(serial_string, sizeof(serial_string),

This patch is not needed anymore. We had a similar one also in 2018.03, but
after 2019.01 upgrade it wasn't needed. It was fixed in Apr-2018:
9925f1dbc38c:
net: Move enetaddr env access code to env config instead of net config

Tomas
Ondřej Jirman Feb. 11, 2019, 12:41 p.m. | #2
Hi Tomas,

On Mon, Feb 11, 2019 at 01:14:10PM +0100, Tomas Novotny wrote:
> Hi Ondřej,
> 
> On Sat,  9 Feb 2019 14:39:54 +0100, megous@megous.com <megous@megous.com>
> wrote:
> > From: Ondrej Jirman <megous@megous.com>
> > 
> > Signed-off-by: Ondřej Jirman <megous@megous.com>
> > ---
> >  board/sunxi/board.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/board/sunxi/board.c b/board/sunxi/board.c
> > index 98bc3cd0c1..e918bdf36b 100644
> > --- a/board/sunxi/board.c
> > +++ b/board/sunxi/board.c
> > @@ -774,9 +774,12 @@ static void setup_environment(const void *fdt)
> >  {
> >  	char serial_string[17] = { 0 };
> >  	unsigned int sid[4];
> > +#if defined CONFIG_CMD_NET
> >  	uint8_t mac_addr[6];
> >  	char ethaddr[16];
> > -	int i, ret;
> > +	int i;
> > +#endif
> > +	int ret;
> >  
> >  	ret = sunxi_get_sid(sid);
> >  	if (ret == 0 && sid[0] != 0) {
> > @@ -801,6 +804,7 @@ static void setup_environment(const void *fdt)
> >  		if ((sid[3] & 0xffffff) == 0)
> >  			sid[3] |= 0x800000;
> >  
> > +#if defined CONFIG_CMD_NET
> >  		for (i = 0; i < 4; i++) {
> >  			sprintf(ethaddr, "ethernet%d", i);
> >  			if (!fdt_get_alias(fdt, ethaddr))
> > @@ -824,6 +828,7 @@ static void setup_environment(const void *fdt)
> >  
> >  			eth_env_set_enetaddr(ethaddr, mac_addr);
> >  		}
> > +#endif
> >  
> >  		if (!env_get("serial#")) {
> >  			snprintf(serial_string, sizeof(serial_string),
> 
> This patch is not needed anymore. We had a similar one also in 2018.03, but
> after 2019.01 upgrade it wasn't needed. It was fixed in Apr-2018:
> 9925f1dbc38c:
> net: Move enetaddr env access code to env config instead of net config

Indeed. I just tested with all my boards, and it's not necessary anymore.

The other one still is though.

thanks,
  o.

> Tomas

Patch

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index 98bc3cd0c1..e918bdf36b 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -774,9 +774,12 @@  static void setup_environment(const void *fdt)
 {
 	char serial_string[17] = { 0 };
 	unsigned int sid[4];
+#if defined CONFIG_CMD_NET
 	uint8_t mac_addr[6];
 	char ethaddr[16];
-	int i, ret;
+	int i;
+#endif
+	int ret;
 
 	ret = sunxi_get_sid(sid);
 	if (ret == 0 && sid[0] != 0) {
@@ -801,6 +804,7 @@  static void setup_environment(const void *fdt)
 		if ((sid[3] & 0xffffff) == 0)
 			sid[3] |= 0x800000;
 
+#if defined CONFIG_CMD_NET
 		for (i = 0; i < 4; i++) {
 			sprintf(ethaddr, "ethernet%d", i);
 			if (!fdt_get_alias(fdt, ethaddr))
@@ -824,6 +828,7 @@  static void setup_environment(const void *fdt)
 
 			eth_env_set_enetaddr(ethaddr, mac_addr);
 		}
+#endif
 
 		if (!env_get("serial#")) {
 			snprintf(serial_string, sizeof(serial_string),