linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Serge Semin <Sergey.Semin@baikalelectronics.ru>
To: Wolfram Sang <wsa@the-dreams.de>
Cc: Serge Semin <fancer.lancer@gmail.com>,
	<devicetree-compiler@vger.kernel.org>,
	Alexey Malahov <Alexey.Malahov@baikalelectronics.ru>,
	Thomas Bogendoerfer <tsbogend@alpha.franken.de>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Frank Rowand <frowand.list@gmail.com>,
	Rob Herring <robh+dt@kernel.org>, <devicetree@vger.kernel.org>,
	<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] check: Add 10bit/slave i2c reg flags support
Date: Sun, 31 May 2020 22:07:04 +0300	[thread overview]
Message-ID: <20200531190704.2kluwj3nipvdfccs@mobilestation> (raw)
In-Reply-To: <20200530093152.GA1038@ninjato>

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

  reply	other threads:[~2020-05-31 19:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-27 12:25 [PATCH] check: Add 10bit/slave i2c reg flags support Serge Semin
2020-05-27 13:36 ` Andy Shevchenko
2020-05-27 14:00   ` Serge Semin
2020-05-27 14:15 ` [PATCH v2] " Serge Semin
2020-05-30  9:31   ` Wolfram Sang
2020-05-31 19:07     ` Serge Semin [this message]
2020-06-01 17:08     ` Rob Herring
2020-06-02  7:46       ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200531190704.2kluwj3nipvdfccs@mobilestation \
    --to=sergey.semin@baikalelectronics.ru \
    --cc=Alexey.Malahov@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree-compiler@vger.kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=fancer.lancer@gmail.com \
    --cc=frowand.list@gmail.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tsbogend@alpha.franken.de \
    --cc=wsa@the-dreams.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).