lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190605153120.GC1534@u40b0340c692b58f6553c.ant.amazon.com>
Date:   Wed, 5 Jun 2019 08:31:20 -0700
From:   Eduardo Valentin <eduval@...zon.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
CC:     Eduardo Valentin <eduval@...zon.com>,
        Andy Shevchenko <andriy.shevchenko@...el.com>,
        Wolfram Sang <wsa@...-dreams.de>,
        Haiyue Wang <haiyue.wang@...ux.intel.com>,
        Jarkko Nikula <jarkko.nikula@...ux.intel.com>,
        Brendan Higgins <brendanhiggins@...gle.com>,
        Rob Herring <robh+dt@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        linux-i2c <linux-i2c@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        "Linux Kernel Mailing List" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] i2c: slave-mqueue: add a slave backend to receive
 and queue messages

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@...zon.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@...zon.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ