diff mbox series

[v2,2/3] phy: core: Drop unused runtime PM APIs

Message ID 1513778960-10073-3-git-send-email-ulf.hansson@linaro.org
State New
Headers show
Series phy: core: Re-work runtime PM deployment and fix an issue | expand

Commit Message

Ulf Hansson Dec. 20, 2017, 2:09 p.m. UTC
The phy core already deploys runtime PM support, so there seems to be no
obvious reason for having dedicated APIs to control runtime PM for phys.

Therefore, let's remove the APIs altogether and instead convert internal
needed functions to be static.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

---
 drivers/phy/phy-core.c  | 50 +++----------------------------------------------
 include/linux/phy/phy.h | 45 --------------------------------------------
 2 files changed, 3 insertions(+), 92 deletions(-)

-- 
2.7.4

Comments

Ulf Hansson Dec. 21, 2017, 10:57 a.m. UTC | #1
On 21 December 2017 at 11:33, Yoshihiro Shimoda
<yoshihiro.shimoda.uh@renesas.com> wrote:
> Hi Ulf-san,

>

>> -----Original Message-----

>> From: Ulf Hansson, Sent: Wednesday, December 20, 2017 11:09 PM

> <snip>

>> diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h

>> index b4298a1..050b620 100644

>> --- a/include/linux/phy/phy.h

>> +++ b/include/linux/phy/phy.h

>> @@ -17,7 +17,6 @@

>>  #include <linux/err.h>

>>  #include <linux/of.h>

>>  #include <linux/device.h>

>> -#include <linux/pm_runtime.h>

>

> After I applied this patch, some ata and gpu drivers causes build error [1].

> So, we should fix the drivers at first...


Huh, right, those drivers shouldn't be relying on the phy.h to include
pm_runtime.h.

The easiest way at this point is to just put back "#include
<linux/pm_runtime.h>" in phy.h, then we can deal with these problems
separately. I do that in a re-spin soon.

BTW, I would be great if you could test this on the Renesas SoC to
make sure it still fixes the problems (at least half of them I mean).

Thanks and kind regards
Uffe

>

> Best regards,

> Yoshihiro Shimoda

> ---

> [1]

> drivers/ata/ahci_qoriq.c: In function 'ahci_qoriq_resume':

> drivers/ata/ahci_qoriq.c:318:2: error: implicit declaration of function 'pm_runtime_disable' [-Werror=implicit-function-declaration]

>   pm_runtime_disable(dev);

>   ^

> drivers/ata/ahci_qoriq.c:319:2: error: implicit declaration of function 'pm_runtime_set_active' [-Werror=implicit-function-declaration]

>   pm_runtime_set_active(dev);

>   ^

> drivers/ata/ahci_qoriq.c:320:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]

>   pm_runtime_enable(dev);

>   ^

> drivers/ata/ahci.c: In function 'ahci_init_one':

> drivers/ata/ahci.c:1761:2: error: implicit declaration of function 'pm_runtime_put_noidle' [-Werror=implicit-function-declaration]

>   pm_runtime_put_noidle(&pdev->dev);

>   ^

> drivers/ata/ahci.c: In function 'ahci_remove_one':

> drivers/ata/ahci.c:1767:2: error: implicit declaration of function 'pm_runtime_get_noresume' [-Werror=implicit-function-declaration]

>   pm_runtime_get_noresume(&pdev->dev);

>   ^

> drivers/ata/libahci.c: In function 'ahci_rpm_get_port':

> drivers/ata/libahci.c:239:9: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]

>   return pm_runtime_get_sync(ap->dev);

>          ^

> drivers/ata/libahci.c: In function 'ahci_rpm_put_port':

> drivers/ata/libahci.c:251:2: error: implicit declaration of function 'pm_runtime_put' [-Werror=implicit-function-declaration]

>   pm_runtime_put(ap->dev);

>   ^

> drivers/ata/ahci_ceva.c: In function 'ceva_ahci_resume':

> drivers/ata/ahci_ceva.c:326:2: error: implicit declaration of function 'pm_runtime_disable' [-Werror=implicit-function-declaration]

>   pm_runtime_disable(dev);

>   ^

> drivers/ata/ahci_ceva.c:327:2: error: implicit declaration of function 'pm_runtime_set_active' [-Werror=implicit-function-declaration]

>   pm_runtime_set_active(dev);

>   ^

> drivers/ata/ahci_ceva.c:328:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]

>   pm_runtime_enable(dev);

>   ^

> cc1: some warnings being treated as errors

> make[2]: *** [drivers/ata/ahci_qoriq.o] Error 1

> make[2]: *** Waiting for unfinished jobs....

> cc1: some warnings being treated as errors

> make[2]: *** [drivers/ata/ahci_ceva.o] Error 1

> cc1: some warnings being treated as errors

> make[2]: *** [drivers/ata/ahci.o] Error 1

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c: In function 'analogix_dp_get_modes':

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:949:3: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]

>    pm_runtime_get_sync(dp->dev);

>    ^

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:951:3: error: implicit declaration of function 'pm_runtime_put' [-Werror=implicit-function-declaration]

>    pm_runtime_put(dp->dev);

>    ^

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c: In function 'analogix_dp_bridge_disable':

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1120:2: error: implicit declaration of function 'pm_runtime_put_sync' [-Werror=implicit-function-declaration]

>   pm_runtime_put_sync(dp->dev);

>   ^

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c: In function 'analogix_dp_bind':

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1387:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]

>   pm_runtime_enable(dev);

>   ^

> drivers/gpu/drm/bridge/analogix/analogix_dp_core.c:1431:2: error: implicit declaration of function 'pm_runtime_disable' [-Werror=implicit-function-declaration]

>   pm_runtime_disable(dev);

>   ^

> drivers/gpu/drm/exynos/exynos_drm_dsi.c: In function 'exynos_dsi_enable':

> drivers/gpu/drm/exynos/exynos_drm_dsi.c:1385:2: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]

>   pm_runtime_get_sync(dsi->dev);

>   ^

> drivers/gpu/drm/exynos/exynos_drm_dsi.c:1392:3: error: implicit declaration of function 'pm_runtime_put_sync' [-Werror=implicit-function-declaration]

>    pm_runtime_put_sync(dsi->dev);

>    ^

> drivers/gpu/drm/exynos/exynos_drm_dsi.c: In function 'exynos_dsi_probe':

> drivers/gpu/drm/exynos/exynos_drm_dsi.c:1797:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]

>   pm_runtime_enable(dev);

>   ^

> drivers/gpu/drm/exynos/exynos_drm_dsi.c: In function 'exynos_dsi_remove':

> drivers/gpu/drm/exynos/exynos_drm_dsi.c:1808:2: error: implicit declaration of function 'pm_runtime_disable' [-Werror=implicit-function-declaration]

>   pm_runtime_disable(&pdev->dev);

>   ^

> drivers/gpu/drm/rockchip/cdn-dp-core.c: In function 'cdn_dp_clk_enable':

> drivers/gpu/drm/rockchip/cdn-dp-core.c:111:8: error: implicit declaration of function 'pm_runtime_get_sync' [-Werror=implicit-function-declaration]

>   ret = pm_runtime_get_sync(dp->dev);

>         ^

> drivers/gpu/drm/rockchip/cdn-dp-core.c:137:2: error: implicit declaration of function 'pm_runtime_put' [-Werror=implicit-function-declaration]

>   pm_runtime_put(dp->dev);

>   ^

> drivers/gpu/drm/rockchip/cdn-dp-core.c: In function 'cdn_dp_clk_disable':

> drivers/gpu/drm/rockchip/cdn-dp-core.c:148:2: error: implicit declaration of function 'pm_runtime_put_sync' [-Werror=implicit-function-declaration]

>   pm_runtime_put_sync(dp->dev);

>   ^

> drivers/gpu/drm/rockchip/cdn-dp-core.c: In function 'cdn_dp_bind':

> drivers/gpu/drm/rockchip/cdn-dp-core.c:1094:2: error: implicit declaration of function 'pm_runtime_enable' [-Werror=implicit-function-declaration]

>   pm_runtime_enable(dev);

>   ^

> drivers/gpu/drm/rockchip/cdn-dp-core.c: In function 'cdn_dp_unbind':

> drivers/gpu/drm/rockchip/cdn-dp-core.c:1118:2: error: implicit declaration of function 'pm_runtime_disable' [-Werror=implicit-function-declaration]

>   pm_runtime_disable(dev);

>   ^

> cc1: some warnings being treated as errors

> make[2]: *** [drivers/ata/libahci.o] Error 1

> make[1]: *** [drivers/ata] Error 2

> make[1]: *** Waiting for unfinished jobs....

> cc1: some warnings being treated as errors

> make[5]: *** [drivers/gpu/drm/bridge/analogix/analogix_dp_core.o] Error 1

> make[4]: *** [drivers/gpu/drm/bridge/analogix] Error 2

> make[3]: *** [drivers/gpu/drm/bridge] Error 2

> make[3]: *** Waiting for unfinished jobs....

> cc1: some warnings being treated as errors

> make[4]: *** [drivers/gpu/drm/exynos/exynos_drm_dsi.o] Error 1

> make[3]: *** [drivers/gpu/drm/exynos] Error 2

> cc1: some warnings being treated as errors

> make[4]: *** [drivers/gpu/drm/rockchip/cdn-dp-core.o] Error 1

> make[3]: *** [drivers/gpu/drm/rockchip] Error 2

> make[2]: *** [drivers/gpu/drm] Error 2

> make[1]: *** [drivers/gpu] Error 2

> make: *** [drivers] Error 2

>
kernel test robot Dec. 23, 2017, 10:08 a.m. UTC | #2
Hi Ulf,

I love your patch! Yet something to improve:

[auto build test ERROR on phy/next]
[also build test ERROR on v4.15-rc4 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ulf-Hansson/phy-core-Re-work-runtime-PM-deployment-and-fix-an-issue/20171223-170432
base:   https://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy.git next
config: x86_64-acpi-redef (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   drivers//ata/libahci.c: In function 'ahci_rpm_get_port':
>> drivers//ata/libahci.c:239:9: error: implicit declaration of function 'pm_runtime_get_sync'; did you mean 'ktime_get_ns'? [-Werror=implicit-function-declaration]

     return pm_runtime_get_sync(ap->dev);
            ^~~~~~~~~~~~~~~~~~~
            ktime_get_ns
   drivers//ata/libahci.c: In function 'ahci_rpm_put_port':
>> drivers//ata/libahci.c:251:2: error: implicit declaration of function 'pm_runtime_put'; did you mean 'of_node_put'? [-Werror=implicit-function-declaration]

     pm_runtime_put(ap->dev);
     ^~~~~~~~~~~~~~
     of_node_put
   cc1: some warnings being treated as errors

vim +251 drivers//ata/libahci.c

365cfa1e Anton Vorontsov 2010-03-28  228  
bb03c640 Mika Westerberg 2016-02-18  229  /**
bb03c640 Mika Westerberg 2016-02-18  230   *	ahci_rpm_get_port - Make sure the port is powered on
bb03c640 Mika Westerberg 2016-02-18  231   *	@ap: Port to power on
bb03c640 Mika Westerberg 2016-02-18  232   *
bb03c640 Mika Westerberg 2016-02-18  233   *	Whenever there is need to access the AHCI host registers outside of
bb03c640 Mika Westerberg 2016-02-18  234   *	normal execution paths, call this function to make sure the host is
bb03c640 Mika Westerberg 2016-02-18  235   *	actually powered on.
bb03c640 Mika Westerberg 2016-02-18  236   */
bb03c640 Mika Westerberg 2016-02-18  237  static int ahci_rpm_get_port(struct ata_port *ap)
bb03c640 Mika Westerberg 2016-02-18  238  {
bb03c640 Mika Westerberg 2016-02-18 @239  	return pm_runtime_get_sync(ap->dev);
bb03c640 Mika Westerberg 2016-02-18  240  }
bb03c640 Mika Westerberg 2016-02-18  241  
bb03c640 Mika Westerberg 2016-02-18  242  /**
bb03c640 Mika Westerberg 2016-02-18  243   *	ahci_rpm_put_port - Undoes ahci_rpm_get_port()
bb03c640 Mika Westerberg 2016-02-18  244   *	@ap: Port to power down
bb03c640 Mika Westerberg 2016-02-18  245   *
bb03c640 Mika Westerberg 2016-02-18  246   *	Undoes ahci_rpm_get_port() and possibly powers down the AHCI host
bb03c640 Mika Westerberg 2016-02-18  247   *	if it has no more active users.
bb03c640 Mika Westerberg 2016-02-18  248   */
bb03c640 Mika Westerberg 2016-02-18  249  static void ahci_rpm_put_port(struct ata_port *ap)
bb03c640 Mika Westerberg 2016-02-18  250  {
bb03c640 Mika Westerberg 2016-02-18 @251  	pm_runtime_put(ap->dev);
bb03c640 Mika Westerberg 2016-02-18  252  }
bb03c640 Mika Westerberg 2016-02-18  253  

:::::: The code at line 251 was first introduced by commit
:::::: bb03c640697155639b2e15e2aaa4c10f60bf0d5e ahci: Add functions to manage runtime PM of AHCI ports

:::::: TO: Mika Westerberg <mika.westerberg@linux.intel.com>
:::::: CC: Tejun Heo <tj@kernel.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox series

Patch

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 09588ec..1621625 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -149,22 +149,7 @@  static struct phy_provider *of_phy_provider_lookup(struct device_node *node)
 	return ERR_PTR(-EPROBE_DEFER);
 }
 
-int phy_pm_runtime_get(struct phy *phy)
-{
-	int ret;
-
-	if (!phy->use_runtime_pm)
-		return -ENOTSUPP;
-
-	ret = pm_runtime_get(phy->dev.parent);
-	if (ret < 0 && ret != -EINPROGRESS)
-		pm_runtime_put_noidle(phy->dev.parent);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(phy_pm_runtime_get);
-
-int phy_pm_runtime_get_sync(struct phy *phy)
+static int phy_pm_runtime_get_sync(struct phy *phy)
 {
 	int ret;
 
@@ -177,43 +162,14 @@  int phy_pm_runtime_get_sync(struct phy *phy)
 
 	return ret;
 }
-EXPORT_SYMBOL_GPL(phy_pm_runtime_get_sync);
 
-int phy_pm_runtime_put(struct phy *phy)
+static int phy_pm_runtime_put(struct phy *phy)
 {
 	if (!phy->use_runtime_pm)
 		return -ENOTSUPP;
 
 	return pm_runtime_put(phy->dev.parent);
 }
-EXPORT_SYMBOL_GPL(phy_pm_runtime_put);
-
-int phy_pm_runtime_put_sync(struct phy *phy)
-{
-	if (!phy->use_runtime_pm)
-		return -ENOTSUPP;
-
-	return pm_runtime_put_sync(phy->dev.parent);
-}
-EXPORT_SYMBOL_GPL(phy_pm_runtime_put_sync);
-
-void phy_pm_runtime_allow(struct phy *phy)
-{
-	if (!phy->use_runtime_pm)
-		return;
-
-	pm_runtime_allow(phy->dev.parent);
-}
-EXPORT_SYMBOL_GPL(phy_pm_runtime_allow);
-
-void phy_pm_runtime_forbid(struct phy *phy)
-{
-	if (!phy->use_runtime_pm)
-		return;
-
-	pm_runtime_forbid(phy->dev.parent);
-}
-EXPORT_SYMBOL_GPL(phy_pm_runtime_forbid);
 
 int phy_init(struct phy *phy)
 {
@@ -306,7 +262,7 @@  int phy_power_on(struct phy *phy)
 
 err_pwr_on:
 	mutex_unlock(&phy->mutex);
-	phy_pm_runtime_put_sync(phy);
+	phy_pm_runtime_put(phy);
 err_pm_sync:
 	if (phy->pwr)
 		regulator_disable(phy->pwr);
diff --git a/include/linux/phy/phy.h b/include/linux/phy/phy.h
index b4298a1..050b620 100644
--- a/include/linux/phy/phy.h
+++ b/include/linux/phy/phy.h
@@ -17,7 +17,6 @@ 
 #include <linux/err.h>
 #include <linux/of.h>
 #include <linux/device.h>
-#include <linux/pm_runtime.h>
 #include <linux/regulator/consumer.h>
 
 struct phy;
@@ -134,12 +133,6 @@  static inline void *phy_get_drvdata(struct phy *phy)
 }
 
 #if IS_ENABLED(CONFIG_GENERIC_PHY)
-int phy_pm_runtime_get(struct phy *phy);
-int phy_pm_runtime_get_sync(struct phy *phy);
-int phy_pm_runtime_put(struct phy *phy);
-int phy_pm_runtime_put_sync(struct phy *phy);
-void phy_pm_runtime_allow(struct phy *phy);
-void phy_pm_runtime_forbid(struct phy *phy);
 int phy_init(struct phy *phy);
 int phy_exit(struct phy *phy);
 int phy_power_on(struct phy *phy);
@@ -188,44 +181,6 @@  void devm_of_phy_provider_unregister(struct device *dev,
 int phy_create_lookup(struct phy *phy, const char *con_id, const char *dev_id);
 void phy_remove_lookup(struct phy *phy, const char *con_id, const char *dev_id);
 #else
-static inline int phy_pm_runtime_get(struct phy *phy)
-{
-	if (!phy)
-		return 0;
-	return -ENOSYS;
-}
-
-static inline int phy_pm_runtime_get_sync(struct phy *phy)
-{
-	if (!phy)
-		return 0;
-	return -ENOSYS;
-}
-
-static inline int phy_pm_runtime_put(struct phy *phy)
-{
-	if (!phy)
-		return 0;
-	return -ENOSYS;
-}
-
-static inline int phy_pm_runtime_put_sync(struct phy *phy)
-{
-	if (!phy)
-		return 0;
-	return -ENOSYS;
-}
-
-static inline void phy_pm_runtime_allow(struct phy *phy)
-{
-	return;
-}
-
-static inline void phy_pm_runtime_forbid(struct phy *phy)
-{
-	return;
-}
-
 static inline int phy_init(struct phy *phy)
 {
 	if (!phy)