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: <d96beadb-5693-6c73-8fee-3ac3b4cb9a44@huawei.com>
Date:   Tue, 1 Nov 2022 15:23:29 +0800
From:   chenweilong <chenweilong@...wei.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
CC:     <yangyicong@...ilicon.com>, <robh+dt@...nel.org>,
        <krzysztof.kozlowski+dt@...aro.org>, <wsa@...nel.org>,
        <f.fainelli@...il.com>, <jarkko.nikula@...ux.intel.com>,
        <jdelvare@...e.de>, <william.zhang@...adcom.com>,
        <jsd@...ihalf.com>, <conor.dooley@...rochip.com>,
        <phil.edworthy@...esas.com>,
        <tharunkumar.pasumarthi@...rochip.com>,
        <semen.protsenko@...aro.org>, <kfting@...oton.com>,
        <linux-i2c@...r.kernel.org>, <devicetree@...r.kernel.org>,
        <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH next v9 1/4] i2c: hisi: Add initial device tree support

On 2022/10/31 23:42, Andy Shevchenko wrote:
> On Mon, Oct 31, 2022 at 09:57:51AM +0800, chenweilong wrote:
>> On 2022/10/31 6:01, Andy Shevchenko wrote:
>>> On Sat, Oct 29, 2022 at 07:59:36PM +0800, Weilong Chen wrote:
>>>> The HiSilicon I2C controller can be used on embedded platform, which
>>>> boot from devicetree.
>>> ...
>>>
>>>> +#include <linux/acpi.h>
>>>> +#include <linux/of.h>
>>> Why?
>>>
>>> ...
>>>
>>>> +#ifdef CONFIG_ACPI
>>> Why?
>>>
>>> ...
>>>
>>>> +#ifdef CONFIG_OF
>>> Why?
>>>
>>> ...
>>>
>>>> -		.acpi_match_table = hisi_i2c_acpi_ids,
>>>> +		.acpi_match_table = ACPI_PTR(hisi_i2c_acpi_ids),
>>> Why?
>>>
>>> ...
>>>
>>>> +		.of_match_table = of_match_ptr(hisi_i2c_dts_ids),
>>> Why of_match_ptr()?
>> There's a lot of drivers use of_match_ptr/ACPI_PTR to protect the of_device_id and
>> have explicit headers file references to linux/acpi.h or linux/of.h, such as
>> drivers/media/platform/intel/pxa_camera.c,
>> bluetooth/hci_intel.c, 
>> platform/x86/intel/chtwc_int33fe.c,
>> platform/x86/intel/pmc/core.c and so on.
> We have a lot of the legacy or not-up-to-dated to all new kernel APIs code.
> Does it justify not to use the new approach in the new contribution?
>
> ...
>
>> The acpi.h and of.h have a nice function or macro definition if CONFIG_OF/ACPI is not satisfy,
>> for example:
>>
>> #define ACPI_PTR(_ptr)  (_ptr)  vs  #define ACPI_PTR(_ptr)  (NULL)
>>
>> and also a lot of 'static inline' function there.
> And why do you need it?
>
> ...
>
>> Seems a good idea to remove all of them, the codes your noted may look a bit
>> verbose there. But I think it is valuable for a driver and device ,telling
>> users it support acpi boot or is it just embedded.
> So, what do we gain here?
>
> (Fill the "Advantages of your code" section below)
>
> Disadvantages of your code:
> - ugly ifdeffery which we usually do not appreciate
> - in some cases it's good to have OF ID table on ACPI platforms (see what
>   PRP0001 trick is)
> - use old approach for the compiler on how to avoid warnings of the static
>   variables being defined and not used (note, neither ACPI_PTR() nor
>   of_match_ptr() provides a new approach on that, so you have to amend them
>   first)
> - as a side effect additional headers to be included that are used for 1% or
>   less of their capacity and slow down the compilation

Thanks very much for your detailed explanation.

By the way,  is it valuable to make a cleanup for the legacy not-up-to-dated drivers?

There's lots of of_match_ptr or ACPI_PTR...


Best Regards.


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ