[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87778067-5b45-8e83-b624-545b39a0e00d@redhat.com>
Date: Wed, 4 Aug 2021 10:12:18 +0200
From: Hans de Goede <hdegoede@...hat.com>
To: 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@...r.kernel.org,
platform-driver-x86@...r.kernel.org, linux-serial@...r.kernel.org
Cc: 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/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.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> drivers/bluetooth/hci_bcm.c | 15 ++++++---------
> 1 file changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/bluetooth/hci_bcm.c b/drivers/bluetooth/hci_bcm.c
> index 3cd57fc56ade..16f854ac19b6 100644
> --- a/drivers/bluetooth/hci_bcm.c
> +++ b/drivers/bluetooth/hci_bcm.c
> @@ -899,9 +899,9 @@ static const struct acpi_gpio_mapping acpi_bcm_int_first_gpios[] = {
> static int bcm_resource(struct acpi_resource *ares, void *data)
> {
> struct bcm_device *dev = data;
> + struct acpi_resource_uart_serialbus *uart;
> struct acpi_resource_extended_irq *irq;
> struct acpi_resource_gpio *gpio;
> - struct acpi_resource_uart_serialbus *sb;
>
> switch (ares->type) {
> case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
> @@ -920,18 +920,15 @@ static int bcm_resource(struct acpi_resource *ares, void *data)
> dev->gpio_count++;
> break;
>
> - case ACPI_RESOURCE_TYPE_SERIAL_BUS:
> - sb = &ares->data.uart_serial_bus;
> - if (sb->type == ACPI_RESOURCE_SERIAL_TYPE_UART) {
> - dev->init_speed = sb->default_baud_rate;
> - dev->oper_speed = 4000000;
> - }
> - break;
> -
> default:
> break;
> }
>
> + 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.
Regards,
Hans
Powered by blists - more mailing lists