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  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 12 Feb 2019 14:54:26 +0100
From:   Pavel Machek <pavel@....cz>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Linus Walleij <linus.walleij@...aro.org>,
        Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Jacek Anaszewski <jacek.anaszewski@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Sebastian Reichel <sre@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Input <linux-input@...r.kernel.org>,
        Linux LED Subsystem <linux-leds@...r.kernel.org>,
        Linux PM list <linux-pm@...r.kernel.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH v3 07/11] power: supply: max77650: add support for
 battery charger

On Tue 2019-02-12 14:31:52, Bartosz Golaszewski wrote:
> wt., 12 lut 2019 o 13:07 Pavel Machek <pavel@....cz> napisaƂ(a):
> >
> > Hi!
> >
> > > +#define MAX77650_CHARGER_ENABLED             BIT(0)
> > > +#define MAX77650_CHARGER_DISABLED            0x00
> > > +#define MAX77650_CHARGER_CHG_EN_MASK         BIT(0)
> > > +
> > > +#define MAX77650_CHARGER_CHG_DTLS_MASK               GENMASK(7, 4)
> > > +#define MAX77650_CHARGER_CHG_DTLS_BITS(_reg) \
> > > +             (((_reg) & MAX77650_CHARGER_CHG_DTLS_MASK) >> 4)
> > > +
> > > +#define MAX77650_CHARGER_CHG_OFF             0x00
> > > +#define MAX77650_CHARGER_CHG_PREQ            0x01
> > > +#define MAX77650_CHARGER_CHG_ON_CURR         0x02
> > > +#define MAX77650_CHARGER_CHG_ON_JCURR                0x03
> > > +#define MAX77650_CHARGER_CHG_ON_VOLT         0x04
> > > +#define MAX77650_CHARGER_CHG_ON_JVOLT                0x05
> > > +#define MAX77650_CHARGER_CHG_ON_TOPOFF               0x06
> > > +#define MAX77650_CHARGER_CHG_ON_JTOPOFF              0x07
> > > +#define MAX77650_CHARGER_CHG_DONE            0x08
> > > +#define MAX77650_CHARGER_CHG_JDONE           0x09
> > > +#define MAX77650_CHARGER_CHG_SUSP_PF         0x0a
> > > +#define MAX77650_CHARGER_CHG_SUSP_FCF                0x0b
> > > +#define MAX77650_CHARGER_CHG_SUSP_BTF                0x0c
> >
> > These are really bad define names. We are in charger driver, so
> > MAX77650_CHARGER_ really should be shortened/ommited. OTOH
> > more space should be given to "CHG_SUSP_BTF" as it is impossible to decipher.
> >
> 
> I disagree about the prefix bit. I prefer to use common prefixes for
> all symbols in a driver. I would rather add comments to every
> definition here.

So what about shortened? (And what about UVL/OVL below?)

And... what you prefer is not quite important. It is important that
other people can read your code. And what "PF" is is
important... unlike MAX77650_CHARGER_ which is long but unimportant.



> > > +#define MAX77650_CHARGER_CHGIN_DTLS_MASK     GENMASK(3, 2)
> > > +#define MAX77650_CHARGER_CHGIN_DTLS_BITS(_reg) \
> > > +             (((_reg) & MAX77650_CHARGER_CHGIN_DTLS_MASK) >> 2)
> > > +
> > > +#define MAX77650_CHARGER_CHGIN_UVL           0x00
> > > +#define MAX77650_CHARGER_CHGIN_OVL           0x01
> > > +#define MAX77650_CHARGER_CHGIN_OKAY          0x11
> >
> > UVL -> UNDERVOLTAGE, OVL -> OVERVOLTAGE?
> >
> >
> > --
> > (english) http://www.livejournal.com/~pavelmachek
> > (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)

Powered by blists - more mailing lists