Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp744219imm; Wed, 18 Jul 2018 09:55:13 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeIp0CrDFC3wEpr8ETGecGwOhPkqFSKx51nG9uLIzoaMvsi69ljhQiZ2XQj8IL9lWY+n3Sb X-Received: by 2002:a63:4763:: with SMTP id w35-v6mr6473809pgk.140.1531932913127; Wed, 18 Jul 2018 09:55:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531932913; cv=none; d=google.com; s=arc-20160816; b=O6Bl65IKjysHdgCL73Z6hnGw2GDzm7a5WkGaIgnRcXGH8R/9wpAnpwn8XCX67KCgf8 cnvqeskJ7TAe/pli0AcCIQWuDSufxrzJaDFKKy+3yfyrU373txrEbt7T+y6D/Ruo6rff s5uCxHXnDsAF5Gt8TcKbj0suPeGh49oK95/nyb/uMzp08t+iWjjeeW8jCuWqsOwk4186 HK7CUcZaIpNNwsaW9iHihTPuyjED3ztldubiAKVxBIlZDxt6dkBD6yoU5prWpjWLvM5o sQPrghUgYojKIMr8QRyNE+jjazMTvR+d3winjxBdG8IUb4jjkeK9fjD9emBiBqN7uFRj matw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=WJx5781lanfI2RSm+fmId08dZ4YJLSiZTokA3X5W5x8=; b=kw5Pg1u/zhQJ++y2Ig/9LU6chBDrs7p2v4ZgBkvxgHiO6WWNdTFLu9HM+adcaZr8mb Q6sGAizm8+rlWAofuZyClt26zNpFKQ7xHbWmM9VnCW0+jyqaykIK5DXM/57md008SK8H B6TOcwATEc4fc4AaA0WYoNLhJDhZvz/LyvbvKptCG4OEXH/jurKlBpLE0R9OvsaIm0x8 um/jbC4e7vADQklj3WUsvKqDtoxTXmxR2kEthyG0LoO4Wb/C3Egna63yTvCCq4fyY9h8 2A0SDfxP5HpOgxivxkkN2+DgmLNBIIg3Bsj8yBzfEI297lzGRzBevocWrP8RsXugNuDW Ay8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="fYG/awXQ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 15-v6si3859543pfj.329.2018.07.18.09.54.58; Wed, 18 Jul 2018 09:55:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="fYG/awXQ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731545AbeGRRc7 (ORCPT + 99 others); Wed, 18 Jul 2018 13:32:59 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:43511 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731308AbeGRRc7 (ORCPT ); Wed, 18 Jul 2018 13:32:59 -0400 Received: by mail-io0-f193.google.com with SMTP id y10-v6so4658839ioa.10 for ; Wed, 18 Jul 2018 09:54:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=WJx5781lanfI2RSm+fmId08dZ4YJLSiZTokA3X5W5x8=; b=fYG/awXQuJJIJ/hqS0gFZfJZSRGHMz4O/lrxhkP5e29WQcAJQBVUvsM91amFE395LJ om4qcmAYLs5Ss+JccwRxSEmMRaSly+1rIJpF9r7dRt64Y8L9HIjzXk3XbnCbA1i02z5Z Y04z21pto9FKkm3Z+cafbrUTm05usWMLj3UxBeBlO/RJE24I+rbBnlZfeA1CYKoZGBLd 9WZQMPGyVumWT4bYpraZGkgzRuYiG9dOQJILjuOSxrLj9Y0Ce0OPqQ+W1B8b39U9Nk5w vM2jNaRrNojh04XqAocTj5xW/4NHi0GmeVOVPHr+wqtMJE9c9pa2kor9Su5cW7vhYa1u 85+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=WJx5781lanfI2RSm+fmId08dZ4YJLSiZTokA3X5W5x8=; b=iFz2wzxcdngbpqT0ikams2DMa6rtoi4tW4+wZBs9f04GddXTeIbqfNNR9LAqpPmIHA fSvb99QRjr+GqNdXASyvXTnrlJvt1Ki8ZLn+9Q9/XPvD4EcgxuaUnfRGSRx9dK/rt0qU f/W4Pr4CSAFGeCB3Hykj218RZihiUfzFYpFrYG9bPTFzf36imJyGhRgO4O+XdwAkOQMZ ODXOX+GdsELe/wBT0EU31FZmmfriihYF2m6xqdYVLzD3bF0I50bkL0CCY4eM1yk9zuIe qDyiIuzBP6gmNDkMNV2d8NPEFKNeLoOO0OwkpOsL0rfCbjXH27sMc7iOyIBbjfAiAVo4 oJ+g== X-Gm-Message-State: AOUpUlFTNDPtOG1azinGzfeGa2i4LlmcX/C15NgMVk91sx+zYWgeavTW K04U1uy7qxv0YW2vaMCyPjeUi0P3zWMmYC9PY4WTcQ== X-Received: by 2002:a6b:c844:: with SMTP id y65-v6mr5646189iof.187.1531932852524; Wed, 18 Jul 2018 09:54:12 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5e:9402:0:0:0:0:0 with HTTP; Wed, 18 Jul 2018 09:54:12 -0700 (PDT) In-Reply-To: <20180718164737.GE12477@lunn.ch> References: <20180718161035.7005-1-brgl@bgdev.pl> <20180718161035.7005-6-brgl@bgdev.pl> <20180718164737.GE12477@lunn.ch> From: Bartosz Golaszewski Date: Wed, 18 Jul 2018 18:54:12 +0200 Message-ID: Subject: Re: [PATCH 5/5] net: add MTD support to eth_platform_get_mac_address() To: Andrew Lunn Cc: 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 , Linux ARM , Linux Kernel Mailing List , linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2018-07-18 18:47 GMT+02:00 Andrew Lunn : > On Wed, Jul 18, 2018 at 06:10:35PM +0200, Bartosz Golaszewski wrote: >> From: Bartosz Golaszewski >> >> MTD doesn't support nvmem yet. Some platforms use MTD to read the MAC >> address from SPI flash. If we want this function to generalize reading >> the MAC address, we need to separately try to use MTD. >> >> Signed-off-by: Bartosz Golaszewski >> --- >> net/ethernet/eth.c | 20 ++++++++++++++++++++ >> 1 file changed, 20 insertions(+) >> >> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c >> index adf5bd03851f..f7dbd2cff7f9 100644 >> --- a/net/ethernet/eth.c >> +++ b/net/ethernet/eth.c >> @@ -55,6 +55,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -573,6 +574,25 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) >> } >> } >> >> +#ifdef CONFIG_MTD >> + /* NOTE: this should go away as soon as MTD gets nvmem support. */ >> + if (!addr) { >> + struct mtd_info *mtd; >> + int rv; >> + >> + mtd = get_mtd_device_nm("MAC-Address"); > > In order for this to go away, you need to keep backwards > compatibility. When using nvmem, you look for a cell called > "mac-address". Here you are looking for "MAC-Address". That is going > to make backwards compatibility harder. How do you plan to do it? > > Andrew I'm trying to adjust to already existing users. The only user of get_mtd_device_nm() who calls it to read the MAC address registers a partition called "MAC-Address". We can't change it since it's visible from user space. In the future we'd just have to have a list of supported string that we'd use to do the nvmem lookup. Bart