[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e62f978f8d6fc3486c35818432d118358b32c58a.camel@perches.com>
Date: Wed, 03 Oct 2018 12:02:54 -0700
From: Joe Perches <joe@...ches.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Boris Brezillon <boris.brezillon@...tlin.com>,
Wolfram Sang <wsa@...-dreams.de>,
Linux I2C <linux-i2c@...r.kernel.org>,
Jonathan Corbet <corbet@....net>,
"open list:DOCUMENTATION" <linux-doc@...r.kernel.org>,
Greg KH <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>,
Przemyslaw Sroka <psroka@...ence.com>,
Arkadiusz Golec <agolec@...ence.com>,
Alan Douglas <adouglas@...ence.com>,
Bartosz Folta <bfolta@...ence.com>,
Damian Kos <dkos@...ence.com>,
Alicja Jurasik-Urbaniak <alicja@...ence.com>,
Cyprian Wronka <cwronka@...ence.com>,
Suresh Punnoose <sureshp@...ence.com>,
Rafal Ciepiela <rafalc@...ence.com>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Nishanth Menon <nm@...com>, Rob Herring <robh+dt@...nel.org>,
Pawel Moll <pawel.moll@....com>,
Mark Rutland <mark.rutland@....com>,
Ian Campbell <ijc+devicetree@...lion.org.uk>,
Kumar Gala <galak@...eaurora.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS"
<devicetree@...r.kernel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Vitor Soares <Vitor.Soares@...opsys.com>,
Linus Walleij <linus.walleij@...aro.org>,
Xiang Lin <Xiang.Lin@...aptics.com>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
Sekhar Nori <nsekhar@...com>, pgaj@...ence.com,
Peter Rosin <peda@...ntia.se>, mshettel@...eaurora.org,
swboyd@...omium.org
Subject: Re: [PATCH v8 05/10] dt-bindings: i3c: Add macros to help fill
I3C/I2C device's reg property
On Wed, 2018-10-03 at 20:45 +0200, Geert Uytterhoeven wrote:
> Hi Joe,
>
> On Wed, Oct 3, 2018 at 8:37 PM Joe Perches <joe@...ches.com> wrote:
> > On Wed, 2018-10-03 at 15:22 +0200, Boris Brezillon wrote:
> > > The reg property of devices connected to an I3C bus have 3 cells, and
> > > filling them manually is not trivial. Provides macros to help doing
> > > that.
> >
> > This patch logic seems excessively fragile.
> > > --- /dev/null
> > > +++ b/include/dt-bindings/i3c/i3c.h
> > > +
> > > +#define I3C_PID(manufid, partid, instid, extrainfo) \
> > > + ((manufid) << 1) \
> > > + (((partid) << 16) | ((instid) << 12) | (extrainfo))
> >
> > This macro doesn't make any sense. Missing a shift and an or?
>
> No, it generates two of the three cells.
>
> > > +
> > > +#define I3C_DEV_WITH_STATIC_ADDR(addr, manufid, partid, \
> > > + instid, extrainfo) \
> > > + (addr) I3C_PID(manufid, partid, instid, extrainfo)
> > > +
> > > +#define I3C_DEV(manufid, partid, instid, extrainfo) \
> > > + I3C_DEV_WITH_STATIC_ADDR(0x0, manufid, partid, \
> > > + instid, extrainfo)
>
> And the above two macros generate all three cells.
It seems none of the other include/dt-bindings/ .h files
have unusual macros like these.
Perhaps this file should not have a .h extension but
something be named like i3c_reg_property.macros
Powered by blists - more mailing lists