Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp69739imm; Wed, 3 Oct 2018 12:03:28 -0700 (PDT) X-Google-Smtp-Source: ACcGV61C/hb0flcqApe43JrMm6rxbCodYawDj8Fjm08uj1ljkuFsRoro1S9BtRZk8iAyHptX3GfE X-Received: by 2002:a17:902:28a8:: with SMTP id f37-v6mr3069375plb.264.1538593408261; Wed, 03 Oct 2018 12:03:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538593408; cv=none; d=google.com; s=arc-20160816; b=YUJAWW+lnAc3uyq6eNZKoEEYyp/WlII+EV7YYt8ZrRWawS+JH+eheYjKGY74aKWAhC Lcr3HVzhlxI8XkNF5GhBO8bcsOwjPKXR4BvHHA0hkoeKCnA3+Gj3jSQgpZlJdJOuR4Cr G4vF3tqUMW+MwNXUiEM+CSmojwR6sZst2adTPGmjTbC2kjdGi8O+MpbahbSsGhbkiAmH p3Lw561WymwAcER5UJ/oStpCil4ZgwvW8P6IUFptPlIr37ne50MbJBR/GuiVHz9hZAnE CpkDgFMcAk5mqMd9/hH4l6wAt3RsAg9hfJqCLZGy0fvc0Aa0/gE4EpIbyc7oopwwJIGA HDfw== 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=l2ZSFXBo/Pchh3U6n9m3tlYLrJcQV/pCy1L2ow9Ygiw=; b=VEl/Hok+BCQCa/gHeL+i8a8i+AGlCgvCEF35R/Z8mJ05J9tgqgiS8l1C2f/JgbWHnB J6G7pHLVN2E2TN8jXyBDrT+bgHIpWf+7GqjX13E6l2U43rTssGtZ/Cq2OLWcSYCftlng GQ16LCHYcQJCoEVfwClt1zGepKoxDdGxBDPPA2SyLiMWaCcpPOUKVHaTgH3lcbu6e4Y8 gunwBvK4nuflB73/0wCLftUl8THTCW0tojpNGXQZ+eXU1cVGyjjT/Ns9rBh6rGyHwL1B KUhD9w3XDzrtm0GNXN0MNbSQcpK94UkzXzLDz/rtCEwUNewRObPfiW6L/zeKOWTbvsD1 iukA== 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 d4-v6si2343224pgj.341.2018.10.03.12.03.09; Wed, 03 Oct 2018 12:03:28 -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 S1727209AbeJDBwl (ORCPT + 99 others); Wed, 3 Oct 2018 21:52:41 -0400 Received: from smtprelay0174.hostedemail.com ([216.40.44.174]:49195 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726950AbeJDBwl (ORCPT ); Wed, 3 Oct 2018 21:52:41 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay08.hostedemail.com (Postfix) with ESMTP id 0EE66182CED2A; Wed, 3 Oct 2018 19:03:01 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: X-HE-Tag: vest59_36ba49960b458 X-Filterd-Recvd-Size: 3878 Received: from XPS-9350.home (unknown [47.151.153.53]) (Authenticated sender: joe@perches.com) by omf02.hostedemail.com (Postfix) with ESMTPA; Wed, 3 Oct 2018 19:02:55 +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: Geert Uytterhoeven Cc: Boris Brezillon , Wolfram Sang , Linux I2C , Jonathan Corbet , "open list:DOCUMENTATION" , Greg KH , Arnd Bergmann , 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 , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List , Vitor Soares , Linus Walleij , Xiang Lin , "open list:GPIO SUBSYSTEM" , Sekhar Nori , pgaj@cadence.com, Peter Rosin , mshettel@codeaurora.org, swboyd@chromium.org Date: Wed, 03 Oct 2018 12:02:54 -0700 In-Reply-To: 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 20:45 +0200, Geert Uytterhoeven wrote: > Hi Joe, > > On Wed, Oct 3, 2018 at 8:37 PM Joe Perches 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