[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e34fdf56-4fdb-b422-17d6-0b35779e37b7@kernel.org>
Date: Thu, 5 Aug 2021 09:33:09 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Hans de Goede <hdegoede@...hat.com>,
Maximilian Luz <luzmaximilian@...il.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Lee Jones <lee.jones@...aro.org>,
platform-driver-x86@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-serial@...r.kernel.org
Cc: Mark Gross <mgross@...ux.intel.com>, Rob Herring <robh@...nel.org>
Subject: Re: [PATCH v2 1/2] serdev: Split and export
serdev_acpi_get_uart_resource()
On 04. 08. 21, 16:29, Andy Shevchenko wrote:
> The same as for I²C Serial Bus resource split and export
> serdev_acpi_get_uart_resource(). We have already a few users
> one of which is converted here.
>
> Rationale of this is to consolidate parsing UART Serial Bus
> resource in one place as it's done, e.g., for I²C Serial Bus.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> Reviewed-by: Hans de Goede <hdegoede@...hat.com>
> ---
> v2: added Rb tag (Hans)
> drivers/tty/serdev/core.c | 36 +++++++++++++++++++++++++++++-------
> include/linux/serdev.h | 14 ++++++++++++++
> 2 files changed, 43 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
> index 92498961fd92..436e3d1ba92c 100644
> --- a/drivers/tty/serdev/core.c
> +++ b/drivers/tty/serdev/core.c
> @@ -562,23 +562,45 @@ struct acpi_serdev_lookup {
> int index;
> };
>
> +/**
> + * serdev_acpi_get_uart_resource - Gets UARTSerialBus resource if type matches
> + * @ares: ACPI resource
> + * @uart: Pointer to UARTSerialBus resource will be returned here
> + *
> + * Checks if the given ACPI resource is of type UARTSerialBus.
> + * In this case, returns a pointer to it to the caller.
> + *
> + * Returns true if resource type is of UARTSerialBus, otherwise false.
Better to write:
* Return: True if resource type is of UARTSerialBus, otherwise false.
which is recognized by sphinx.
> + */
> +bool serdev_acpi_get_uart_resource(struct acpi_resource *ares,
> + struct acpi_resource_uart_serialbus **uart)
> +{
> + struct acpi_resource_uart_serialbus *sb;
> +
> + if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
> + return false;
> +
> + sb = &ares->data.uart_serial_bus;
> + if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_UART)
> + return false;
> +
> + *uart = sb;
> + return true;
Why don't you return NULL, or sb, thus eliminating the parameter?
> +}
> +EXPORT_SYMBOL_GPL(serdev_acpi_get_uart_resource);
thanks,
--
js
suse labs
Powered by blists - more mailing lists