[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7b929a8c8ebaec7ce0f0e09f803e414e74f986b.camel@perches.com>
Date: Wed, 03 Oct 2018 11:37:17 -0700
From: Joe Perches <joe@...ches.com>
To: Boris Brezillon <boris.brezillon@...tlin.com>,
Wolfram Sang <wsa@...-dreams.de>, linux-i2c@...r.kernel.org,
Jonathan Corbet <corbet@....net>, linux-doc@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Arnd Bergmann <arnd@...db.de>
Cc: 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>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org,
Vitor Soares <Vitor.Soares@...opsys.com>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Linus Walleij <linus.walleij@...aro.org>,
Xiang Lin <Xiang.Lin@...aptics.com>,
linux-gpio@...r.kernel.org, Sekhar Nori <nsekhar@...com>,
Przemyslaw Gaj <pgaj@...ence.com>,
Peter Rosin <peda@...ntia.se>,
Mike Shettel <mshettel@...eaurora.org>,
Stephen Boyd <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 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.
> Signed-off-by: Boris Brezillon <boris.brezillon@...tlin.com>
> Reviewed-by: Rob Herring <robh@...nel.org>
> ---
> Changes in v8:
> - None
>
> Changes in v5:
> - none
> ---
> include/dt-bindings/i3c/i3c.h | 28 ++++++++++++++++++++++++++++
> 1 file changed, 28 insertions(+)
> create mode 100644 include/dt-bindings/i3c/i3c.h
>
> diff --git a/include/dt-bindings/i3c/i3c.h b/include/dt-bindings/i3c/i3c.h
> new file mode 100644
> index 000000000000..97448c546649
> --- /dev/null
> +++ b/include/dt-bindings/i3c/i3c.h
> @@ -0,0 +1,28 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/*
> + * Copyright (C) 2017 Cadence Design Systems Inc.
> + *
> + * Author: Boris Brezillon <boris.brezillon@...tlin.com>
> + */
> +
> +#ifndef _DT_BINDINGS_I3C_I3C_H
> +#define _DT_BINDINGS_I3C_I3C_H
> +
> +#define IS_I2C_DEV 0x80000000
> +
> +#define I2C_DEV(addr, lvr) \
> + (addr) (IS_I2C_DEV | (lvr)) 0x0
This looks to be missing surrounding parentheses.
> +
> +#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?
> +
> +#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)
> +
> +#endif
Powered by blists - more mailing lists