Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp723632imm; Wed, 18 Jul 2018 09:33:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeJaHfEpS2gvEK5WNQD9IwXSlyh0adFiQP1FhyrMRoUPoJBpFB6MckZ8npZ4+dyDETKipHk X-Received: by 2002:aa7:88d3:: with SMTP id p19-v6mr5893476pfo.160.1531931590930; Wed, 18 Jul 2018 09:33:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531931590; cv=none; d=google.com; s=arc-20160816; b=f13s3xR25Au89LuEJOcqRCOuWxvDT4PJu4p5Glu6cSKi7MhUoEQjKwklaY9N8P6BK3 f/jiaOFmvyaV6hCnJm7kch9IP6oxbHQiYG73JLIluQRek8Dual/+DY6rJ7A9yQLXj63R PygL786UTKqP5uWgD2ky0DZPUPeHxZfGOBBy9QR9o3dav2UmwxaUm97S7JLYx2KIDCaD uJmeOjiVChvwEad6o8C6mJuoh//2Eiyv7+6A/WJZLi7rB2hT7Iif31Nn4IkVllwdqcay nMeZqfJuxxY6amk0bvMwRVZvDLnpfQY8B1UioAfPXPmJ92SHgXfCq9Mz9stRYIahJSg9 h9wA== 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=I+XZstefw372I4vobdJVu6/m2CQpr2IFrQMfX+PGqgg=; b=MGjN4ZJNEUvBA9fYQ9z/Geihqa1zqf+ly66hME8XJPLtlI6v8eeFMXP5tEszo79HoA JSEXOL8rG4HydLz/XDolIFYs9mhKMKHSWbeuk7HUOv7lu6GX6cFL3ifD33RfvQzvvXB0 HxtuHcVTWQ4Src4kro1B1KF6wix7WgseBj66mefRE30/oVLu5ut9w4dcF9jUt4/m0rRa cZEi3n6dy5bghqkOokRsDWEw+GbSmQ9qz2YkHpkeN3kAyqLkT5pESpsOB6d06VYAwPd/ U+k6PpUM/udR7hjmMmbkajIdFDzKaEx+marnuAQoLpOxMAFIEas6CDA2+YBPzb6cdf6e 9VEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=WD+yklOC; 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 z3-v6si3514286plb.246.2018.07.18.09.32.56; Wed, 18 Jul 2018 09:33: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=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=WD+yklOC; 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 S1731553AbeGRRKl (ORCPT + 99 others); Wed, 18 Jul 2018 13:10:41 -0400 Received: from mail-io0-f195.google.com ([209.85.223.195]:35793 "EHLO mail-io0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731554AbeGRRKk (ORCPT ); Wed, 18 Jul 2018 13:10:40 -0400 Received: by mail-io0-f195.google.com with SMTP id q4-v6so4605773iob.2 for ; Wed, 18 Jul 2018 09:31:59 -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=I+XZstefw372I4vobdJVu6/m2CQpr2IFrQMfX+PGqgg=; b=WD+yklOCmwQmLnHKmFYJNoHQ3VMNLEYoAi9r3zKWrONCBpKmJE4NaQjXA+M9/osEI9 7IRGEPWsWBtjCfMrLtDorHWtYqo3Lq3xb09hnCotpCSXc8PAvHt5/ItaoQvE4i5TVICY nyxNnvlHqpltk17QVT3XF3AtiXU/UGYZR/ZfdgVuveOCYvcRZMT94597hhUZtvRQzbT9 KVTO1tjX0tcR8OGpSUZk2KYr+IcMJhRvgKepEXniFuKZNRLjZbvL03elSchzSm5bqzb4 cgjv8lVh4tKVsTyzK2bTEV0UzWGnZdnNQFtZ9Lk5MQGuPhtd6/fseUFvzpbT29YaztBw kA/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=I+XZstefw372I4vobdJVu6/m2CQpr2IFrQMfX+PGqgg=; b=lopi6vFU8Bvf2p+kgaDNG3LkFnn4t9Je3iewIefRSIi+c+nR3mc/mTvMjipBwZ8XgS +0xXbDhdp/B2IFa9ybVrO93wlLdzi9Ox7O03xmzEXdx2p7DMu83YZ3hV3nFH1US/YgSO XHIDeSFBSSHnxAggebCIOUTuy2aSVID5cECVfnWkL8BJgWZAusY41eMpLey4vzGsGbEg CnXVat4GBX2zd6WO/+gX6eUUbtDVworxQik2HpfJLCR6Ju+ZFz1FfQrqIA/3WFOIFRRa bFfxLqtZ5BxD9IJq6xQl3/rWgE8YBvrs0ybHTYj9G0eeL1uagmCDEyTEoSLF+aSWRq88 PEhg== X-Gm-Message-State: AOUpUlGHNjs03O/ipPW87/t2EEA7kJoneALtH8nlVGDRdEwKprGCLFOr R2bdfA5iaxHKGsz12H+fnkb6gcUpZGAlYZ/VbU2Gww== X-Received: by 2002:a5e:8d07:: with SMTP id m7-v6mr5461953ioj.258.1531931519153; Wed, 18 Jul 2018 09:31:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a5e:9402:0:0:0:0:0 with HTTP; Wed, 18 Jul 2018 09:31:58 -0700 (PDT) In-Reply-To: <20180718162849.GA12477@lunn.ch> References: <20180718161035.7005-1-brgl@bgdev.pl> <20180718161035.7005-2-brgl@bgdev.pl> <20180718162849.GA12477@lunn.ch> From: Bartosz Golaszewski Date: Wed, 18 Jul 2018 18:31:58 +0200 Message-ID: Subject: Re: [PATCH 1/5] net: visually shrink 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:28 GMT+02:00 Andrew Lunn : > On Wed, Jul 18, 2018 at 06:10:31PM +0200, Bartosz Golaszewski wrote: >> From: Bartosz Golaszewski >> >> Initialize the variables with proper values so that we save a few >> lines of code before we extend this function in the follow-up patches. >> >> Signed-off-by: Bartosz Golaszewski >> --- >> net/ethernet/eth.c | 11 +++-------- >> 1 file changed, 3 insertions(+), 8 deletions(-) >> >> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c >> index ee28440f57c5..da8530879e1e 100644 >> --- a/net/ethernet/eth.c >> +++ b/net/ethernet/eth.c >> @@ -527,15 +527,10 @@ 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; >> + 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; > > Hi Bartosz > > You are now in the net subsystem, which has its own set of additional > coding styles. One of them is reverse Christmas tree. > > You might want to read Documentation/networking/netdev-FAQ.txt. > > Andrew Hi Andrew, it's still reverse Christmas tree in this patch except that now we're taking the length of the variable + initializer into account. I'm not sure if this is the right approach though. Bart