Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp46794imm; Wed, 3 Oct 2018 11:37:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV62OK3b+Vzy2RRvwZFDGAUg4rSo8EOveBkYsYym3Pdm7MQ8B4e6piqTnGrKWCfFdjetfTlNd X-Received: by 2002:a63:1d10:: with SMTP id d16-v6mr2424300pgd.228.1538591868164; Wed, 03 Oct 2018 11:37:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538591868; cv=none; d=google.com; s=arc-20160816; b=qfNvFEZrE8vrm4YMc8467JjKrPRvXW7pNBUFm7lrwvNvZlqo8iQlR8sRYoR5SFe5WG lW/ABZtiN+TqotFR9k2/acEucMMOC/fBDIzQGzcf/Xif6l615OuwZKaSAtHu0VttMUEM UhSdn/4jBfF0QCS7xg9B/0otZDQQqMmPCpaNPKr5iFpmze1+TvtJ3Q/aUSrjHh+a5YJs pi5+6EFDmMtNu/K432jvMAeJY/7QOq3YDuW9oUHZdKlMyM/WJsuxyrLsDpYGZftZT6ld Lklpt6bvgVbXjfFmZ0WSuOCO7igA4h2Qxy83r1xui5lxuQMoMO/9b9TQr2rsCR0A49yS pkNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id; bh=2kV5of1jF5C1p2NttmUopEUP94NOealYbYmU3+2CFK0=; b=xTT6MWE0PVkX6QNkSdRKo1Ta4/q4uUekp8BXFyDadCUii0WFX4Q+20rcS9gzSw9A3Y aG5YFjKuhN5OQNT8O8rtfzfByIIU2kfCKdlU23tde0rwqQPvrYN3ouKCZrgKm2RbfDdY k7ucJSPMWK8rKKiJwV/GdwbqzwppSgIY+Blok31+uvc2DWRit7yccAd7qHuD/B2hzCni LuoV/ie/3zaN1iLojVaxxvf8jUUiPdmTXd5wzixWNslCixgnxpjFze34nUUnLOo2TOo9 tHTw/WebeQZMdmLr6ic/7mi/mxJATaEsAXitFHK7GePAxGbyncUgMH1cNeQ32rKUt2JV 5jYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f7-v6si2334914plr.213.2018.10.03.11.37.32; Wed, 03 Oct 2018 11:37:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727044AbeJDB07 (ORCPT + 99 others); Wed, 3 Oct 2018 21:26:59 -0400 Received: from smtprelay0074.hostedemail.com ([216.40.44.74]:59135 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726851AbeJDB07 (ORCPT ); Wed, 3 Oct 2018 21:26:59 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay03.hostedemail.com (Postfix) with ESMTP id 1F6488368EFC; Wed, 3 Oct 2018 18:37:24 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: X-HE-Tag: paste21_7a19a7c376e08 X-Filterd-Recvd-Size: 3878 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf12.hostedemail.com (Postfix) with ESMTPA; Wed, 3 Oct 2018 18:37:18 +0000 (UTC) Message-ID: Subject: Re: [PATCH v8 05/10] dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg property From: Joe Perches To: Boris Brezillon , Wolfram Sang , linux-i2c@vger.kernel.org, Jonathan Corbet , linux-doc@vger.kernel.org, Greg Kroah-Hartman , Arnd Bergmann Cc: Przemyslaw Sroka , Arkadiusz Golec , Alan Douglas , Bartosz Folta , Damian Kos , Alicja Jurasik-Urbaniak , Cyprian Wronka , Suresh Punnoose , Rafal Ciepiela , Thomas Petazzoni , Nishanth Menon , Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Vitor Soares , Geert Uytterhoeven , Linus Walleij , Xiang Lin , linux-gpio@vger.kernel.org, Sekhar Nori , Przemyslaw Gaj , Peter Rosin , Mike Shettel , Stephen Boyd Date: Wed, 03 Oct 2018 11:37:17 -0700 In-Reply-To: <20181003132212.12619-6-boris.brezillon@bootlin.com> References: <20181003132212.12619-1-boris.brezillon@bootlin.com> <20181003132212.12619-6-boris.brezillon@bootlin.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.30.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reviewed-by: Rob Herring > --- > 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 > + */ > + > +#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