From patchwork Tue Nov 26 08:15:59 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 1200805 X-Patchwork-Delegate: jagannadh.teki@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lCIJYSTR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47McM76PHyz9sP3 for ; Tue, 26 Nov 2019 19:21:55 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 8204CC21F0F; Tue, 26 Nov 2019 08:21:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=FREEMAIL_FROM, RCVD_IN_MSPIKE_H2, T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 6BE62C21F58; Tue, 26 Nov 2019 08:16:27 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 623A1C21F6A; Tue, 26 Nov 2019 08:16:20 +0000 (UTC) Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) by lists.denx.de (Postfix) with ESMTPS id D94E5C21F49 for ; Tue, 26 Nov 2019 08:16:05 +0000 (UTC) Received: by mail-wm1-f65.google.com with SMTP id b11so2101215wmj.4 for ; Tue, 26 Nov 2019 00:16:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TJGsITgaA8uq9tXCxn2snVsvevdKdOCQL+a17s24hHo=; b=lCIJYSTRztYJkZ/Zl1yqZ3YhJvYObBjY0lQnRU+R/M8sIm4vUcWMNz+n/DjCgnRkfb b2/5OqxqJVcKkYjtj6EzbQDKUoiJ6h/pQOB9moyrQS+QZFxHghU0JlLdXtxCAZx+sBZN T8BuN6sYQvVF4QCQ6hsxIRE2b/0onjaUFgt79ha48MmYun6bw8hls4fWZzYuv3km6duC o3jCisx5ZijcxCz3wA/zZXS0ZBX3vi76lSFidqammjyeAVhSp/FVY+EKZ8Nrc81zvk6s OO1wVgbGnCB9DaX5kSSx1N5q5twKZto1G8qic8J2qWw/mkwdzjGAiFjKCaIznlemdnKE 6BtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TJGsITgaA8uq9tXCxn2snVsvevdKdOCQL+a17s24hHo=; b=XzBzhut+mC/bm2hOo9s4XxAGvo4ZXfX625Az6KaSxsDUhemco76dGEYQM+NL4Ar8vt 3AT9S65+T5H0PqRiGQ7yF1K15FTjLfElBj5ay3Q5nJXJlc3mRBt9C0uhTbSySX3popFS 7dKaDjHITyIx5xlSgd6IcuqOrqgaWQfJAHJMYHy5FMgFayOT6ppi3wnvBKuTNkuDr62h 4JZH5/KBgRxlsnxW3890JBtMMYhdoYuT3ZgSJ2n8WEIOJcGzydxtc7u2B8uF9aazX5AD 4k4j3kNsltcNwbniR47ZaQqvZxh1FN+7VgFojMlaO8HfU6G6AsTU2PzrN3K25XGSSLeb 8wag== X-Gm-Message-State: APjAAAUj1lMiH/VuEidGnRzFcERWahoGtOb9zG5d56d701j3fF9qJjLZ fGDN0oA0vUGAGEOrzIpBEWE= X-Google-Smtp-Source: APXvYqwM1ldGhiU9d0yuUbRWssLYWLIkpVVt5nMsYGXq+xAkseQHjrfnJcq2f2R1oaW92vH7Qo2WaQ== X-Received: by 2002:a1c:2b82:: with SMTP id r124mr2954913wmr.112.1574756165566; Tue, 26 Nov 2019 00:16:05 -0800 (PST) Received: from mamamia.internal (a89-183-34-158.net-htp.de. [89.183.34.158]) by smtp.gmail.com with ESMTPSA id c1sm13436855wrs.24.2019.11.26.00.16.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 00:16:05 -0800 (PST) From: Andre Heider To: Jagan Teki , Maxime Ripard Date: Tue, 26 Nov 2019 09:15:59 +0100 Message-Id: <20191126081602.2264519-2-a.heider@gmail.com> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126081602.2264519-1-a.heider@gmail.com> References: <20191126081602.2264519-1-a.heider@gmail.com> MIME-Version: 1.0 Cc: Ondrej Jirman , u-boot@lists.denx.de, Jernej Skrabec Subject: [U-Boot] [PATCH v2 1/4] sunxi: board: Use eth_env_set_enetaddr_by_index() X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" That helper takes care of assembling the correct name and doesn't allow overwriting existing env vars, so drop the checks here. Signed-off-by: Andre Heider --- board/sunxi/board.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/board/sunxi/board.c b/board/sunxi/board.c index e3b2d13892..bb35d6b66e 100644 --- a/board/sunxi/board.c +++ b/board/sunxi/board.c @@ -807,14 +807,6 @@ static void setup_environment(const void *fdt) if (!fdt_get_alias(fdt, ethaddr)) continue; - if (i == 0) - strcpy(ethaddr, "ethaddr"); - else - sprintf(ethaddr, "eth%daddr", i); - - if (env_get(ethaddr)) - continue; - /* Non OUI / registered MAC address */ mac_addr[0] = (i << 4) | 0x02; mac_addr[1] = (sid[0] >> 0) & 0xff; @@ -823,7 +815,7 @@ static void setup_environment(const void *fdt) mac_addr[4] = (sid[3] >> 8) & 0xff; mac_addr[5] = (sid[3] >> 0) & 0xff; - eth_env_set_enetaddr(ethaddr, mac_addr); + eth_env_set_enetaddr_by_index("eth", i, mac_addr); } if (!env_get("serial#")) {