opp: Unconditionally call dev_pm_opp_of_remove_table()
Subsystems (11)
Viresh Kumar
maintainercover opp: Unconditionally call dev_pm_opp_of_remove_table()
Hello,
This cleans up some of the user code around calls to dev_pm_opp_of_remove_table().
All the patches can be picked by respective maintainers directly except for the last patch, which needs the previous two to get merged first.
These are based for 5.9-rc1.
Rajendra, Since most of these changes are related to qcom stuff, it would be great if you can give them a try. I wasn't able to test them due to lack of hardware.
Viresh Kumar (8):
cpufreq: imx6q: Unconditionally call dev_pm_opp_of_remove_table() drm/lima: Unconditionally call dev_pm_opp_of_remove_table() drm/msm: Unconditionally call dev_pm_opp_of_remove_table()
mmc: sdhci-msm: Unconditionally call dev_pm_opp_of_remove_table()
spi: spi-geni-qcom: Unconditionally call dev_pm_opp_of_remove_table()
spi: spi-qcom-qspi: Unconditionally call dev_pm_opp_of_remove_table()
tty: serial: qcom_geni_serial: Unconditionally call
dev_pm_opp_of_remove_table()
qcom-geni-se: remove has_opp_table
drivers/cpufreq/imx6q-cpufreq.c | 10 ++-------- drivers/gpu/drm/lima/lima_devfreq.c | 6 +----- drivers/gpu/drm/lima/lima_devfreq.h | 1 - drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +++------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/dsi/dsi_host.c | 8 ++------ drivers/mmc/host/sdhci-msm.c | 11 +++-------- drivers/spi/spi-geni-qcom.c | 10 +++------- drivers/spi/spi-qcom-qspi.c | 11 +++-------- drivers/tty/serial/qcom_geni_serial.c | 10 +++------- include/linux/qcom-geni-se.h | 2 -- 11 files changed, 20 insertions(+), 60 deletions(-)
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 3/8 drm/msm: Unconditionally call dev_pm_opp_of_remove_table()
dev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 10 +++------- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 - drivers/gpu/drm/msm/dsi/dsi_host.c | 8 ++------ 3 files changed, 5 insertions(+), 14 deletions(-)
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +3 -7
@@ -1010,9 +1010,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data)return PTR_ERR (dpu_kms->opp_table);/* OPP table is optional */ ret =dev_pm_opp_of_add_table (dev); -if (!ret) { - dpu_kms->has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (dev,"invalid OPP table in device tree\n" );dev_pm_opp_put_clkname (dpu_kms->opp_table);return ret;
@@ -1037,8 +1035,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) priv->kms = &dpu_kms->base;return ret; err: -if (dpu_kms->has_opp_table) -dev_pm_opp_of_remove_table (dev); +dev_pm_opp_of_remove_table (dev);dev_pm_opp_put_clkname (dpu_kms->opp_table);return ret; }
@@ -1056,8 +1053,7 @@ static void dpu_unbind(struct device *dev, struct device *master, void *data)if (dpu_kms->rpm_enabled)pm_runtime_disable (&pdev->dev); -if (dpu_kms->has_opp_table) -dev_pm_opp_of_remove_table (dev); +dev_pm_opp_of_remove_table (dev);dev_pm_opp_put_clkname (dpu_kms->opp_table); }
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +0 -1
@@ -129,7 +129,6 @@ struct dpu_kms {bool rpm_enabled;struct opp_table *opp_table; -bool has_opp_table;struct dss_module_power mp;
drivers/gpu/drm/msm/dsi/dsi_host.c +2 -6
@@ -113,7 +113,6 @@ struct msm_dsi_host {struct clk *byte_intf_clk;struct opp_table *opp_table; -bool has_opp_table;u32 byte_clk_rate;u32 pixel_clk_rate;
@@ -1891,9 +1890,7 @@ int msm_dsi_host_init(struct msm_dsi *msm_dsi)return PTR_ERR (msm_host->opp_table);/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - msm_host->has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"invalid OPP table in device tree\n" );dev_pm_opp_put_clkname (msm_host->opp_table);return ret;
@@ -1934,8 +1931,7 @@ void msm_dsi_host_destroy(struct mipi_dsi_host *host)mutex_destroy (&msm_host->cmd_mutex);mutex_destroy (&msm_host->dev_mutex); -if (msm_host->has_opp_table) -dev_pm_opp_of_remove_table (&msm_host->pdev->dev); +dev_pm_opp_of_remove_table (&msm_host->pdev->dev);dev_pm_opp_put_clkname (msm_host->opp_table);pm_runtime_disable (&msm_host->pdev->dev); }
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 4/8 mmc: sdhci-msm: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/mmc/host/sdhci-msm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/mmc/host/sdhci-msm.c +3 -8
@@ -263,7 +263,6 @@ struct sdhci_msm_host {unsigned long clk_rate;struct mmc_host *mmc;struct opp_table *opp_table; -bool has_opp_table;bool use_14lpp_dll_reset;bool tuning_done;bool calibration_done;
@@ -2285,9 +2284,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - msm_host->has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"Invalid OPP table in Device tree\n" ); goto opp_cleanup; }
@@ -2453,8 +2450,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)clk_bulk_disable_unprepare (ARRAY_SIZE (msm_host->bulk_clks), msm_host->bulk_clks); opp_cleanup: -if (msm_host->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (msm_host->opp_table); bus_clk_disable:if (!IS_ERR (msm_host->bus_clk))
@@ -2474,8 +2470,7 @@ static int sdhci_msm_remove(struct platform_device *pdev)sdhci_remove_host (host, dead); -if (msm_host->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (msm_host->opp_table);pm_runtime_get_sync (&pdev->dev);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 5/8 spi: spi-geni-qcom: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/spi/spi-geni-qcom.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/spi/spi-geni-qcom.c +3 -7
@@ -613,9 +613,7 @@ static int spi_geni_probe(struct platform_device *pdev)return PTR_ERR (mas->se.opp_table);/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - mas->se.has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"invalid OPP table in device tree\n" );return ret; }
@@ -669,8 +667,7 @@ static int spi_geni_probe(struct platform_device *pdev) spi_geni_probe_runtime_disable:pm_runtime_disable (dev);spi_master_put (spi); -if (mas->se.has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (mas->se.opp_table);return ret; }
@@ -685,8 +682,7 @@ static int spi_geni_remove(struct platform_device *pdev)free_irq (mas->irq, spi);pm_runtime_disable (&pdev->dev); -if (mas->se.has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (mas->se.opp_table);return 0 ; }
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 2/8 drm/lima: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/gpu/drm/lima/lima_devfreq.c | 6 +----- drivers/gpu/drm/lima/lima_devfreq.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/lima/lima_devfreq.c +1 -5
@@ -105,10 +105,7 @@ void lima_devfreq_fini(struct lima_device *ldev) devfreq->devfreq =NULL ; } -if (devfreq->opp_of_table_added) { -dev_pm_opp_of_remove_table (ldev->dev); - devfreq->opp_of_table_added = false; - } +dev_pm_opp_of_remove_table (ldev->dev);if (devfreq->regulators_opp_table) {dev_pm_opp_put_regulators (devfreq->regulators_opp_table);
@@ -162,7 +159,6 @@ int lima_devfreq_init(struct lima_device *ldev) ret =dev_pm_opp_of_add_table (dev);if (ret) goto err_fini; - ldevfreq->opp_of_table_added = true;lima_devfreq_reset (ldevfreq);
drivers/gpu/drm/lima/lima_devfreq.h +0 -1
@@ -18,7 +18,6 @@ struct lima_devfreq {struct opp_table *clkname_opp_table;struct opp_table *regulators_opp_table;struct thermal_cooling_device *cooling; -bool opp_of_table_added;ktime_t busy_time;ktime_t idle_time;
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 7/8 tty: serial: qcom_geni_serial: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/tty/serial/qcom_geni_serial.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/tty/serial/qcom_geni_serial.c +3 -7
@@ -1433,9 +1433,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)return PTR_ERR (port->se.opp_table);/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - port->se.has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"invalid OPP table in device tree\n" );return ret; }
@@ -1478,8 +1476,7 @@ static int qcom_geni_serial_probe(struct platform_device *pdev)return 0 ; err: -if (port->se.has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (port->se.opp_table);return ret; }
@@ -1489,8 +1486,7 @@ 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; -if (port->se.has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +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);
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 8/8 qcom-geni-se: remove has_opp_table
In reply to Viresh Kumarhas_opp_table isn't used anymore, remove it.
--- include/linux/qcom-geni-se.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/qcom-geni-se.h +0 -2
@@ -48,7 +48,6 @@ struct geni_icc_path {* @clk_perf_tbl: Table of clock frequency input to serial engine clock * @icc_paths: Array of ICC paths for SE * @opp_table: Pointer to the OPP table -* @has_opp_table: Specifies if the SE has an OPP table */ struct geni_se {void __iomem *base;
@@ -59,7 +58,6 @@ struct geni_se {unsigned long *clk_perf_tbl;struct geni_icc_path icc_paths[3 ];struct opp_table *opp_table; -bool has_opp_table; };/* Common SE registers */
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Viresh Kumar
maintainerPATCH 1/8 cpufreq: imx6q: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/cpufreq/imx6q-cpufreq.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/cpufreq/imx6q-cpufreq.c +2 -8
@@ -48,7 +48,6 @@ static struct clk_bulk_data clks[] = { };static struct device *cpu_dev; -static bool free_opp;static struct cpufreq_frequency_table *freq_table;static unsigned int max_freq;static unsigned int transition_latency;
@@ -390,9 +389,6 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) goto put_reg; } -/* Because we have added the OPPs here, we must free them */ - free_opp = true; -if (of_machine_is_compatible ("fsl,imx6ul" ) ||of_machine_is_compatible ("fsl,imx6ull" )) { ret =imx6ul_opp_check_speed_grading (cpu_dev);
@@ -507,8 +503,7 @@ static int imx6q_cpufreq_probe(struct platform_device *pdev) free_freq_table:dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table); out_free_opp: -if (free_opp) -dev_pm_opp_of_remove_table (cpu_dev); +dev_pm_opp_of_remove_table (cpu_dev); put_reg:if (!IS_ERR (arm_reg))regulator_put (arm_reg);
@@ -528,8 +523,7 @@ static int imx6q_cpufreq_remove(struct platform_device *pdev) {cpufreq_unregister_driver (&imx6q_cpufreq_driver);dev_pm_opp_free_cpufreq_table (cpu_dev, &freq_table); -if (free_opp) -dev_pm_opp_of_remove_table (cpu_dev); +dev_pm_opp_of_remove_table (cpu_dev);regulator_put (arm_reg);if (!IS_ERR (pu_reg))regulator_put (pu_reg);
Signature · 7 lines
2.25.0.rc1.19.g042ed3e048af _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Viresh Kumar
maintainerPATCH 6/8 spi: spi-qcom-qspi: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh Kumardev_pm_opp_of_remove_table() doesn't report any errors when it fails to find the OPP table with error -ENODEV (i.e. OPP table not present for the device). And we can call dev_pm_opp_of_remove_table() unconditionally here.
--- drivers/spi/spi-qcom-qspi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/spi/spi-qcom-qspi.c +3 -8
@@ -143,7 +143,6 @@ struct qcom_qspi {struct qspi_xfer xfer;struct icc_path *icc_path_cpu_to_qspi;struct opp_table *opp_table; -bool has_opp_table;unsigned long last_speed;/* Lock to protect data accessed by IRQs */ spinlock_t lock;
@@ -546,9 +545,7 @@ static int qcom_qspi_probe(struct platform_device *pdev) }/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - ctrl->has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"invalid OPP table in device tree\n" ); goto exit_probe_master_put; }
@@ -562,8 +559,7 @@ static int qcom_qspi_probe(struct platform_device *pdev)return 0 ;pm_runtime_disable (dev); -if (ctrl->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (ctrl->opp_table); exit_probe_master_put:
@@ -581,8 +577,7 @@ static int qcom_qspi_remove(struct platform_device *pdev)spi_unregister_master (master);pm_runtime_disable (&pdev->dev); -if (ctrl->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (ctrl->opp_table);return 0 ;
Signature · 1 line
2.25.0.rc1.19.g042ed3e048af
Re: [PATCH 2/8] drm/lima: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh KumarLooks good for me, patch is:
Regards,
Qiang
Quoted 51 lines · Viresh Kumar
dev_pm_opp_of_remove_table()doesn't report any errors when it fails to find the OPP table with error-ENODEV(i.e. OPP table not present for the device). And we can calldev_pm_opp_of_remove_table()unconditionally here.Signed-off-by Viresh Kumar <[email protected]>--- drivers/gpu/drm/lima/lima_devfreq.c | 6 +----- drivers/gpu/drm/lima/lima_devfreq.h | 1 - 2 files changed, 1 insertion(+), 6 deletions(-)drivers/gpu/drm/lima/lima_devfreq.c +1
-5@@ -105,10 +105,7 @@ void lima_devfreq_fini(struct lima_device *ldev) devfreq->devfreq =NULL ; } -if (devfreq->opp_of_table_added) { -dev_pm_opp_of_remove_table (ldev->dev); - devfreq->opp_of_table_added = false; - } +dev_pm_opp_of_remove_table (ldev->dev);if (devfreq->regulators_opp_table) {dev_pm_opp_put_regulators (devfreq->regulators_opp_table);@@ -162,7 +159,6 @@ int lima_devfreq_init(struct lima_device *ldev) ret =dev_pm_opp_of_add_table (dev);if (ret) goto err_fini; - ldevfreq->opp_of_table_added = true;lima_devfreq_reset (ldevfreq);drivers/gpu/drm/lima/lima_devfreq.h +0
-2@@ -18,7 +18,6 @@ struct lima_devfreq {struct opp_table *clkname_opp_table;struct opp_table *regulators_opp_table;struct thermal_cooling_device *cooling; -bool opp_of_table_added;ktime_t busy_time;ktime_t idle_time; --2.25.0.rc1.19.g042ed3e048af
Re: [PATCH 4/8] mmc: sdhci-msm: Unconditionally call dev_pm_opp_of_remove_table()
In reply to Viresh KumarQuoted 7 lines · Viresh Kumar
dev_pm_opp_of_remove_table()doesn't report any errors when it fails to find the OPP table with error-ENODEV(i.e. OPP table not present for the device). And we can calldev_pm_opp_of_remove_table()unconditionally here.Signed-off-by Viresh Kumar <[email protected]>
Applied for next, thanks!
Kind regards
Uffe
Quoted 50 lines
--- drivers/mmc/host/sdhci-msm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)drivers/mmc/host/sdhci-msm.c +3
-9@@ -263,7 +263,6 @@ struct sdhci_msm_host {unsigned long clk_rate;struct mmc_host *mmc;struct opp_table *opp_table; -bool has_opp_table;bool use_14lpp_dll_reset;bool tuning_done;bool calibration_done;@@ -2285,9 +2284,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)/* OPP table is optional */ ret =dev_pm_opp_of_add_table (&pdev->dev); -if (!ret) { - msm_host->has_opp_table = true; - }else if (ret != -ENODEV ) { +if (ret != -ENODEV ) {dev_err (&pdev->dev,"Invalid OPP table in Device tree\n" ); goto opp_cleanup; }@@ -2453,8 +2450,7 @@ static int sdhci_msm_probe(struct platform_device *pdev)clk_bulk_disable_unprepare (ARRAY_SIZE (msm_host->bulk_clks), msm_host->bulk_clks); opp_cleanup: -if (msm_host->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (msm_host->opp_table); bus_clk_disable:if (!IS_ERR (msm_host->bus_clk))@@ -2474,8 +2470,7 @@ static int sdhci_msm_remove(struct platform_device *pdev)sdhci_remove_host (host, dead); -if (msm_host->has_opp_table) -dev_pm_opp_of_remove_table (&pdev->dev); +dev_pm_opp_of_remove_table (&pdev->dev);dev_pm_opp_put_clkname (msm_host->opp_table);pm_runtime_get_sync (&pdev->dev);pm_runtime_disable (&pdev->dev); --2.25.0.rc1.19.g042ed3e048af