lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <144bc58e8fbb350e3a1810654dea9427a86460be.camel@fi.rohmeurope.com>
Date:   Tue, 29 Oct 2019 14:08:58 +0000
From:   "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
To:     "alexandre.belloni@...tlin.com" <alexandre.belloni@...tlin.com>
CC:     "dmurphy@...com" <dmurphy@...com>,
        "linux-leds@...r.kernel.org" <linux-leds@...r.kernel.org>,
        "linux-rtc@...r.kernel.org" <linux-rtc@...r.kernel.org>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "mazziesaccount@...il.com" <mazziesaccount@...il.com>,
        "mturquette@...libre.com" <mturquette@...libre.com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "jacek.anaszewski@...il.com" <jacek.anaszewski@...il.com>,
        "a.zummo@...ertech.it" <a.zummo@...ertech.it>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "bgolaszewski@...libre.com" <bgolaszewski@...libre.com>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        "pavel@....cz" <pavel@....cz>,
        "sboyd@...nel.org" <sboyd@...nel.org>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "lee.jones@...aro.org" <lee.jones@...aro.org>
Subject: Re: [RFC PATCH 09/13] mfd: rtc: support RTC on ROHM BD71828 with
 BD70528 driver


On Tue, 2019-10-29 at 14:50 +0100, Alexandre Belloni wrote:
> On 23/10/2019 10:27:43+0000, Vaittinen, Matti wrote:
> > Hello again Alexandre,
> > 
> > On Thu, 2019-10-17 at 12:48 +0200, Alexandre Belloni wrote:
> > > On 17/10/2019 10:36:44+0000, Vaittinen, Matti wrote:
> > > > Hello Alexandre,
> > > > 
> > > > Thanks for quick check! I'll be off for the rest of the week
> > > > but I
> > > > will
> > > > re-work this patch at next week :) I agree with you regarding
> > > > most
> > > > of
> > > > the comments.
> > > > 
> > > > > > +
> > > > > > +
> > > > > > +/*
> > > > > > + * RTC definitions shared between
> > > > > > + *
> > > > > > + * BD70528
> > > > > > + * and BD71828
> > > > > > + */
> > > > > > +
> > > > > > +#define ROHM_BD1_MASK_RTC_SEC		0x7f
> > > > > > +#define ROHM_BD1_MASK_RTC_MINUTE	0x7f
> > > > > > +#define ROHM_BD1_MASK_RTC_HOUR_24H	0x80
> > > > > > +#define ROHM_BD1_MASK_RTC_HOUR_PM	0x20
> > > > > > +#define ROHM_BD1_MASK_RTC_HOUR		0x3f
> > > > > > +#define ROHM_BD1_MASK_RTC_DAY		0x3f
> > > > > > +#define ROHM_BD1_MASK_RTC_WEEK		0x07
> > > > > > +#define ROHM_BD1_MASK_RTC_MONTH		0x1f
> > > > > > +#define ROHM_BD1_MASK_RTC_YEAR		0xff
> > > > > > +#define ROHM_BD1_MASK_ALM_EN		0x7
> > > > > > +
> > > > > 
> > > > > All that renaming is distracting and useless. Please resubmit
> > > > > without
> > > > > renaming defines, structs and functions to make it easier to
> > > > > review.
> > > > 
> > > > I would prefer renaming because it makes it clearly visible
> > > > which
> > > > defines/structs/functions are common for both PMICs and which
> > > > are
> > > > PMIC
> > > > specific. But I really understand the problem of spotting real
> > > > changes.
> > > > Would it be Ok if I did renaming in separate patch which does
> > > > not
> > > > bring
> > > > in any other changes - and then the functional changes in
> > > > separate
> > > > patch?
> > > > 
> > > 
> > > No, unless you can guarantee that all future PMICs from rohm
> > > matching
> > > the wildcard will use this driver.
> > > 
> > I started re-working this patch and remembered my original idea
> > regarding the naming :) I should have commented it as I had already
> > forgotten it. You are correct what comes to the difficulty of using
> > correct wild-cards. And I agree with you what comes to function and
> > struct names like bd7xx28 - those are somewhat fragile as next PMIC
> > which we want to support with this driver may be BD12345 - yielding
> > our
> > wild-card useless.
> > 
> > But if we take a look of common definitions in header rohm-shared.h
> > which I added - those are prefixed as ROHM_BD1. My idea was
> > introducing
> > this common RTC define group 1 - which would be common define group
> > for
> > all devices which belong to BD1 group. Currently that would be
> > BD71828
> > and BD70528. What was missing is the comment explaining this (and
> > lack
> > of comment made this useless as even I forgot it already).
> > 
> > I already reverted this naming change and all BD70528 specific and
> > common defines/functions/enums are prefixed with the good old
> > BD70528.
> > Only new definitions which I added for BD71828 are prefixed with
> > BD71828. But how do you see the grouping the common defines to
> > format
> > ROHM_BD<group number>_FOO_BAR in the rohm-shared.h - with comment
> > that
> > group BD1 consists of definitions which are common for BD70528 and
> > BD71828?
> > 
> > My only fear when using prefix BD70528 for common defines is that
> > someone changes some defines to match the BD70528 data-sheet
> > without
> > evaluating if this impacts to other PMICs. It may be useless
> > paranoia
> > though - hence I am asking for your opinion at this phase. I can do
> > this grouping in own patch - or just leave it as it is now in my
> > local
> > repo - with the old BD70528 being common prefix.
> > 
> 
> I don't think those masks will ever change, all the BCD RTCs are
> using
> the same.

I guess this is very true. And to follow this further - If then next
ROHM RTC I work with is not using BCD - then I am probably not trying
to support it with this driver. So I'd say you are correct.

> Note that ROHM_BD1_MASK_RTC_HOUR_24H, ROHM_BD1_MASK_RTC_HOUR_PM and
> ROHM_BD1_MASK_ALM_EN are bits and should use BIT() to make that
> clear.

Ok. I'll use BIT() for new/moved one bit defines in next versions.

> Those may change later but I don't see how someone looking at the
> BD70528 datasheet would get those wrong.

I admit this is unlikely and I don't see the scenario how this can
break - assuming these masks are now correct for BD70528 ;) If there
was an error then having prefix BD70528 for define which is used by
BD71828 (and possibly others) might be error prone as one could fix the
define without checking the BD71828. When we limit this to those three
defines it is _really_ unlikely (and probably not a problem) - but this
was the reason why I wanted to do the renaming of common defines.

By the way, I sent patch v2 couple of days ago - and I kept the BD70528
prefix as you suggested. I'll do that also in next versions so we can
probably say this case is closed :]

Thanks for taking the time to read the patches!

Br,
	Matti Vaittinen

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ