Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB862C433F5 for ; Mon, 10 Jan 2022 08:57:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242101AbiAJI5N (ORCPT ); Mon, 10 Jan 2022 03:57:13 -0500 Received: from mail-sh.amlogic.com ([58.32.228.43]:24076 "EHLO mail-sh.amlogic.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241981AbiAJI4Q (ORCPT ); Mon, 10 Jan 2022 03:56:16 -0500 Received: from [10.18.29.173] (10.18.29.173) by mail-sh.amlogic.com (10.18.11.5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.14; Mon, 10 Jan 2022 16:55:22 +0800 Message-ID: <936e828c-15e0-5223-7daa-94b2fafc2602@amlogic.com> Date: Mon, 10 Jan 2022 16:55:21 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.4.1 Subject: Re: [PATCH] tty: serial: meson: Request the register region in meson_uart_probe() Content-Language: en-US To: , , , , CC: Greg Kroah-Hartman , Rob Herring , Jiri Slaby , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl References: <20220110082616.13474-1-yu.tu@amlogic.com> <20220110082616.13474-5-yu.tu@amlogic.com> From: Yu Tu In-Reply-To: <20220110082616.13474-5-yu.tu@amlogic.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.18.29.173] X-ClientProxiedBy: mail-sh.amlogic.com (10.18.11.5) To mail-sh.amlogic.com (10.18.11.5) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi All, I'm really sorry for sending the wrong specified file. Please ignore the email. I will resend V4. On 2022/1/10 16:26, Yu Tu wrote: > This simplifies resetting the UART controller during probe and will make > it easier to integrate the common clock code which will require the > registers at probe time as well. > > Signed-off-by: Yu Tu > --- > drivers/tty/serial/meson_uart.c | 24 ++++++------------------ > 1 file changed, 6 insertions(+), 18 deletions(-) > > diff --git a/drivers/tty/serial/meson_uart.c b/drivers/tty/serial/meson_uart.c > index c9a37602ffd0..99efe62a1507 100644 > --- a/drivers/tty/serial/meson_uart.c > +++ b/drivers/tty/serial/meson_uart.c > @@ -397,24 +397,11 @@ static int meson_uart_verify_port(struct uart_port *port, > > static void meson_uart_release_port(struct uart_port *port) > { > - devm_iounmap(port->dev, port->membase); > - port->membase = NULL; > - devm_release_mem_region(port->dev, port->mapbase, port->mapsize); > + /* nothing to do */ > } > > static int meson_uart_request_port(struct uart_port *port) > { > - if (!devm_request_mem_region(port->dev, port->mapbase, port->mapsize, > - dev_name(port->dev))) { > - dev_err(port->dev, "Memory region busy\n"); > - return -EBUSY; > - } > - > - port->membase = devm_ioremap(port->dev, port->mapbase, > - port->mapsize); > - if (!port->membase) > - return -ENOMEM; > - > return 0; > } > > @@ -728,6 +715,10 @@ static int meson_uart_probe(struct platform_device *pdev) > if (!port) > return -ENOMEM; > > + port->membase = devm_ioremap_resource(&pdev->dev, res_mem); > + if (IS_ERR(port->membase)) > + return PTR_ERR(port->membase); > + > ret = meson_uart_probe_clocks(pdev, port); > if (ret) > return ret; > @@ -749,10 +740,7 @@ static int meson_uart_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, port); > > /* reset port before registering (and possibly registering console) */ > - if (meson_uart_request_port(port) >= 0) { > - meson_uart_reset(port); > - meson_uart_release_port(port); > - } > + meson_uart_reset(port); > > ret = uart_add_one_port(&meson_uart_driver, port); > if (ret) > > base-commit: b3a9e3b9622ae10064826dccb4f7a52bd88c7407 > prerequisite-patch-id: 97a514f3447511cb204179ce03ae99dc1d5902d9