From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>,
Andi Shyti <andi.shyti@linux.intel.com>
Subject: Re: [PATCH v1 1/1] serial: 8250_dw: Use devm_clk_get_optional_enabled()
Date: Wed, 20 Sep 2023 13:59:21 +0300 (EEST) [thread overview]
Message-ID: <1b8e8791-688a-59b4-db5b-d7b0b47dbf2e@linux.intel.com> (raw)
In-Reply-To: <20230919195513.3197930-1-andriy.shevchenko@linux.intel.com>
[-- Attachment #1: Type: text/plain, Size: 2649 bytes --]
On Tue, 19 Sep 2023, Andy Shevchenko wrote:
> Use devm_clk_get_optional_enabled() to simplify the code.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
> ---
> drivers/tty/serial/8250/8250_dw.c | 27 +++------------------------
> 1 file changed, 3 insertions(+), 24 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_dw.c b/drivers/tty/serial/8250/8250_dw.c
> index f4cafca1a7da..bdd7ed282061 100644
> --- a/drivers/tty/serial/8250/8250_dw.c
> +++ b/drivers/tty/serial/8250/8250_dw.c
> @@ -498,11 +498,6 @@ static void dw8250_quirks(struct uart_port *p, struct dw8250_data *data)
> }
> }
>
> -static void dw8250_clk_disable_unprepare(void *data)
> -{
> - clk_disable_unprepare(data);
> -}
> -
> static void dw8250_reset_control_assert(void *data)
> {
> reset_control_assert(data);
> @@ -598,23 +593,15 @@ static int dw8250_probe(struct platform_device *pdev)
> device_property_read_u32(dev, "clock-frequency", &p->uartclk);
>
> /* If there is separate baudclk, get the rate from it. */
> - data->clk = devm_clk_get_optional(dev, "baudclk");
> + data->clk = devm_clk_get_optional_enabled(dev, "baudclk");
> if (data->clk == NULL)
> - data->clk = devm_clk_get_optional(dev, NULL);
> + data->clk = devm_clk_get_optional_enabled(dev, NULL);
> if (IS_ERR(data->clk))
> return PTR_ERR(data->clk);
>
> INIT_WORK(&data->clk_work, dw8250_clk_work_cb);
> data->clk_notifier.notifier_call = dw8250_clk_notifier_cb;
>
> - err = clk_prepare_enable(data->clk);
> - if (err)
> - return dev_err_probe(dev, err, "could not enable optional baudclk\n");
> -
> - err = devm_add_action_or_reset(dev, dw8250_clk_disable_unprepare, data->clk);
> - if (err)
> - return err;
> -
> if (data->clk)
> p->uartclk = clk_get_rate(data->clk);
>
> @@ -622,18 +609,10 @@ static int dw8250_probe(struct platform_device *pdev)
> if (!p->uartclk)
> return dev_err_probe(dev, -EINVAL, "clock rate not defined\n");
>
> - data->pclk = devm_clk_get_optional(dev, "apb_pclk");
> + data->pclk = devm_clk_get_optional_enabled(dev, "apb_pclk");
> if (IS_ERR(data->pclk))
> return PTR_ERR(data->pclk);
>
> - err = clk_prepare_enable(data->pclk);
> - if (err)
> - return dev_err_probe(dev, err, "could not enable apb_pclk\n");
> -
> - err = devm_add_action_or_reset(dev, dw8250_clk_disable_unprepare, data->pclk);
> - if (err)
> - return err;
> -
> data->rst = devm_reset_control_get_optional_exclusive(dev, NULL);
> if (IS_ERR(data->rst))
> return PTR_ERR(data->rst);
>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
prev parent reply other threads:[~2023-09-20 10:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 19:55 [PATCH v1 1/1] serial: 8250_dw: Use devm_clk_get_optional_enabled() Andy Shevchenko
2023-09-20 10:59 ` Ilpo Järvinen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1b8e8791-688a-59b4-db5b-d7b0b47dbf2e@linux.intel.com \
--to=ilpo.jarvinen@linux.intel.com \
--cc=andi.shyti@linux.intel.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).