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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200325132033.GY1922688@smile.fi.intel.com>
Date:   Wed, 25 Mar 2020 15:20:33 +0200
From:   "andriy.shevchenko@...ux.intel.com" 
        <andriy.shevchenko@...ux.intel.com>
To:     "Vaittinen, Matti" <Matti.Vaittinen@...rohmeurope.com>
Cc:     "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "brendanhiggins@...gle.com" <brendanhiggins@...gle.com>,
        "olteanv@...il.com" <olteanv@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "talgi@...lanox.com" <talgi@...lanox.com>,
        "linux-pm@...r.kernel.org" <linux-pm@...r.kernel.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "davidgow@...gle.com" <davidgow@...gle.com>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
        "lgirdwood@...il.com" <lgirdwood@...il.com>,
        "rdunlap@...radead.org" <rdunlap@...radead.org>,
        "mark.rutland@....com" <mark.rutland@....com>,
        "yamada.masahiro@...ionext.com" <yamada.masahiro@...ionext.com>,
        "Mutanen, Mikko" <Mikko.Mutanen@...rohmeurope.com>,
        "bp@...e.de" <bp@...e.de>,
        "mhiramat@...nel.org" <mhiramat@...nel.org>,
        "krzk@...nel.org" <krzk@...nel.org>,
        "mazziesaccount@...il.com" <mazziesaccount@...il.com>,
        "skhan@...uxfoundation.org" <skhan@...uxfoundation.org>,
        "zaslonko@...ux.ibm.com" <zaslonko@...ux.ibm.com>,
        "Laine, Markus" <Markus.Laine@...rohmeurope.com>,
        "vincenzo.frascino@....com" <vincenzo.frascino@....com>,
        "sre@...nel.org" <sre@...nel.org>,
        "ardb@...nel.org" <ardb@...nel.org>,
        "linus.walleij@...aro.org" <linus.walleij@...aro.org>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "uwe@...ine-koenig.org" <uwe@...ine-koenig.org>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [PATCH v6 09/10] power: supply: Support ROHM bd99954 charger

On Wed, Mar 25, 2020 at 01:00:21PM +0000, Vaittinen, Matti wrote:
> Well, Good morning Andy :)
> 
> On Wed, 2020-03-25 at 14:09 +0200, andriy.shevchenko@...ux.intel.com
> wrote:
> > On Wed, Mar 25, 2020 at 11:36:46AM +0000, Vaittinen, Matti wrote:
> > > On Tue, 2020-03-24 at 12:35 +0200, Andy Shevchenko wrote:
> > > > On Tue, Mar 24, 2020 at 11:50:24AM +0200, Andy Shevchenko wrote:
> > > > > On Tue, Mar 24, 2020 at 10:32:19AM +0200, Matti Vaittinen
> > > > > wrote:
> > > > > > +#include <linux/acpi.h>
> > > > > > +#include <linux/of.h>
> > > > > 
> > > > > I didn't find any evidence of use of those two, otherwise,
> > > > > missed
> > > > > property.h
> > > > > and perhaps mod_devicetable.h.
> > 
> > ...
> > 
> > > > > > +MODULE_DEVICE_TABLE(of, bd9995x_of_match);
> > > > > > +MODULE_DEVICE_TABLE(acpi, bd9995x_acpi_match);
> > > > 
> > > > I have to add since you are using those macros without ifdeffery,
> > > > you
> > > > should
> > > > get warning in !ACPI and/or !OF cases.
> > > > 
> > > > So, drop those of_match_ptr() / ACPI_PTR() and thus above
> > > > headers.
> > > 
> > > Sorry but I don't follow :/ I did drop whole ACPI table as the
> > > battery
> > > information is not fetched from ACPI anyways.
> > 
> > Okay, let's forget then about ACPI bits.
> > 
> > > But I don't know what you
> > > mean by dropping the of_match_ptr?
> > 
> > Literally do not use this macro. Otherwise you make a dependency to
> > OF which
> > should be then in the Kconfig like
> > 
> > 	depend on OF || COMPILE_TEST
> > 
> 
> Hmm... Why is that? In of.h we have #ifndef CONFIG_OF section which
> defines:
> 
> #define of_match_ptr(_ptr)	NULL
> 
> So, this macro is well defined even if !CONFIG_OF, right?

Because your driver makes nonsense in non-OF cases AFAICS, did I miss anything?

> > but in this case you will get compiler warning without ugly ifdeffery
> > around
> > OF ID table (as you pointed below you didn't test that scenario).
> > 
> > > I for sure need the of_device_id as
> > > in many cases both the device matching and module matching are done
> > > based on  of_match_table and of_device_id.
> > > 
> > > I admit I didn't try compiling the !OF config. Are you suggesting I
> > > should put the of_device_id array and populating the of_match_table
> > > in
> > > #ifdef CONFIG_OF? Or maybe you suggest that I will put of_device_id
> > > array in #ifdef CONFIG_OF and use of_match_ptr() when populating
> > > the
> > > of_match_table pointer? I guess that would make sense. I'll do that
> > > -
> > > can you please explain if this was not what you meant.
> > 
> > One of us needs a morning covfefe, I think :-)
> 
> So in !CONFIG_OF case we will have
> .of_match_table = of_match_ptr(bd9995x_of_match),
> preprocessed to form
> .of_match_table = NULL,
> 
> right? So with this macro we can omit introduction of bd9995x_of_match
> when !CONFIG_OF - meaning we only build #ifdeffery arounf the match
> table and not around this assignment.
> 
> So I'll just do 
> 
> #ifdef CONFIG_OF   
> static const struct of_device_id bd9995x_of_match[] = {
>         { .compatible = "rohm,bd99954", },
>         { }
> };          
> MODULE_DEVICE_TABLE(of, bd9995x_of_match);
> #endif

But why?

You really uglify the code with ifdeffery, make a dependency to OF (yes, you
will have to have of.h include) only because of that silly
macro and save 64 bytes of memory footprint.

> and let the
> #define of_match_ptr(_ptr)	NULL
> fix assignment
> .of_match_table = of_match_ptr(bd9995x_of_match),
> 
> when !CONFIG_OF.

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ