[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200531190704.2kluwj3nipvdfccs@mobilestation>
Date: Sun, 31 May 2020 22:07:04 +0300
From: Serge Semin <Sergey.Semin@...kalelectronics.ru>
To: Wolfram Sang <wsa@...-dreams.de>
CC: Serge Semin <fancer.lancer@...il.com>,
<devicetree-compiler@...r.kernel.org>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Thomas Bogendoerfer <tsbogend@...ha.franken.de>,
Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Frank Rowand <frowand.list@...il.com>,
Rob Herring <robh+dt@...nel.org>, <devicetree@...r.kernel.org>,
<linux-i2c@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] check: Add 10bit/slave i2c reg flags support
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
Powered by blists - more mailing lists