From patchwork Wed Jul 18 16:10:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10532809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DAC12601D2 for ; Wed, 18 Jul 2018 16:12:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA63290A4 for ; Wed, 18 Jul 2018 16:12:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C074F290B9; Wed, 18 Jul 2018 16:12:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 66E27290A4 for ; Wed, 18 Jul 2018 16:12:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731566AbeGRQtV (ORCPT ); Wed, 18 Jul 2018 12:49:21 -0400 Received: from mail-wm0-f66.google.com ([74.125.82.66]:37101 "EHLO mail-wm0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731518AbeGRQtV (ORCPT ); Wed, 18 Jul 2018 12:49:21 -0400 Received: by mail-wm0-f66.google.com with SMTP id a19-v6so3453835wmb.2 for ; Wed, 18 Jul 2018 09:10:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5nw1HQAmv4GwhqMuUaC5yDqQkngaK0CYak4ZYQ4kb7k=; b=kE9HkCU2i2Zo9sm8D1hIwFs780xiRBBKt598nH9OeB0bbn1rSrfPXgsJ0zJkH/dVt0 pUsHG4sMy3Ye0vsLsKrhF6/z+kqqxIFhUpqIBkHqlEQQzJA6X7uilonoR2mQXqSBz4OO bdCbXliMU46bbir8A86dc/zMLupcV8EoCnmhXOQXKb4rGtC+2lml7B01mbwxMbQpyFTZ Gd+b3hu7Xht5SsmACFJHQ7kPkwTwrwSCAAev0SUNV357vD+faWt0c+TCzsjr38WlKqfP AdrBFOBxc2w/8q6PCT64q+tY/b/u3TLv34TFxLR75jXfeuEXPeXjNNA8koLu59Xn02oo bY2w== 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; bh=5nw1HQAmv4GwhqMuUaC5yDqQkngaK0CYak4ZYQ4kb7k=; b=AaQNPu+1qJH+qHGYm6DCH+8qMCrCfUUaNVyq7QJ7Rtb5mEJ0pjwsrntdO8Wc+FQ0mz VVTOty08z8wCxKW7FghMyiOOac3ps78y/DqLNOtK4hUe7byKhCYgHgsixOnUkoV/RE8a 1L/POS37udMaWzrJ4XaWs0z80/6/X7MpXiZGTE2uUEOKeVlfvQjk/qhizFqzu11jNuvg 8vaeEXxF0sj7EfjMvyo/yMEowVvW5Sdx1fpXHOuJCGoCgJH2nGYdeHTuli91wpytn9CU YQSX2o8EMcFkk++D86wMe8JcUgFYWlIrtIYtEN4DfKOH8AOM7eIYOi6bLY2419F3rZ6T ESDg== X-Gm-Message-State: AOUpUlFYZ4eVzwE6w00kyrBP6iKXMhpXHgAQbGkhxS/l0OXfMU1HVsLe JaUEdp9k4ftq14IKAxBrNMWI2A== X-Google-Smtp-Source: AAOMgpcqx/s4hF9Qf7YbLyIV28plr/vySEY4KZ3blOpbVwFRzDm/VgvAxsktM83/X59ApovtSEcXcQ== X-Received: by 2002:a1c:1802:: with SMTP id 2-v6mr1928894wmy.81.1531930244957; Wed, 18 Jul 2018 09:10:44 -0700 (PDT) Received: from brgl-bgdev.home ([2a01:cb1d:af:5b00:e837:b8d5:48c1:571b]) by smtp.gmail.com with ESMTPSA id v185-v6sm2847803wme.30.2018.07.18.09.10.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 18 Jul 2018 09:10:44 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Russell King , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Dan Carpenter , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH 2/5] net: add an info message to eth_platform_get_mac_address() Date: Wed, 18 Jul 2018 18:10:32 +0200 Message-Id: <20180718161035.7005-3-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180718161035.7005-1-brgl@bgdev.pl> References: <20180718161035.7005-1-brgl@bgdev.pl> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Bartosz Golaszewski Many drivers that read the MAC address from EEPROM or MTD emit a log message when they succeed. Since this function is meant to be reused in those drivers instead of reimplementing the same operation everywhere, add an info message when we successfully read the MAC address. Signed-off-by: Bartosz Golaszewski --- net/ethernet/eth.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index da8530879e1e..2a2173324d9e 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -530,15 +530,24 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) struct device_node *dp = dev_is_pci(dev) ? pci_device_to_OF_node(to_pci_dev(dev)) : dev->of_node; const unsigned char *addr = NULL; + const char *from = NULL; - if (dp) + if (dp) { addr = of_get_mac_address(dp); - if (!addr) + if (addr) + from = "device tree"; + } + + if (!addr) { addr = arch_get_platform_mac_address(); + if (addr) + from = "arch callback"; + } if (!addr) return -ENODEV; + dev_info(dev, "read MAC address from %s\n", from); ether_addr_copy(mac_addr, addr); return 0; }