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]
Date:   Wed, 4 Aug 2021 11:35:57 +0200
From:   Hans de Goede <hdegoede@...hat.com>
To:     Andy Shevchenko <andy.shevchenko@...il.com>
Cc:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        Maximilian Luz <luzmaximilian@...il.com>,
        Lee Jones <lee.jones@...aro.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-bluetooth@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Platform Driver <platform-driver-x86@...r.kernel.org>,
        "open list:SERIAL DRIVERS" <linux-serial@...r.kernel.org>,
        Marcel Holtmann <marcel@...tmann.org>,
        Johan Hedberg <johan.hedberg@...il.com>,
        Luiz Augusto von Dentz <luiz.dentz@...il.com>,
        Mark Gross <mgross@...ux.intel.com>,
        Rob Herring <robh@...nel.org>,
        Jiri Slaby <jirislaby@...nel.org>
Subject: Re: [PATCH v1 3/5] Bluetooth: hci_bcm: Use
 serdev_acpi_get_uart_resource() helper

Hi,

On 8/4/21 10:42 AM, Andy Shevchenko wrote:
> On Wed, Aug 4, 2021 at 11:13 AM Hans de Goede <hdegoede@...hat.com> wrote:
>> On 8/3/21 9:29 PM, Andy Shevchenko wrote:
>>> serdev provides a generic helper to get UART Serial Bus resources.
>>> Use it instead of open coded variant.
> 
> ...
> 
>>> +     if (serdev_acpi_get_uart_resource(ares, &uart)) {
>>> +             dev->init_speed = uart->default_baud_rate;
>>> +             dev->oper_speed = 4000000;
>>> +     }
>>> +
>>
>> You are replacing a nice switch-case which handles all relevant resource
>> types with still having a switch-case + a separate if .. else if .. else if ...
>> (also taking patch 4/5 into account).
>>
>> This does not help the readability of this code at all IMHO, so NACK
>> from me for this patch as well as for 4/5.
> 
> I guess it's a matter of style. The main idea is to try avoiding the
> spreading of the customized ACPI resource extraction here and there.

I agree that the helpers make sense for drivers which care about 1
specific type of resource like an I2cSerialBus resource.

But in cases like this where the driver cares about all the resources
in the resource-list just doing a switch-case on the resource-type
directly in the driver just seems cleaner and it certainly is
easier to read. Helpers are nice, but every level of indirection
also means that a developer needs to go and find the function and
lookup what it does when they want to know what is exactly happening.

So lining up all these factors then just sticking with the
switch-case here seems best IMHO.

Also when there is doubt if a cleanup actually makes things
better, which there seems to be here, then it is best to simply
stick with what we have since every code-change may introduce
regressions, may make backporting fixes later more difficult, etc.

Regards,

Hans

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ