Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1434998imm; Thu, 19 Jul 2018 01:22:36 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdbTHVvmBorGiIwNbeK+sbK6SLR8sFTW44K4uHC7ctnxDa4dW1NTB54pV2SPAkG1CCYXLnO X-Received: by 2002:a63:91c8:: with SMTP id l191-v6mr8801959pge.180.1531988556300; Thu, 19 Jul 2018 01:22:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531988556; cv=none; d=google.com; s=arc-20160816; b=dfPMFSaewSnZKeAu4tgmPdo8BTb7TbJVSir0XTRRkbbAOHRL9KyI7EDSybPiHsmDdi 2RgduTFEv3NoM/kHf5wbWnpDeY0JrvoPD+EYTtNvbxdIEZtFazhhJtaNMY20afe2U31D eTs2QfN5URbXmOsURit6yrrpn16fVtm8lD5QiSgRnMIpw6S7L56VIJSYUXMEZmM7uDLg YTr+hYaUNkIDNk+Yj4KgDn2ErbLqRUWmScGpQOAmatG50LYnymE1MffikoVHlD3dyGcs 6S0m0iyUMB6C3wNLCh7q8aq0KE1V5w0IkO8X3I40HHYijg1sW3xVS8tfVTbGYodJjGht rc3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=4g4nfG4m1OzdchswEO7R+ZYaZi/kfpnI9ADiubMWl8Y=; b=GNeO/GcSPO/GEoGGBymP7eenF8rfQVz7F/AuHfjWWf46JSLQM6MUn5jPaaTvZrzym+ DTErgHrnvvLmi3cEW6En5tWLMuL8z74XbuL5ogP79U4XuMCuH6lgeiTjeNbo0lDSlE7R auA09PL9s6wZPevpFdlOlSpg+WLdxXUu1B2T7tyKCGoBT9Biq0Cht1ifWa4AOVCXPZ7C pbak1+m8NPb3+iCDeCgZrFMrzWLgKiRYb4/EMwwbP86Wp6BatCxh9rWelCYXjo5qHEhK 3mEp5gTHy3aSRs+TFt9G5WB48TSEcPhMtBIa7+845W1t6kjV5luXxHBaASxlEPPKE7aL oSmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=Amx8MJT+; 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 x130-v6si5900993pgx.207.2018.07.19.01.22.21; Thu, 19 Jul 2018 01:22:36 -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=Amx8MJT+; 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 S1731426AbeGSJCc (ORCPT + 99 others); Thu, 19 Jul 2018 05:02:32 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:44810 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731046AbeGSJCb (ORCPT ); Thu, 19 Jul 2018 05:02:31 -0400 Received: by mail-wr1-f65.google.com with SMTP id r16-v6so7108824wrt.11 for ; Thu, 19 Jul 2018 01:20:32 -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; bh=4g4nfG4m1OzdchswEO7R+ZYaZi/kfpnI9ADiubMWl8Y=; b=Amx8MJT+5nEgP9xOvPbdT0osakqARL75F42jimkpp5mpdtjn2YdKAdUFqTgI/kq506 +RITgEc2GhOTc8T+Lx6Nr1xZOMaGjFYpVZaUsS8MSuOIAvBy80L/ilJizZCGRmp3LvSz Mbg8vXJPsCf74//M2InhK17tgAyqS//U7sgAI6g7tPkd4H3BfeoSAEd0yrXeTeP+BTsa YZ6kRM13gfwi81EjJlngRExldE5JlaWm3AsojLfRG8d2diHCxuXko14fDnDJHMZBSX9E Q6hbWPxD/h5zJv4tKyhce9jmkuuM9O30GBiozDyCaG7eH/WMe/aokup0CCLzlzF9X1qU CLGQ== 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; bh=4g4nfG4m1OzdchswEO7R+ZYaZi/kfpnI9ADiubMWl8Y=; b=JfCEXPOYOs8oce2bBrcerHLVwGKdL3rA631Vd+6ElGPyVCnycSOMVAxmP2N1GL0yqj ffVmnCzP4+EL3EG5EtH7+GKQ1oiyPZRTkT4D0G05KgNjd6JiGHM+OHixQSO5Hf8GGaMl tvZj8XbNRxZTSWCxr8PTLzqMD+CtZ7/ZaXnNPonHmxW1VK/Oc9SQJBijN3F7wHrgYfY2 1wnveQvHhVd3p0Ol2pGGvV5kPoXRr+ICeT0CAn1v0lDtY710B319M8xxcOYnQ83vsiRK 7sFto9zf3VHjaXgZklJ0KEvNL1TVt10YGFCSyH/59McPlywwq+lqMfjBR5OKAZ8b56LF QrXQ== X-Gm-Message-State: AOUpUlE5NPNVRdu4Ke66wBvQfk/ji2um+h/h30IZ0a+8zS0tjC1wqrvq W6KDjGQYm74AR84Xn9IBeeNdeQ== X-Received: by 2002:adf:e34d:: with SMTP id n13-v6mr7032614wrj.158.1531988432033; Thu, 19 Jul 2018 01:20:32 -0700 (PDT) Received: from brgl-bgdev.baylibre.local (AStLambert-681-1-40-185.w90-86.abo.wanadoo.fr. [90.86.159.185]) by smtp.gmail.com with ESMTPSA id h43-v6sm1716338wrh.1.2018.07.19.01.20.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Jul 2018 01:20:31 -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 v2 0/3] net: extend eth_platform_get_mac_address() Date: Thu, 19 Jul 2018 10:20:25 +0200 Message-Id: <20180719082028.26116-1-brgl@bgdev.pl> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is a follow-up to a series I posted a while ago the goal of which was to replace the at24 platform data with device properties. To do so we need to somehow remove reading the MAC address from relevant board files. In my patches I used nvmem and MTD to read the MAC address from within the davinci emac driver. It was suggested that we generalize it further but since MTD doesn't support nvmem yet, the best we can do is to move this code over to net core code. The following patches modify the eth_platform_get_mac_address() function which seems to be the best candidate for this code. The first patch calls is_valid_ether_addr() on the read address so that we're sure it's correct. The last two patches add nvmem and MTD support to the function. In order to stay compatible with existing users, nvmem and MTD will be tried last - after device tree and arch-specific callback. If this series gets accepted I will modify my previous patches to use it instead of handcoding the same operations in davinci_emac. v1 -> v2: - dropped patches 1 & 2 - improved the MAC address verification and fixed a potential buffer overflow in patch 2/3 Bartosz Golaszewski (3): net: fortify eth_platform_get_mac_address() net: add support for nvmem to eth_platform_get_mac_address() net: add MTD support to eth_platform_get_mac_address() net/ethernet/eth.c | 47 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) -- 2.17.1