From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63BC4C433DF for ; Sun, 31 May 2020 19:07:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 453002073B for ; Sun, 31 May 2020 19:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728306AbgEaTHI (ORCPT ); Sun, 31 May 2020 15:07:08 -0400 Received: from mail.baikalelectronics.com ([87.245.175.226]:45952 "EHLO mail.baikalelectronics.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726008AbgEaTHI (ORCPT ); Sun, 31 May 2020 15:07:08 -0400 Received: from localhost (unknown [127.0.0.1]) by mail.baikalelectronics.ru (Postfix) with ESMTP id E97B18030866; Sun, 31 May 2020 19:07:05 +0000 (UTC) X-Virus-Scanned: amavisd-new at baikalelectronics.ru Received: from mail.baikalelectronics.ru ([127.0.0.1]) by localhost (mail.baikalelectronics.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Y9PNAVpwnQW7; Sun, 31 May 2020 22:07:05 +0300 (MSK) Date: Sun, 31 May 2020 22:07:04 +0300 From: Serge Semin To: Wolfram Sang CC: Serge Semin , , Alexey Malahov , Thomas Bogendoerfer , Jarkko Nikula , Andy Shevchenko , Frank Rowand , Rob Herring , , , Subject: Re: [PATCH v2] check: Add 10bit/slave i2c reg flags support Message-ID: <20200531190704.2kluwj3nipvdfccs@mobilestation> References: <20200527122525.6929-1-Sergey.Semin@baikalelectronics.ru> <20200527141517.22677-1-Sergey.Semin@baikalelectronics.ru> <20200530093152.GA1038@ninjato> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20200530093152.GA1038@ninjato> X-ClientProxiedBy: MAIL.baikal.int (192.168.51.25) To mail (192.168.51.25) Sender: devicetree-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org On Sat, May 30, 2020 at 11:31:52AM +0200, Wolfram Sang wrote: > > > + addr = reg & 0x3FFFFFFFU; > > + snprintf(unit_addr, sizeof(unit_addr), "%x", addr); > > Hmm, this hardcoded value will not work if we ever need to add another > bit. I hope this will never happen, though. > > > + if ((reg & (1U << 31)) && addr > 0x3ff) > > Same here with bit 31. I'd be glad to use a macro or some helper here, but alas there is no ready-to-use i2c-related one in the dtc code. See, there are hard-coded literals in the PCI nodes checkers (check_pci_device_reg(), check_pci_device_bus_num()) and the hard-coded literals've been in the i2c-nodes checkers even before this patch. > I haven't checked DTC but can't we import the > header with the defines into the project? Or is this then a circular > dependency? > I guess importing header would be much better than the hard-coded values currently used. What do the code maintainers say about that? Any idea how it is supposed to be implemented? -Sergey