Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1515961imm; Thu, 19 Jul 2018 03:08:58 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcyYcd9nxtpDDP32zxRfnuMQSJD7iWhCIOKzYkDylUT6uGB1kTTfcdDANyYG01qZeteAtlk X-Received: by 2002:a62:a649:: with SMTP id t70-v6mr8932743pfe.149.1531994938925; Thu, 19 Jul 2018 03:08:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531994938; cv=none; d=google.com; s=arc-20160816; b=ErJlDfQa/KdbNzsYucG3XY3YZJOuRTHk01MKCEfSaSXsv01gkne5lSHpiS6q6z5w0Z aYMp7aXyRszHPfcTpZZtqknDV0kYXKpfSHlcMqomzXBGdDvXghNto/oZwwySaaYn66k+ qMRw397imhfM5rLKc6P5Iw/5DjSQ54+zLucMmAruSMTPuJW19wXfRz4R8bbYxy1M4Uq+ Uk2ONqN6i3A1tsByFgzift7AcwamxdAcn0Mw9nNPm1pjdpCbknv9eFSOk/AEQljpnpZ6 u7WdH5E2blRPFvWl+BmRJmqU2DqsVgZGkFuiGoYwSlQllIvIYmjUFpIP7B6AxVkbeKdK PYFw== 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=VOl055BhduSo5J7YsFJvGwNoM//6uQ8iqB4uxoQZeUM=; b=J/KzpgK/v4pbyYTsDYVgNvbDzPiWO88NlaxBpX5JZAemRuYgwZ/vU3fwowEuD//LVe lCD8zfmO/j7zNul9T2f7iG/SZEsyrCAApXT3/Ts19MOQ1Z88oCkbzuYZfee/hjx4npKR mXoiqZfR3F7Zwq/5OhQ3NAx76dwAk0ikPTm5cqs4O73ILPTaOQHhExEbinka1QkKZJ49 fFqV+rGL/lICH17ukuN41Ve/Rgjt2KbHy2EiuMtvvX95Js9aqtP4nX4mec7vTnvYyr5J Mm1vQsk363cZ6bpAodBgVaPU71eRUzvuh2rWiVulxkBk9B0EJwwYCFPA5TbSGksjGdcF gHpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=xkSsnEPM; 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 u64-v6si5491245pfd.297.2018.07.19.03.08.44; Thu, 19 Jul 2018 03:08:58 -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=xkSsnEPM; 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 S1731086AbeGSKtR (ORCPT + 99 others); Thu, 19 Jul 2018 06:49:17 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:39412 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731031AbeGSKtQ (ORCPT ); Thu, 19 Jul 2018 06:49:16 -0400 Received: by mail-io0-f193.google.com with SMTP id o22-v6so5527447ioh.6 for ; Thu, 19 Jul 2018 03:06:52 -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=VOl055BhduSo5J7YsFJvGwNoM//6uQ8iqB4uxoQZeUM=; b=xkSsnEPMx95IK37nOT43QlC7KFDN+7/9wfsUWGmoBCNLvut+NAf8QYD2uOxmzGf89g uJg8dGFhyz1uFlamw+oP2ZnI8iCqSox+718SPJt9nN8UqVQIS8yv0bXyHTc9/cp9k09S FRxTcN+lgBNo8atGs/5v+Xyp4CWOqpl4ODo0La+3panMBosLXfsEhVam+rYWiVGt6MIp fTwyI4T3Gx1fR7H8leh8Q/j/QqflSyI1F5gTPoHeysW3lrWg5W0ivCSEhUDYt2sEfdS2 qDfbKHr4rOg//+x06blU+e4dcyY8lblViwEXLebOQoWwvPLU52b9Vm8a1qRGw5pdiN6U Ct/Q== 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=VOl055BhduSo5J7YsFJvGwNoM//6uQ8iqB4uxoQZeUM=; b=Z5Myr8au0Qy+JwBzQO2c6TugV71wuuN5pK2v8ZgnHe9YoVXfOFSybxlGc46e40WjE/ M1WpbeD7xqUFWtCkPGCU2UOIH5cGruFQFIiKsu7LZI24YTaFMOic/VozShUzrwyDQPM0 pDSSyRXCOcZSbyekSQD/JePrX8a+5q1ufh0mPXUDVYgKpQ87v/rxU5CiKypgI2u9d8Xl QAo012MAw1bwggGPJMjnpMG+9IDQnOui3WmZmQ3Ija0Q36ddbCApQ+g1ZjyikMh3xj6+ wdY2o5YESmI4bhodpyi9PQhIgN1ev2MmsZeOuwip8RqqU2HeV8VQUJhn9iLfdYO7AE+g jSEA== X-Gm-Message-State: AOUpUlGoi47oSPp/K5+W1Nb3Y5hAHvIBUVisVC/BY37NUj9NUZiUVLDL 8Dzz+hEs/1nvYjdq76eD7SfQwdAxxlAE0MynSvuzJw== X-Received: by 2002:a5e:8d07:: with SMTP id m7-v6mr7733109ioj.258.1531994812574; Thu, 19 Jul 2018 03:06:52 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5e:9402:0:0:0:0:0 with HTTP; Thu, 19 Jul 2018 03:06:51 -0700 (PDT) In-Reply-To: <20180719090929.arbysqo2bk3esoar@mwanda> References: <20180719082028.26116-1-brgl@bgdev.pl> <20180719082028.26116-3-brgl@bgdev.pl> <20180719084503.tfv6jllsukk2zv3f@mwanda> <20180719090929.arbysqo2bk3esoar@mwanda> From: Bartosz Golaszewski Date: Thu, 19 Jul 2018 12:06:51 +0200 Message-ID: Subject: Re: [PATCH v2 2/3] net: add support for nvmem to eth_platform_get_mac_address() To: Dan Carpenter Cc: Bartosz Golaszewski , Sekhar Nori , Kevin Hilman , Russell King , Grygorii Strashko , "David S . Miller" , Srinivas Kandagatla , Lukas Wunner , Rob Herring , Florian Fainelli , Ivan Khoronzhuk , David Lechner , Greg Kroah-Hartman , Andrew Lunn , arm-soc , LKML , Linux-OMAP , netdev@vger.kernel.org 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-19 11:09 GMT+02:00 Dan Carpenter : > > Maybe it would be simpler as three separate functions: > > int of_eth_get_mac_address() <- rename existing function to this > int nvmem_eth_get_mac_address() <- patch 2 > int mtd_eth_nvmem_get_mac_address() patch 3 > > int ret; > > ret = of_eth_get_mac_address(dev, mac_addr); > if (!ret) > return 0; > ret = nvmem_eth_get_mac_address(dev, mac_addr); > if (ret == -EPROBEDEFER) > return ret; > if (!ret) > return 0; > ret = mtd_eth_nvmem_get_mac_address(dev, mac_addr); > if (!ret) > return 0; > > return -ENODEV; > > regards, > dan carpenter It looks simpler as long as you don't add all the new routines resulting from this approach. I've just tried to quickly implement this solution and it resulted in much bigger and duplicated code (checking the validity of mac_addr, copying it etc.). I would prefer the current approach and would like to read someone else's opinion on that. Thanks, Bart >