[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f912588b-fb54-4257-a4d8-db58e93b8378@linaro.org>
Date: Tue, 3 Jun 2025 15:28:37 +0100
From: Bryan O'Donoghue <bryan.odonoghue@...aro.org>
To: Praveen Talari <quic_ptalari@...cinc.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jirislaby@...nel.org>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Bjorn Andersson <andersson@...nel.org>,
Konrad Dybcio <konradybcio@...nel.org>, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
devicetree@...r.kernel.org
Cc: psodagud@...cinc.com, djaggi@...cinc.com, quic_msavaliy@...cinc.com,
quic_vtanuku@...cinc.com, quic_arandive@...cinc.com,
quic_mnaresh@...cinc.com, quic_shazhuss@...cinc.com
Subject: Re: [PATCH v5 5/8] serial: qcom-geni: move resource control logic to
separate functions
On 06/05/2025 19:02, Praveen Talari wrote:
> Supports use in PM system/runtime frameworks, helping to
> distinguish new resource control mechanisms and facilitate
> future modifications within the new API.
>
> The code that handles the actual enable or disable of resources
> like clock and ICC paths to a separate function
> (geni_serial_resources_on() and geni_serial_resources_off()) which
> enhances code readability.
>
> Signed-off-by: Praveen Talari <quic_ptalari@...cinc.com>
> ---
> v3 -> v4
> - added version log after ---
>
> v1 -> v2
> - returned 0 instead of ret variable
> ---
> drivers/tty/serial/qcom_geni_serial.c | 54 +++++++++++++++++++++------
> 1 file changed, 42 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 6ad759146f71..2cd2085473f3 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1588,6 +1588,42 @@ static struct uart_driver qcom_geni_uart_driver = {
> .nr = GENI_UART_PORTS,
> };
>
> +static int geni_serial_resources_off(struct uart_port *uport)
It seems like an extremely nit-picky thing to say BUT
geni_serial_resources_on();
geni_serial_resources_off();
since that is the order you use in the code below.
> +{
> + struct qcom_geni_serial_port *port = to_dev_port(uport);
> + int ret;
> +
> + dev_pm_opp_set_rate(uport->dev, 0);
> + ret = geni_se_resources_off(&port->se);
> + if (ret)
> + return ret;
> +
> + geni_icc_disable(&port->se);
> +
> + return 0;
> +}
> +
> +static int geni_serial_resources_on(struct uart_port *uport)
> +{
> + struct qcom_geni_serial_port *port = to_dev_port(uport);
> + int ret;
> +
> + ret = geni_icc_enable(&port->se);
> + if (ret)
> + return ret;
You're adding additional logical checks here, which seem reasonable but
are not stated in your commit log.
Please make clear in the commit log that additional, minor function
return checks are added as you do your functional decomposition.
> +
> + ret = geni_se_resources_on(&port->se);
> + if (ret) {
> + geni_icc_disable(&port->se);
> + return ret;
> + }
> +
> + if (port->clk_rate)
> + dev_pm_opp_set_rate(uport->dev, port->clk_rate);
> +
> + return 0;
> +}
> +
> static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
> {
> int ret;
> @@ -1628,23 +1664,17 @@ static int geni_serial_resource_init(struct qcom_geni_serial_port *port)
> static void qcom_geni_serial_pm(struct uart_port *uport,
> unsigned int new_state, unsigned int old_state)
> {
> - struct qcom_geni_serial_port *port = to_dev_port(uport);
>
> /* If we've never been called, treat it as off */
> if (old_state == UART_PM_STATE_UNDEFINED)
> old_state = UART_PM_STATE_OFF;
>
> - if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF) {
> - geni_icc_enable(&port->se);
> - if (port->clk_rate)
> - dev_pm_opp_set_rate(uport->dev, port->clk_rate);
> - geni_se_resources_on(&port->se);
> - } else if (new_state == UART_PM_STATE_OFF &&
> - old_state == UART_PM_STATE_ON) {
> - geni_se_resources_off(&port->se);
> - dev_pm_opp_set_rate(uport->dev, 0);
> - geni_icc_disable(&port->se);
> - }
> + if (new_state == UART_PM_STATE_ON && old_state == UART_PM_STATE_OFF)
> + geni_serial_resources_on(uport);
> + else if (new_state == UART_PM_STATE_OFF &&
> + old_state == UART_PM_STATE_ON)
> + geni_serial_resources_off(uport);
> +
> }
>
> static const struct uart_ops qcom_geni_console_pops = {
> --
> 2.17.1
>
>
Assuming you address my points.
Powered by blists - more mailing lists