Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp252860pxb; Fri, 16 Apr 2021 05:00:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7NoSuPMxg5uvt+kuuuSucjUcptCuQfOuGNoc4w1tzScU4axuw3so4fo41oxlmxe/ELKLw X-Received: by 2002:a63:6d6:: with SMTP id 205mr5432836pgg.320.1618574421662; Fri, 16 Apr 2021 05:00:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618574421; cv=none; d=google.com; s=arc-20160816; b=oHpOUpfM17vmJAKqrTbDFu/QTUPcf6ioStepzuasv12gI50R5q6vSjxnitP0yKpaLo B3nLR37j3W4kIpUvk1xG+xUCEBblvXbt2d7pAEgjMMvW8fEi6qHLiqAUhR/YzQlKPsWD rFpvjJjiMOxmxie8kZA1uxSthGPCOzyVAPI4mc9a2tyfXfmWFDf1ndyEWB8U7IArOsmA FLPACxzcAJx6ORNgneNEgRWlSbXxLd7kqL7oRddDGhA4bKV3H6j8fjtZB3X5qhp/Q/fh eXW7mGh5YCw6nYAcJ2LR/jlDc7M73ZfDBX7z75kQYhGDir3X2rVegzTnmhNlMtNDLlNt wEpA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:organization :from:references:to:subject:dkim-signature; bh=NgU4ZuEkAIBv9K7zpQYRRLFhhJ9S9HowNQOSVq3Jw5k=; b=amZpSxdKw1TJL/P9aVTOi9aHT1oAvyIu3/fvYkaNyQiemOrNAqMq4USDo9f+1MzWcV vofaBtVYMtI16xnetZzfoNeHzv2E7aA9/658Yg7uN4nxLgMS+7HTy+X3TI+csPPoyREY tjx6S2IRJk1BUBqHnanq4w8t8FDG3RjxSACxsqLueSseoAc8dWEQcX2TYwPJoMDhCC8g FlJY5WcoLr4RFpGzYEyohEAjYOXWJKch3qLzQs4/YxJXdxM8VsDmyT1YxFZnOXvxLeuk tspIyyBf8sDZnwBxqIDLrAYJU5hJW2XOVu0JNosE5wEswPDS63a2FxVSfgpdkZI4aoR7 Y39Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UbcwO38q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mm18si4063967pjb.10.2021.04.16.05.00.08; Fri, 16 Apr 2021 05:00:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=UbcwO38q; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241693AbhDPJWC (ORCPT + 99 others); Fri, 16 Apr 2021 05:22:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59540 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235252AbhDPJWB (ORCPT ); Fri, 16 Apr 2021 05:22:01 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7CF9C061574; Fri, 16 Apr 2021 02:21:35 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id r20so30284708ljk.4; Fri, 16 Apr 2021 02:21:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:organization:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=NgU4ZuEkAIBv9K7zpQYRRLFhhJ9S9HowNQOSVq3Jw5k=; b=UbcwO38qzC5kOQHMKWkzPMoJr9GFjobMkdepw1TJYElxaDTOLAHbM2yGvMCXWU4iJ6 rIoOnNngVjWu8FQT0xbFc+aQ+tASlwvlxO4HNgBfSF08NW2d6/PaiFnq5Oqd4CuJ1McF Osks7KtDLjtUjDc68aNsdVOT6MD2Av/63ufzLBxT8aTRrEAsu7rMTRM5Z6T9RshsYeef TWZ6iBNrgDqoQyTfmk5sqs1HZFAZNpFgIAUbOE0AwZzGbv4H+FmmmMWqGbahGdT9VIGR v8rgHe+GJMMSRMf1Ai03QDn/4mJfmIw9BqPhaiKXynbTTwBgnbjmN1To1pLUDjZD2wyF f85A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:organization :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=NgU4ZuEkAIBv9K7zpQYRRLFhhJ9S9HowNQOSVq3Jw5k=; b=H2kyMzF2QFLjZh8KY+qTWHuK6cKjPP+Ohmd3dhrlgWMQZeljK0GolObSQLZ3w6F9hp 5v9L/Nlhn0QD6RzGVbS9MO8mUA7jyJQbwu8gdDeKos93V2oBn1PLx/PVHNX/04Sp0Fr3 ILAqYjljf87niutP2ikz1Evc/fdV4cPypQQfraOnk+s6WWZtgGF0PkVI6Nfmezpiwn3r A+FevId0FO8rICR3N7IbOOk+20uMYp7nt9y9w1CcNnfE8vrpE72UESOrJzjsDFxjv59P aY9V/nO3+IMdlrl949puJmyaq5HUypGsstMj3TLipIDNQdAYCSWfYLbUtmT9P+vAPEuh zkfg== X-Gm-Message-State: AOAM5338xZbbPMhfy3Wel+83zh27jd6KwjiOIiT5dSAObNbYJh0qsM/M JwsnNIW2cfX1l5zepUnIO9wANoa+4KU= X-Received: by 2002:a2e:a40e:: with SMTP id p14mr2005425ljn.254.1618564894238; Fri, 16 Apr 2021 02:21:34 -0700 (PDT) Received: from [192.168.1.100] ([31.173.80.250]) by smtp.gmail.com with ESMTPSA id p12sm943355lfg.104.2021.04.16.02.21.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Apr 2021 02:21:33 -0700 (PDT) Subject: Re: [PATCH v4 net-next 07/10] net: korina: Add support for device tree To: Thomas Bogendoerfer , "David S. Miller" , Jakub Kicinski , Rob Herring , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org References: <20210416084712.62561-1-tsbogend@alpha.franken.de> <20210416084712.62561-8-tsbogend@alpha.franken.de> From: Sergei Shtylyov Organization: Brain-dead Software Message-ID: <82ea17c0-826b-7dae-8709-da721c4d0d6c@gmail.com> Date: Fri, 16 Apr 2021 12:21:20 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.9.1 MIME-Version: 1.0 In-Reply-To: <20210416084712.62561-8-tsbogend@alpha.franken.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello! On 16.04.2021 11:47, Thomas Bogendoerfer wrote: > If there is no mac address passed via platform data try to get it via > device tree and fall back to a random mac address, if all fail. > > Signed-off-by: Thomas Bogendoerfer > --- > drivers/net/ethernet/korina.c | 24 ++++++++++++++++++++++-- > 1 file changed, 22 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/korina.c b/drivers/net/ethernet/korina.c > index d6dbbdd43d7c..cd078a5c679b 100644 > --- a/drivers/net/ethernet/korina.c > +++ b/drivers/net/ethernet/korina.c > @@ -43,6 +43,8 @@ > #include > #include > #include > +#include > +#include > #include > #include > #include > @@ -1068,7 +1070,12 @@ static int korina_probe(struct platform_device *pdev) > SET_NETDEV_DEV(dev, &pdev->dev); > lp = netdev_priv(dev); > > - memcpy(dev->dev_addr, mac_addr, ETH_ALEN); > + if (mac_addr) { > + ether_addr_copy(dev->dev_addr, mac_addr); > + } else { > + if (of_get_mac_address(pdev->dev.of_node, dev->dev_addr)) *else* *if* here, and no need for {} then? :-) > + eth_hw_addr_random(dev); > + } > > lp->rx_irq = platform_get_irq_byname(pdev, "korina_rx"); > lp->tx_irq = platform_get_irq_byname(pdev, "korina_tx"); [...] MBR, Sergei