Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp54242imm; Wed, 3 Oct 2018 11:45:52 -0700 (PDT) X-Google-Smtp-Source: ACcGV62e6E5RgBoIRZ4Xqr6bwsavT7YDp4QUyTRIzi7ryLsDUmS76GTLe76jXpE7tlhKvKYbY+gc X-Received: by 2002:a17:902:103:: with SMTP id 3-v6mr2976780plb.58.1538592352173; Wed, 03 Oct 2018 11:45:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538592352; cv=none; d=google.com; s=arc-20160816; b=pTbJPF3MEzIAE5/EqZqYbUY8INaYibkY4DlRxMyiqhPB/o8XhKopGsF/dVtxWjxycN TLHkPXnX6SZZPa9EKVlwWLCxk1Lu3EoR1uzScwsFGczH7u9t2tRxAjyZPx5NDBGQadyT tEbBaSaSX2O1mtQNujVavCRcYcz7UwOctY5H6a44syKuq5NDOqOKTl5z2p+iBon0p36l ZXUgNE7u5mg1tsTGGIeuGfA4a0Nq8AEWCgk5lQxh4/ahq4wf38cqYR8ppJy7SjvR0+VA JNGPxSYoyVwWsKyAzzghICDKsNMk0yOEoko7GhpDkm3a+8zUK65pVQUzQhSEFSuHFfz6 YBQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=7H/BHggausBgvhl/2pvWbDrV7w0Drjgjnt6hABz3h5g=; b=RAqIu9nRnNsESZpPo7EEsSrmvbFXQXirAKG0Au3qGr5sJCy1XilHPwjhFucaG4ai5z FbhyR7qUMD17ePxXXhzUiotTIstwz0Bx6QJP0sxl2mfsWI0ZVcK62YFNM9dDYxZ+2oaX 25NuBVPI5V5TBLu7QgXCnyLagp/LQghXUsRyk2jgqIwX/7LwECR7n3AZJPu6I1Mih9f2 48K0zqMPxP3vK2RluD2ie2PzfQON4KxugbQLaYw1yZ/QDpgabhZ3zWRzHZmSqoIOpkvb n4vBioTKEr+7gz5jG764R2PUTTPuHbomX+8FVFaYbq85e8FOPT1V67I1lkzM4KfME7dv VLyw== 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 e14-v6si2158347pfi.184.2018.10.03.11.45.37; Wed, 03 Oct 2018 11:45:52 -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 S1727347AbeJDBev (ORCPT + 99 others); Wed, 3 Oct 2018 21:34:51 -0400 Received: from mail-vk1-f196.google.com ([209.85.221.196]:41893 "EHLO mail-vk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726851AbeJDBeu (ORCPT ); Wed, 3 Oct 2018 21:34:50 -0400 Received: by mail-vk1-f196.google.com with SMTP id x21-v6so297149vke.8; Wed, 03 Oct 2018 11:45:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7H/BHggausBgvhl/2pvWbDrV7w0Drjgjnt6hABz3h5g=; b=UVdBc6BwktM/jY/KNC3R51+0+zXEyRdYYGAcABxkwNfFNOfiF9nu12nTZtjBq5rOFA /kvK2gRuOMH7xtgH+Ovaj7a3jytay8AJmrcOYZH4FcdQAJCWDYOJ++VI3MccApKhsLz0 flQ31P+QuyhjMMtNy0H4UdBSylLGj+lBX+Q2aY2nVAvct50qPVdP4b2A2Rb8P+fOgYDG ubQoElRqq7FRnPV6QjtJfGa7GZXOhv86Gb0fDnPwFG09FQR6e8WQWjMh8o3WC/mGAaux 31E9N7x5FlrOgxMy8THLAxXxvRaIwnRtAlQsbvcaDJ5DzHqSJl7iwPLSAlqywEfQwj9J xvTA== X-Gm-Message-State: ABuFfojTZJxnFC0xVd9LqxhP1KF1wtKs81S74ZmICyq1YBw/nNhcIV9E NyrJ8n6K2VMQ7lrjEjejWIW677LEaChvUeU+SKo= X-Received: by 2002:a1f:2d56:: with SMTP id t83-v6mr1154967vkt.65.1538592314105; Wed, 03 Oct 2018 11:45:14 -0700 (PDT) MIME-Version: 1.0 References: <20181003132212.12619-1-boris.brezillon@bootlin.com> <20181003132212.12619-6-boris.brezillon@bootlin.com> In-Reply-To: From: Geert Uytterhoeven Date: Wed, 3 Oct 2018 20:45:02 +0200 Message-ID: Subject: Re: [PATCH v8 05/10] dt-bindings: i3c: Add macros to help fill I3C/I2C device's reg property To: Joe Perches 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 Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds