From: Sascha Hauer <s.hauer@pengutronix.de>
To: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH v2 03/21] i.MX: ocotp: Simplify MAC address storing logic
Date: Mon, 9 Jan 2017 12:28:25 +0100 [thread overview]
Message-ID: <20170109112825.qa2yvfshsevot6ut@pengutronix.de> (raw)
In-Reply-To: <20170109111830.7eqrjbrm3av6hjsg@pengutronix.de>
On Mon, Jan 09, 2017 at 12:18:30PM +0100, Sascha Hauer wrote:
> On Mon, Dec 12, 2016 at 10:02:50AM -0800, Andrey Smirnov wrote:
> > Store MAC addresses as 8 byte buffer to avoid the need to have extra
> > code to deal with "6 into 8" conversions and the need to have various
> > magic numbers.
> >
> > Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
> > ---
> > arch/arm/mach-imx/ocotp.c | 11 +++++------
> > 1 file changed, 5 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/mach-imx/ocotp.c b/arch/arm/mach-imx/ocotp.c
> > index 7f625d8..f549c94 100644
> > --- a/arch/arm/mach-imx/ocotp.c
> > +++ b/arch/arm/mach-imx/ocotp.c
> > @@ -84,7 +84,7 @@ struct ocotp_priv {
> > struct device_d dev;
> > int permanent_write_enable;
> > int sense_enable;
> > - char ethaddr[6];
> > + char ethaddr[MAC_BYTES];
> > struct regmap_config map_config;
> > const struct imx_ocotp_data *data;
> > };
> > @@ -409,25 +409,24 @@ static void memreverse(void *dest, const void *src, size_t n)
> > static int imx_ocotp_get_mac(struct param_d *param, void *priv)
> > {
> > struct ocotp_priv *ocotp_priv = priv;
> > - char buf[8];
> > + char buf[MAC_BYTES];
> > int ret;
> >
> > ret = regmap_bulk_read(ocotp_priv->map, MAC_OFFSET, buf, MAC_BYTES);
> > if (ret < 0)
> > return ret;
> >
> > - memreverse(ocotp_priv->ethaddr, buf, 6);
> > + memreverse(ocotp_priv->ethaddr, buf, MAC_BYTES);
> > return 0;
> > }
> >
> > static int imx_ocotp_set_mac(struct param_d *param, void *priv)
> > {
> > struct ocotp_priv *ocotp_priv = priv;
> > - char buf[8];
> > + char buf[MAC_BYTES];
> > int ret;
> >
> > - memreverse(buf, ocotp_priv->ethaddr, 6);
> > - buf[6] = 0; buf[7] = 0;
> > + memreverse(buf, ocotp_priv->ethaddr, MAC_BYTES);
>
> Unless I have knots in my mind this does not work. dev_add_param_mac()
> expects the MAC address in the given buffer. We pass priv->ethaddr, but
> now with this change the MAC address is in priv->ethaddr + 2. Anything I
> don't see here?
And indeed I see the wrong MAC address in "devinfo ocotp0"
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
next prev parent reply other threads:[~2017-01-09 11:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-12 18:02 [PATCH v2 00/21] Vybrid related patches Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 01/21] i.MX: esdhc: Enable host->clk during initialization Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 02/21] i.MX: ocotp: Move memory reversing into a subroutine Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 03/21] i.MX: ocotp: Simplify MAC address storing logic Andrey Smirnov
2017-01-09 11:18 ` Sascha Hauer
2017-01-09 11:28 ` Sascha Hauer [this message]
2017-01-10 15:02 ` Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 04/21] i.MX: ocotp: Add provisions for storing multiple MAC addresses Andrey Smirnov
2016-12-13 9:56 ` Stefan Lengfeld
2016-12-12 18:02 ` [PATCH 05/21] i.MX: ocotp: Initialize OCOTP as early as possible Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 06/21] i.MX: clk: Add IMX_PLLV3_SYS_VF610 subtype Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 07/21] i.MX: ocotp: Add imx_ocotp_sense_enable() Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 08/21] i.MX: imx6-fusemap: Fix SJC_RESP_LOCK width Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 09/21] i.MX: Add fusemap for VF610 Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 10/21] i.MX: vf610: Ramp CPU clock to maximum frequency Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 11/21] i.MX: iomuxv3: Add low-level pad code to headers Andrey Smirnov
2016-12-12 18:02 ` [PATCH v2 12/21] i.MX: iomuxv3: Add helper type to deconstruct iomux_v3_cfg_t values Andrey Smirnov
2017-01-09 12:00 ` Sascha Hauer
2017-01-10 15:01 ` Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 13/21] i.MX: iomuxv3: Add low-level pad configuration routine Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 14/21] i.MX6: sabresd: Remove magic numbers in setup_uart Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 15/21] i.MX: iomuxv3: Use helper functions in iomux-v3.h Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 16/21] i.MX: vf610: Add low-level pin configuration helper Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 17/21] i.MX: iomux-vf610: Add missing pad definitions Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 18/21] i.MX: imx-usb-phy: Add VF610 OF compatiblity string Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 19/21] i.MX: Default CONFI_USB_IMX_PHY to 'y' on Vybrid Andrey Smirnov
2017-01-09 12:03 ` Sascha Hauer
2017-01-10 15:02 ` Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 20/21] i.MX: imx-usb-misc: Add Vybrid support Andrey Smirnov
2016-12-12 18:03 ` [PATCH v2 21/21] i.MX: vf610-twr: Remove MSCM setup code 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=20170109112825.qa2yvfshsevot6ut@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=andrew.smirnov@gmail.com \
--cc=barebox@lists.infradead.org \
/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