[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mdu5CLA99p48nNFZBSFHBKiERzp-m59vKDDe5STjjKZNA@mail.gmail.com>
Date: Thu, 19 Jul 2018 12:06:51 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Dan Carpenter <dan.carpenter@...cle.com>
Cc: Bartosz Golaszewski <bgolaszewski@...libre.com>,
Sekhar Nori <nsekhar@...com>,
Kevin Hilman <khilman@...nel.org>,
Russell King <linux@...linux.org.uk>,
Grygorii Strashko <grygorii.strashko@...com>,
"David S . Miller" <davem@...emloft.net>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Lukas Wunner <lukas@...ner.de>, Rob Herring <robh@...nel.org>,
Florian Fainelli <f.fainelli@...il.com>,
Ivan Khoronzhuk <ivan.khoronzhuk@...aro.org>,
David Lechner <david@...hnology.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Andrew Lunn <andrew@...n.ch>,
arm-soc <linux-arm-kernel@...ts.infradead.org>,
LKML <linux-kernel@...r.kernel.org>,
Linux-OMAP <linux-omap@...r.kernel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH v2 2/3] net: add support for nvmem to eth_platform_get_mac_address()
2018-07-19 11:09 GMT+02:00 Dan Carpenter <dan.carpenter@...cle.com>:
>
> 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
>
Powered by blists - more mailing lists