lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210104071910.2a2otwxyniu7c22z@vireshk-i7>
Date:   Mon, 4 Jan 2021 12:49:10 +0530
From:   Viresh Kumar <viresh.kumar@...aro.org>
To:     Yangtao Li <tiny.windzz@...il.com>
Cc:     myungjoo.ham@...sung.com, kyungmin.park@...sung.com,
        cw00.choi@...sung.com, krzk@...nel.org, shawnguo@...nel.org,
        s.hauer@...gutronix.de, kernel@...gutronix.de, festevam@...il.com,
        linux-imx@....com, digetx@...il.com, thierry.reding@...il.com,
        jonathanh@...dia.com, yuq825@...il.com, airlied@...ux.ie,
        daniel@...ll.ch, robdclark@...il.com, sean@...rly.run,
        robh@...nel.org, tomeu.vizoso@...labora.com, steven.price@....com,
        alyssa.rosenzweig@...labora.com, stanimir.varbanov@...aro.org,
        agross@...nel.org, bjorn.andersson@...aro.org, mchehab@...nel.org,
        lukasz.luba@....com, adrian.hunter@...el.com,
        ulf.hansson@...aro.org, vireshk@...nel.org, nm@...com,
        sboyd@...nel.org, broonie@...nel.org, gregkh@...uxfoundation.org,
        jirislaby@...nel.org, rjw@...ysocki.net, jcrouse@...eaurora.org,
        hoegsberg@...gle.com, eric@...olt.net, tzimmermann@...e.de,
        marijn.suijten@...ainline.org, gustavoars@...nel.org,
        emil.velikov@...labora.com, jonathan@...ek.ca,
        akhilpo@...eaurora.org, smasetty@...eaurora.org,
        airlied@...hat.com, masneyb@...tation.org, kalyan_t@...eaurora.org,
        tanmay@...eaurora.org, ddavenport@...omium.org,
        jsanka@...eaurora.org, rnayak@...eaurora.org,
        tongtiangen@...wei.com, miaoqinglang@...wei.com,
        khsieh@...eaurora.org, abhinavk@...eaurora.org,
        chandanu@...eaurora.org, groeck@...omium.org, varar@...eaurora.org,
        mka@...omium.org, harigovi@...eaurora.org,
        rikard.falkeborn@...il.com, natechancellor@...il.com,
        georgi.djakov@...aro.org, akashast@...eaurora.org,
        parashar@...eaurora.org, dianders@...omium.org,
        linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-samsung-soc@...r.kernel.org,
        linux-arm-kernel@...ts.infradead.org, linux-tegra@...r.kernel.org,
        dri-devel@...ts.freedesktop.org, lima@...ts.freedesktop.org,
        linux-arm-msm@...r.kernel.org, freedreno@...ts.freedesktop.org,
        linux-media@...r.kernel.org, linux-mmc@...r.kernel.org,
        linux-spi@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH 07/31] serial: qcom_geni_serial: convert to use
 devm_pm_opp_* API

On 01-01-21, 16:54, Yangtao Li wrote:
> Use devm_pm_opp_* API to simplify code, and we don't need
> to make opp_table glabal.
> 
> Let's remove opp_table from geni_se later.
> 
> Signed-off-by: Yangtao Li <tiny.windzz@...il.com>
> ---
>  drivers/tty/serial/qcom_geni_serial.c | 23 +++++++++--------------
>  1 file changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/tty/serial/qcom_geni_serial.c b/drivers/tty/serial/qcom_geni_serial.c
> index 5aada7ebae35..36a92df8ec11 100644
> --- a/drivers/tty/serial/qcom_geni_serial.c
> +++ b/drivers/tty/serial/qcom_geni_serial.c
> @@ -1352,6 +1352,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>  	int irq;
>  	bool console = false;
>  	struct uart_driver *drv;
> +	struct opp_table *opp_table;
>  
>  	if (of_device_is_compatible(pdev->dev.of_node, "qcom,geni-debug-uart"))
>  		console = true;
> @@ -1433,13 +1434,13 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>  	if (of_property_read_bool(pdev->dev.of_node, "cts-rts-swap"))
>  		port->cts_rts_swap = true;
>  
> -	port->se.opp_table = dev_pm_opp_set_clkname(&pdev->dev, "se");
> -	if (IS_ERR(port->se.opp_table))
> -		return PTR_ERR(port->se.opp_table);
> +	opp_table = devm_pm_opp_set_clkname(&pdev->dev, "se");
> +	if (IS_ERR(opp_table))
> +		return PTR_ERR(opp_table);
>  	/* OPP table is optional */
> -	ret = dev_pm_opp_of_add_table(&pdev->dev);
> +	ret = devm_pm_opp_of_add_table(&pdev->dev);
>  	if (ret) {
> -		dev_pm_opp_put_clkname(port->se.opp_table);
> +		devm_pm_opp_put_clkname(&pdev->dev, opp_table);

We shouldn't be doing this here, i.e. put_clkname. Even when the OPP
table isn't present, this driver calls dev_pm_opp_set_rate() which
behaves like clk_set_rate() in this case and so the clk name is still
required by the OPP core.

>  		if (ret != -ENODEV) {
>  			dev_err(&pdev->dev, "invalid OPP table in device tree\n");
>  			return ret;
> @@ -1453,7 +1454,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>  
>  	ret = uart_add_one_port(drv, uport);
>  	if (ret)
> -		goto err;
> +		return ret;
>  
>  	irq_set_status_flags(uport->irq, IRQ_NOAUTOEN);
>  	ret = devm_request_irq(uport->dev, uport->irq, qcom_geni_serial_isr,
> @@ -1461,7 +1462,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>  	if (ret) {
>  		dev_err(uport->dev, "Failed to get IRQ ret %d\n", ret);
>  		uart_remove_one_port(drv, uport);
> -		goto err;
> +		return ret;
>  	}
>  
>  	/*
> @@ -1478,15 +1479,11 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)
>  		if (ret) {
>  			device_init_wakeup(&pdev->dev, false);
>  			uart_remove_one_port(drv, uport);
> -			goto err;
> +			return ret;
>  		}
>  	}
>  
>  	return 0;
> -err:
> -	dev_pm_opp_of_remove_table(&pdev->dev);
> -	dev_pm_opp_put_clkname(port->se.opp_table);
> -	return ret;
>  }
>  
>  static int qcom_geni_serial_remove(struct platform_device *pdev)
> @@ -1494,8 +1491,6 @@ static int qcom_geni_serial_remove(struct platform_device *pdev)
>  	struct qcom_geni_serial_port *port = platform_get_drvdata(pdev);
>  	struct uart_driver *drv = port->private_data.drv;
>  
> -	dev_pm_opp_of_remove_table(&pdev->dev);
> -	dev_pm_opp_put_clkname(port->se.opp_table);
>  	dev_pm_clear_wake_irq(&pdev->dev);
>  	device_init_wakeup(&pdev->dev, false);
>  	uart_remove_one_port(drv, &port->uport);
> -- 
> 2.25.1

-- 
viresh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ