Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp769913imm; Fri, 31 Aug 2018 12:48:10 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZWIHk5WChS0A6/eQh/mjnX4HgcoBvCe7R+lxcU3Z2GWohQronrsX6sqXJBkxmd80UZZ2un X-Received: by 2002:a62:50c3:: with SMTP id g64-v6mr17366583pfj.244.1535744890078; Fri, 31 Aug 2018 12:48:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535744890; cv=none; d=google.com; s=arc-20160816; b=GxESglYNUng+Xwl7uFoh8fWJZesFJ2IdD8cOpwO3fOxqM2wGc+RWybz+T10QjzmiRw khRaXylgSZkJmJ938xZgxr714FjTwd3k8h2KDjAE+HKmQWI1/YnJQCOrv3wUsTLk5lMb wysquiJn/cTeX5DRzN1jj03UGm4bIfQR/WMbyDB8A4qxa1RfKGwh8ifPCcmbC2SNTKfw nBmdT+/DytoOMN92tiEDddBdMDBpRI3hY5f7EyI48cu/kebtXRD8TTBi6ptZlCyai7y7 3ZtO5aoV/XNEC1IOsbs9ys2hUxQtGNC14UYvINYtW/VzDLN+D6CS8lKASsvHzNokL59a xrEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=etHduiudE6Z4X4l8IlyNl2zPRNFfSFZbH6iDaXt+C4I=; b=jkJ8SaWj+JQ6AAPuY5AGJP+MpEzWiR9jr+gwWGuR0Bg6lRFjFzCAWgLf90scYWgQer lGpXsRnvgvGKL9ntshuDfPa4lC7XlGb5SpR77gWUDIhVpuEs8RAT7VPZtLpqC+l1oqj2 spgMSnGh4v5PzDYzZUMUJ8km9NRcWRAixWWwD3hnkhWjVF6r4Yh5u5Rdvtwbm4u1aXqj C/MX+KwV8AqtYzV95P4BTDXMOeTTG8a79gzT2lK6zsRzpYdgjwUb6uPBfvCqL966UQEx ++PPKDBiVbmxyka9VJxs2UH4qIDBk1BzT7POeF4uvnkoXQTwRzuc3DE305yC6OIQMaIe iTsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nkiBthFp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 29-v6si11125890pfn.205.2018.08.31.12.47.55; Fri, 31 Aug 2018 12:48:10 -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=@gmail.com header.s=20161025 header.b=nkiBthFp; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727326AbeHaXzr (ORCPT + 99 others); Fri, 31 Aug 2018 19:55:47 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:43864 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726915AbeHaXzq (ORCPT ); Fri, 31 Aug 2018 19:55:46 -0400 Received: by mail-pl1-f193.google.com with SMTP id x6-v6so5904773plv.10; Fri, 31 Aug 2018 12:46:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=etHduiudE6Z4X4l8IlyNl2zPRNFfSFZbH6iDaXt+C4I=; b=nkiBthFp+AcaA1Hy3iAm4MPixUWoYhux5/LZ3v+ONVz/QM3OBdXAc94WyOYntEvArg QWs9b6AonKjXQf4/dCmS139vWd8+/HrWGNImiQKPHY+TBJ35QPa1zB3gNqOgi/xL72Kp I4bx2NUZwMplq6KC3GKGiBVPgxq7HMIQ31jmnmosM3hsnKZESF6Qq2Gzr1PUm7xSIMch u9Uf5ge10kFkAkUzuq6qRV1HtJKEJpehwIMrBOBbcj3mV3/lmhY2s9JEcEbi8VJgLCKT Na2+OOfqMdnNEH/Pn9afUTrIQBOK+jbL7z8GvG13d4ITjHf54wdwHZ83i0YHNOx0bes0 qruw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=etHduiudE6Z4X4l8IlyNl2zPRNFfSFZbH6iDaXt+C4I=; b=NNoBnby/924NUM3Y3M9En5ErvcNPUXmltmUhoA9aiJDsuJJwemRXVMBMjxBrWe5CYN briBW0pwMwxRwjCN40b6z+JuPgt0movHBLnqtvJyNtGFUayNRYjX6yWxQP0C+wiDMv1K t1m4Dpmcp1izhQqdvWGu/Q44opVdBRA67NNwNOwUUUZPLh8WmNcrpbcKSKHWLMbl/B8v ObDpKmS9qQNbsAatwQya64YVG5veN/IvRbeQrxynMnWWtZt/ESyA0lznn1p1GtpGRL9y 04pftKHV7n0YtL26cI9CgGptHPWoNKFtYbvIMXyg78Idb+w13ixN8bXu60EBK9gHk2qb DNbw== X-Gm-Message-State: APzg51ChERCthmQ9UYbRkvc0x+tOh+JfBlfTFmVRwmEm5J6LOQ2Az961 p0CeOxKdzixM2O0tPCK/SS8= X-Received: by 2002:a17:902:e281:: with SMTP id cf1-v6mr16982639plb.86.1535744807414; Fri, 31 Aug 2018 12:46:47 -0700 (PDT) Received: from ban.mtv.corp.google.com ([2620:15c:202:1:299d:6b87:5478:d28a]) by smtp.gmail.com with ESMTPSA id f184-v6sm22625326pfc.88.2018.08.31.12.46.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 31 Aug 2018 12:46:46 -0700 (PDT) Date: Fri, 31 Aug 2018 12:46:43 -0700 From: Brian Norris To: Bartosz Golaszewski Cc: Jonathan Corbet , Sekhar Nori , Kevin Hilman , Russell King , Arnd Bergmann , Greg Kroah-Hartman , David Woodhouse , Boris Brezillon , Marek Vasut , Richard Weinberger , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Naren , Mauro Carvalho Chehab , Andrew Morton , Lukas Wunner , Dan Carpenter , Florian Fainelli , Ivan Khoronzhuk , Sven Van Asbroeck , Paolo Abeni , Alban Bedel , Rob Herring , David Lechner , Andrew Lunn , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org, linux-mtd@lists.infradead.org, linux-omap@vger.kernel.org, netdev@vger.kernel.org, Bartosz Golaszewski , briannorris@chromium.org Subject: Re: [PATCH v2 00/29] at24: remove at24_platform_data Message-ID: <20180831194643.GA62862@ban.mtv.corp.google.com> References: <20180810080526.27207-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180810080526.27207-1-brgl@bgdev.pl> User-Agent: Mutt/1.10.1+48 (1f3a9df87d11) (2018-07-22) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Fri, Aug 10, 2018 at 10:04:57AM +0200, Bartosz Golaszewski wrote: > Most boards use the EEPROM to store the MAC address. This series adds > support for cell lookups to the nvmem framework, registers relevant > cells for all users, adds nvmem support to eth_platform_get_mac_address(), > converts davinci_emac driver to using it and replaces at24_platform_data > with device properties. We already have: of_get_nvmem_mac_address() (which does exactly what you're adding, except it's DT specific) of_get_mac_address() fwnode_get_mac_address() device_get_mac_address() and now you've taught me that this exists too: eth_platform_get_mac_address() These mostly don't share code, and with your series, they'll start to diverge even more as to what they support. Can you please help rectify that, instead of widening the gap? For instance, you can delete most of eth_platform_get_mac_address() and replace it with device_get_mac_address() [1]. And you could add your new stuff to fwnode_get_mac_address(). And important part to note here is that you code isn't just useful for ethernet -- it could be useful for Wifi devices too. So IMO, sticking it only in an "eth" function is the wrong move. Brian [1] arch_get_platform_mac_address() is the only part I wouldn't want to replicate into a truly generic helper. The following should be a no-op refactor, AIUI: diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index ee28440f57c5..b738651f71e1 100644 --- a/net/ethernet/eth.c +++ b/net/ethernet/eth.c @@ -47,12 +47,12 @@ #include #include #include +#include #include #include #include #include #include -#include #include #include #include @@ -528,19 +528,11 @@ unsigned char * __weak arch_get_platform_mac_address(void) int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr) { const unsigned char *addr; - struct device_node *dp; - if (dev_is_pci(dev)) - dp = pci_device_to_OF_node(to_pci_dev(dev)); - else - dp = dev->of_node; - - addr = NULL; - if (dp) - addr = of_get_mac_address(dp); - if (!addr) - addr = arch_get_platform_mac_address(); + if (device_get_mac_address(dev, mac_addr, ETH_ALEN)) + return 0; + addr = arch_get_platform_mac_address(); if (!addr) return -ENODEV;