From: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
To: Praveen Talari <quic_ptalari@quicinc.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jiri Slaby <jirislaby@kernel.org>, Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-serial@vger.kernel.org, devicetree@vger.kernel.org
Cc: psodagud@quicinc.com, djaggi@quicinc.com,
quic_msavaliy@quicinc.com, quic_vtanuku@quicinc.com,
quic_arandive@quicinc.com, quic_mnaresh@quicinc.com,
quic_shazhuss@quicinc.com
Subject: Re: [PATCH v5 5/8] serial: qcom-geni: move resource control logic to separate functions
Date: Tue, 3 Jun 2025 15:28:37 +0100 [thread overview]
Message-ID: <f912588b-fb54-4257-a4d8-db58e93b8378@linaro.org> (raw)
In-Reply-To: <20250506180232.1299-6-quic_ptalari@quicinc.com>
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@quicinc.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.
next prev parent reply other threads:[~2025-06-03 14:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-06 18:02 [PATCH v5 0/8] Enable QUPs and Serial on SA8255p Qualcomm platforms Praveen Talari
2025-05-06 18:02 ` [PATCH v5 1/8] dt-bindings: serial: describe SA8255p Praveen Talari
2025-05-06 18:23 ` Krzysztof Kozlowski
2025-05-08 5:45 ` Praveen Talari
2025-05-09 4:32 ` Praveen Talari
2025-05-16 6:36 ` Praveen Talari
2025-05-28 5:10 ` Praveen Talari
2025-05-06 18:02 ` [PATCH v5 2/8] dt-bindings: qcom: geni-se: " Praveen Talari
2025-05-06 18:25 ` Krzysztof Kozlowski
2025-05-06 18:02 ` [PATCH v5 3/8] soc: qcom: geni-se: Enable QUPs on SA8255p Qualcomm platforms Praveen Talari
2025-06-03 14:21 ` Bryan O'Donoghue
2025-06-04 7:28 ` Praveen Talari
2025-06-04 8:23 ` Bryan O'Donoghue
2025-05-06 18:02 ` [PATCH v5 4/8] serial: qcom-geni: move resource initialization to separate function Praveen Talari
2025-06-03 14:24 ` Bryan O'Donoghue
2025-05-06 18:02 ` [PATCH v5 5/8] serial: qcom-geni: move resource control logic to separate functions Praveen Talari
2025-06-03 14:28 ` Bryan O'Donoghue [this message]
2025-06-03 14:29 ` Bryan O'Donoghue
2025-06-03 14:46 ` Bryan O'Donoghue
2025-06-04 14:09 ` Praveen Talari
2025-06-04 16:10 ` Praveen Talari
2025-05-06 18:02 ` [PATCH v5 6/8] serial: qcom-geni: move clock-rate logic to separate function Praveen Talari
2025-06-03 14:41 ` Bryan O'Donoghue
2025-06-04 17:11 ` Praveen Talari
2025-06-04 23:49 ` Bryan O'Donoghue
2025-06-05 3:34 ` Praveen Talari
2025-05-06 18:02 ` [PATCH v5 7/8] serial: qcom-geni: Enable PM runtime for serial driver Praveen Talari
2025-06-03 14:42 ` Bryan O'Donoghue
2025-05-06 18:02 ` [PATCH v5 8/8] serial: qcom-geni: Enable Serial on SA8255p Qualcomm platforms Praveen Talari
2025-06-03 14:47 ` Bryan O'Donoghue
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=f912588b-fb54-4257-a4d8-db58e93b8378@linaro.org \
--to=bryan.odonoghue@linaro.org \
--cc=andersson@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=djaggi@quicinc.com \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=konradybcio@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=psodagud@quicinc.com \
--cc=quic_arandive@quicinc.com \
--cc=quic_mnaresh@quicinc.com \
--cc=quic_msavaliy@quicinc.com \
--cc=quic_ptalari@quicinc.com \
--cc=quic_shazhuss@quicinc.com \
--cc=quic_vtanuku@quicinc.com \
--cc=robh@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).