mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Stefan Lengfeld <s.lengfeld@phytec.de>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>,
	"barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: [PATCH 02/16] i.MX: ocotp: Add provisions for storing multiple MAC addresses
Date: Wed, 7 Dec 2016 20:13:43 +0100	[thread overview]
Message-ID: <20161207191343.v2y3dmzo4m67ws3c@pengutronix.de> (raw)
In-Reply-To: <20161207085105.GC2371@lws-christ>

On Wed, Dec 07, 2016 at 09:51:05AM +0100, Stefan Lengfeld wrote:
> Hi Andrey,
> 
> > I did see that patch go through, however since the title of it is
> > "arm: imx6: ocotp: Added support for the i.MX6UL" I didn't look into
> > it any further.
> 
> In the light of the Vybrid also supports two MAC addresses your patch title
> 
>     i.MX: ocotp: Add provisions for storing multiple MAC addresses
> 
> is better, since it is more generic.
> 
> > > Your approach uses an extra device attribute  'mac_idx' to select the meaning
> > > of the device attribute 'mac_addr': Whether it points to the MAC0 or MAC1.
> > >
> > > I find it less error prone and confusing to use two seperate device attributes
> > > 'mac_addr' and 'mac_addr1' for MAC0 and MAC1. So you don't have to check the
> > > value of 'mac_idx before reading or writing the MAC addresses.
> > 
> > Can't say that I necessarily agree with you assessment. There's no
> > need to check 'mac_idx' if it is written every time as a part of MAC
> > address assignment operation. The reason I chose the approach that I
> > did was mainly because it allowed to both have backwards compatibility
> > with the old naming scheme and avoid having variable naming
> > inconsistency (as you see in your example where one variable has a
> > numerical suffix and the other doesn't) which I was concerned would be
> > make scripting it more clunky than necessary.
> 
> hmm, I find it more convenient use
> 
>     bootloader$ ocotp0.mac_addr=22:33:44:55:66:77
>     bootloader$ ocotp0.mac_addr1=22:33:44:AA:AA:AA
> 
> than 
> 
>     bootloader$ ocotp0.mac_idx=0
>     bootloader$ ocotp0.mac_addr=22:33:44:55:66:77
>     bootloader$ ocotp0.mac_idx=1
>     bootloader$ ocotp0.mac_addr=22:33:44:AA:AA:AA
> 
> The same goes for reading the MAC addresses. The first one is more obvious,
> because the meaning of the variable "mac_addr" does not depend on another
> variable "mac_idx".

I agree here.

> 
> Maybe we can settle on a different approach to avoid the inconsistent variable
> names "mac_addr" and "mac_addr1":

How about always registering mac_addr0 with mac_addr as alias? Then we
have consistent variable naming and still the backward compatible
standard mac address.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-12-07 19:14 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-05 14:54 [PATCH 00/16] Vybrid related patches Andrey Smirnov
2016-12-05 14:54 ` [PATCH 01/16] i.MX: esdhc: Enable host->clk during initialization Andrey Smirnov
2016-12-05 14:54 ` [PATCH 02/16] i.MX: ocotp: Add provisions for storing multiple MAC addresses Andrey Smirnov
2016-12-05 15:14   ` Stefan Lengfeld
2016-12-06 14:48     ` Andrey Smirnov
2016-12-07  8:51       ` Stefan Lengfeld
2016-12-07 19:13         ` Sascha Hauer [this message]
2016-12-07 19:36           ` Andrey Smirnov
2016-12-07 20:57             ` Sascha Hauer
2016-12-07 19:32         ` Andrey Smirnov
2016-12-05 14:54 ` [PATCH 03/16] i.MX: ocotp: Initialize OCOTP as early as possible Andrey Smirnov
2016-12-05 14:54 ` [PATCH 04/16] i.MX: ocotp: Initialize 'sense_enable' to true on Vybrid Andrey Smirnov
2016-12-05 14:54 ` [PATCH 05/16] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype Andrey Smirnov
2016-12-05 14:54 ` [PATCH 06/16] i.MX: vf610: Ramp CPU clock to maximum frequency Andrey Smirnov
2016-12-07 19:27   ` Sascha Hauer
2016-12-12  5:24     ` Andrey Smirnov
2016-12-05 14:54 ` [PATCH 07/16] i.MX: iomuxv3: Add low-level pad code to headers Andrey Smirnov
2016-12-05 14:54 ` [PATCH 08/16] i.MX: iomuxv3: Add helper type to deconstruct iomux_v3_cfg_t values Andrey Smirnov
2016-12-05 14:54 ` [PATCH 09/16] i.MX: iomuxv3: Add low-level pad configuration routine Andrey Smirnov
2016-12-05 14:54 ` [PATCH 10/16] i.MX6: sabresd: Remove magic numbers in setup_uart Andrey Smirnov
2016-12-05 14:54 ` [PATCH 11/16] i.MX: iomuxv3: Use helper functions in iomux-v3.h Andrey Smirnov
2016-12-05 14:54 ` [PATCH 12/16] i.MX: vf610: Add low-level pin configuration helper Andrey Smirnov
2016-12-05 14:54 ` [PATCH 13/16] i.MX: iomux-vf610: Add missing pad definitions Andrey Smirnov
2016-12-05 14:54 ` [PATCH 14/16] i.MX: imx-usb-phy: Add VF610 OF compatiblity string Andrey Smirnov
2016-12-05 14:54 ` [PATCH 15/16] i.MX: Default CONFI_USB_IMX_PHY to 'y' on Vybrid Andrey Smirnov
2016-12-05 14:54 ` [PATCH 16/16] i.MX: imx-usb-misc: Add Vybrid support Andrey Smirnov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161207191343.v2y3dmzo4m67ws3c@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.lengfeld@phytec.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox