From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-20.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7EE69C4338F for ; Fri, 6 Aug 2021 12:08:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5635561102 for ; Fri, 6 Aug 2021 12:08:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343582AbhHFMJD (ORCPT ); Fri, 6 Aug 2021 08:09:03 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50928 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343550AbhHFMJD (ORCPT ); Fri, 6 Aug 2021 08:09:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628251727; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=V4AdJPieWv1AGBhnfr6N7NI4S2zg5FETvWvC3QgBc/s=; b=Q94Fiuux+J6qOS3VCSIpz0f+JG62RNrXyXb7+X/Pt5NFewetAZB6uR8yT56BUNgG6knrOs A7d1GCg7VPSypL/VNGMwOMXb3k0e9vlMZ8OJELfLvYzyRUEEEspgm9B4E7sVRsosGT81s5 sjdc0T2OG26S68/3gDprTSmxrHn6ZHo= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-vyH3fm5hMb2HE8VmRyoLMA-1; Fri, 06 Aug 2021 08:08:46 -0400 X-MC-Unique: vyH3fm5hMb2HE8VmRyoLMA-1 Received: by mail-ed1-f71.google.com with SMTP id l3-20020aa7c3030000b02903bccf1897f9so4792469edq.19 for ; Fri, 06 Aug 2021 05:08:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=V4AdJPieWv1AGBhnfr6N7NI4S2zg5FETvWvC3QgBc/s=; b=j6kYmrxZCUwYCgUrMNujxiirxpR4MScKujOBCKfVsgs0Gjw4MEW8cIxShh+iDTQuUs tJ2uwoCS+d70soUHeWMHrjoCgLiJ3xDz5wXpzIhEikRJYMhwx0HSC4kRo5MmgWmtwBBN Yeq2dGg1vLU4XQ9EWvwXqwdN7vin6tN3wTSMmfZ23SkLXmVOFmbSr0b5S+bEtTbBOwVJ TFOGzRed8+d0zjtaDG2nmXo9X9bS1O8e8zKn/cUNuZOD1ZmYtyZR8Wc0XQlN/wXtlttI Ysvn2t98R6ewyAlXV1jfI3PUzPqtnIxZy/NLw09I8eQqe6xtJODQI2OZlItuQudv6IHr t32w== X-Gm-Message-State: AOAM531zmFTAk9YvMWdlGVp6Wy5AshiZrEQ2LmOUNf6t2yyUd62hXlZT +TI+4G0CJUv11VwBGAMkPMhmGoEUUOLqlffPk4EUZK2EDB9QSzwVFvJEASrJ+T1ziglo+23Heef n3fQTIWcWAbAD7JpAw7JxpCi6MdIrEltGog== X-Received: by 2002:aa7:c541:: with SMTP id s1mr12750569edr.327.1628251724037; Fri, 06 Aug 2021 05:08:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLIdXKzTovwMCJ/mrOdvKOkViUKmJ8dKu7a05333lEFVX4pxiAwiXziYx/lnIsFREOBCAjjQ== X-Received: by 2002:aa7:c541:: with SMTP id s1mr12750551edr.327.1628251723909; Fri, 06 Aug 2021 05:08:43 -0700 (PDT) Received: from x1.localdomain (2001-1c00-0c1e-bf00-1054-9d19-e0f0-8214.cable.dynamic.v6.ziggo.nl. [2001:1c00:c1e:bf00:1054:9d19:e0f0:8214]) by smtp.gmail.com with ESMTPSA id i10sm3811930edf.12.2021.08.06.05.08.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Aug 2021 05:08:43 -0700 (PDT) Subject: Re: [PATCH v3 1/2] serdev: Split and export serdev_acpi_get_uart_resource() To: Andy Shevchenko , Maximilian Luz , Greg Kroah-Hartman , Lee Jones , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org Cc: Mark Gross , Rob Herring , Jiri Slaby References: <20210806111736.66591-1-andriy.shevchenko@linux.intel.com> From: Hans de Goede Message-ID: Date: Fri, 6 Aug 2021 14:08:42 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210806111736.66591-1-andriy.shevchenko@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org Hi, On 8/6/21 1:17 PM, 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 > Reviewed-by: Hans de Goede As mentioned before I believe it is best if this series is merged in its entirety through to the tty tree, here is my ack for patch 2/2 for that: Acked-by: Hans de Goede Greg, can you pickup the entire series please? Regards, Hans > --- > v3: amended kernel doc to have RETURN section (Jiri) > 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..f1324fe99378 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. > + * > + * Return: True if resource type is of UARTSerialBus, otherwise false. > + */ > +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; > +} > +EXPORT_SYMBOL_GPL(serdev_acpi_get_uart_resource); > + > static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data) > { > struct acpi_serdev_lookup *lookup = data; > struct acpi_resource_uart_serialbus *sb; > acpi_status status; > > - if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) > - return 1; > - > - if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART) > + if (!serdev_acpi_get_uart_resource(ares, &sb)) > return 1; > > if (lookup->index != -1 && lookup->n++ != lookup->index) > return 1; > > - sb = &ares->data.uart_serial_bus; > - > status = acpi_get_handle(lookup->device_handle, > sb->resource_source.string_ptr, > &lookup->controller_handle); > @@ -586,7 +608,7 @@ static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data) > return 1; > > /* > - * NOTE: Ideally, we would also want to retreive other properties here, > + * NOTE: Ideally, we would also want to retrieve other properties here, > * once setting them before opening the device is supported by serdev. > */ > > diff --git a/include/linux/serdev.h b/include/linux/serdev.h > index 9f14f9c12ec4..3368c261ab62 100644 > --- a/include/linux/serdev.h > +++ b/include/linux/serdev.h > @@ -327,4 +327,18 @@ static inline int serdev_tty_port_unregister(struct tty_port *port) > } > #endif /* CONFIG_SERIAL_DEV_CTRL_TTYPORT */ > > +struct acpi_resource; > +struct acpi_resource_uart_serialbus; > + > +#ifdef CONFIG_ACPI > +bool serdev_acpi_get_uart_resource(struct acpi_resource *ares, > + struct acpi_resource_uart_serialbus **uart); > +#else > +static inline bool serdev_acpi_get_uart_resource(struct acpi_resource *ares, > + struct acpi_resource_uart_serialbus **uart) > +{ > + return false; > +} > +#endif /* CONFIG_ACPI */ > + > #endif /*_LINUX_SERDEV_H */ >