Linux I2C development
 help / color / mirror / Atom feed
From: Eduardo Valentin <eduval@amazon.com>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Eduardo Valentin <eduval@amazon.com>,
	Andy Shevchenko <andriy.shevchenko@intel.com>,
	Wolfram Sang <wsa@the-dreams.de>,
	Haiyue Wang <haiyue.wang@linux.intel.com>,
	Jarkko Nikula <jarkko.nikula@linux.intel.com>,
	Brendan Higgins <brendanhiggins@google.com>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-i2c <linux-i2c@vger.kernel.org>,
	devicetree <devicetree@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/3] i2c: slave-mqueue: add a slave backend to receive and queue messages
Date: Wed, 5 Jun 2019 08:31:20 -0700	[thread overview]
Message-ID: <20190605153120.GC1534@u40b0340c692b58f6553c.ant.amazon.com> (raw)
In-Reply-To: <CAHp75Vc2us0UDmGnzjF0vkzWM_9KqRa0AZKnRsUYmFRTsgwEyg@mail.gmail.com>

On Wed, Jun 05, 2019 at 06:20:37PM +0300, Andy Shevchenko wrote:
> On Wed, Jun 5, 2019 at 5:32 PM Eduardo Valentin <eduval@amazon.com> wrote:
> > On Wed, Jun 05, 2019 at 11:25:39AM +0300, Andy Shevchenko wrote:
> > > On Wed, Jun 5, 2019 at 6:30 AM Eduardo Valentin <eduval@amazon.com> wrote:
> 
> > Well, yes, but the point is you would be switching from a simple AND (&) operation
> > to a division...
> >
> > I am keeping the power of 2 dep so that we can keep this with a simple &.
> 
> Works for me.
> 
> > > > > > +           .of_match_table = of_match_ptr(i2c_slave_mqueue_of_match),
> > > > >
> > > > > Wouldn't compiler warn you due to unused data?
> > > > > Perhaps drop of_match_ptr() for good...
> > > >
> > > > Not sure what you meant here. I dont see any compiler warning.
> > > > Also, of_match_ptr seams to be well spread in the kernel.
> > >
> > > If this will be compiled with CONFIG_OF=n...
> >
> > I see.. I obviously did not test with that config..
> >
> > > Though I didn't check all dependencies to see if it even possible. In
> > > any case of_match_ptr() is redundant in both cases here.
> > > Either you need to protect i2c_slave_mqueue_of_match with #ifdef
> > > CONFIG_OF, or drop the macro use.
> >
> > I will wrap it into CONFIG_OF..
> 
> Would be this expected to work in the case of CONFIG_OF=n?
> If no, why to introduce ugly #ifdef:s and additional macros?

I do hate those too...

> Wouldn't be better to have
>   depends on OF || COMPILE_TEST

Well, technically, the original author had a case for using this
without CONFIG_OF. That is why I did not force here to be a strong
dependency on CONFIG_OF. So, I guess in this case the driver will
work properly in both cases if we:

+#ifdef CONFIG_OF
+static const struct of_device_id i2c_slave_mqueue_of_match[] = {
+       {
+               .compatible = "i2c-slave-mqueue",
+       },
+       { /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, i2c_slave_mqueue_of_match);
+#endif
+
+static struct i2c_driver i2c_slave_mqueue_driver = {
+       .driver = {
+               .name   = "i2c-slave-mqueue",
+               .of_match_table = of_match_ptr(i2c_slave_mqueue_of_match),
+       },
+       .probe          = i2c_slave_mqueue_probe,
+       .remove         = i2c_slave_mqueue_remove,
+       .id_table       = i2c_slave_mqueue_id,
+};

The above is a well stablish pattern across the drivers.

> ?
> 
> -- 
> With Best Regards,
> Andy Shevchenko

-- 
All the best,
Eduardo Valentin

  reply	other threads:[~2019-06-05 15:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-31  4:33 [PATCH 0/3] introduce i2c-slave-mqueue Eduardo Valentin
2019-05-31  4:33 ` [PATCH 1/3] dt-bindings: i2c: document bindings for i2c-slave-mqueue Eduardo Valentin
2019-05-31  4:33 ` [PATCH 2/3] i2c: slave-mqueue: add a slave backend to receive and queue messages Eduardo Valentin
2019-06-04 17:16   ` Andy Shevchenko
2019-06-05  3:27     ` Eduardo Valentin
2019-06-05  8:25       ` Andy Shevchenko
2019-06-05 14:31         ` Eduardo Valentin
2019-06-05 15:20           ` Andy Shevchenko
2019-06-05 15:31             ` Eduardo Valentin [this message]
2019-06-05 15:58               ` Andy Shevchenko
2019-05-31  4:33 ` [PATCH 3/3] Documentation: ABI: Add i2c-slave-mqueue sysfs documentation Eduardo Valentin

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=20190605153120.GC1534@u40b0340c692b58f6553c.ant.amazon.com \
    --to=eduval@amazon.com \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=brendanhiggins@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=haiyue.wang@linux.intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --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