linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kishon Vijay Abraham I <kishon@ti.com>
To: <gregkh@linuxfoundation.org>
Cc: <kishon@ti.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 18/20] phy: core: Fixup return value of phy_exit when !pm_runtime_enabled
Date: Fri, 13 Mar 2015 17:31:55 +0530	[thread overview]
Message-ID: <1426248117-14312-19-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1426248117-14312-1-git-send-email-kishon@ti.com>

From: Axel Lin <axel.lin@ingics.com>

When phy_pm_runtime_get_sync() returns -ENOTSUPP, phy_exit() also returns
-ENOTSUPP if !phy->ops->exit. Fix it.
Also move the code to override ret close to the code we got ret.
I think it is less error prone this way.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
 drivers/phy/phy-core.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 04fc84f..3791838 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -225,6 +225,7 @@ int phy_init(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 0 && phy->ops->init) {
@@ -233,8 +234,6 @@ int phy_init(struct phy *phy)
 			dev_err(&phy->dev, "phy init failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->init_count;
 
@@ -255,6 +254,7 @@ int phy_exit(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->init_count == 1 && phy->ops->exit) {
@@ -289,6 +289,7 @@ int phy_power_on(struct phy *phy)
 	ret = phy_pm_runtime_get_sync(phy);
 	if (ret < 0 && ret != -ENOTSUPP)
 		return ret;
+	ret = 0; /* Override possible ret == -ENOTSUPP */
 
 	mutex_lock(&phy->mutex);
 	if (phy->power_count == 0 && phy->ops->power_on) {
@@ -297,8 +298,6 @@ int phy_power_on(struct phy *phy)
 			dev_err(&phy->dev, "phy poweron failed --> %d\n", ret);
 			goto out;
 		}
-	} else {
-		ret = 0; /* Override possible ret == -ENOTSUPP */
 	}
 	++phy->power_count;
 	mutex_unlock(&phy->mutex);
-- 
1.7.9.5


  parent reply	other threads:[~2015-03-13 12:02 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-13 12:01 [GIT PULL 00/20] phy: for 4.0 -rc cycle Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 01/20] phy: miphy28lp: Avoid calling of_get_child_count() multiple times Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 02/20] phy: miphy365x: " Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 03/20] phy: armada375-usb2: Set drvdata for phy and use it Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 04/20] phy: xgene: Remove duplicate code to set ctx->dev Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 05/20] phy: miphy28lp: Add missing .owner field in miphy28lp_ops Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 06/20] phy: exynos-mipi-video: Fixup the test for state->regmap Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 07/20] phy: exynos-mipi-video: Use spin_lock to protct state->regmap rmw operations Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 08/20] phy: exynos-dp-video: Kill exynos_dp_video_phy_pwr_isol function Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 09/20] phy: hix5hd2-sata: Check return value of platform_get_resource Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 10/20] phy: samsung-usb2: Remove NULL terminating entry from phys array Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 11/20] phy: ti-pipe3: Simplify ti_pipe3_dpll_wait_lock implementation Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 12/20] phy: rockchip-usb: Fixup rockchip_usb_phy_power_on failure path Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 13/20] phy: Find the right match in devm_phy_destroy() Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 14/20] phy: exynos5-usbdrd: Fix off-by-one valid value checking for args->args[0] Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 15/20] phy: twl4030-usb: Remove redundant assignment for twl->linkstat Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 16/20] phy: miphy365x: Convert to devm_kcalloc and fix wrong sizeof Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 17/20] phy: miphy28lp: Convert to devm_kcalloc and fix wrong sizof Kishon Vijay Abraham I
2015-03-13 12:01 ` Kishon Vijay Abraham I [this message]
2015-03-13 12:01 ` [PATCH 19/20] phy: ti/omap: Fix modalias Kishon Vijay Abraham I
2015-03-13 12:01 ` [PATCH 20/20] phy: omap-usb2: Fix missing clk_prepare call when using old dt name Kishon Vijay Abraham I
2015-03-14  8:50 ` [GIT PULL 00/20] phy: for 4.0 -rc cycle Greg KH
2015-03-14 11:23   ` Kishon Vijay Abraham I
2015-03-14 11:31   ` [RESEND GIT PULL] " Kishon Vijay Abraham I
2015-03-18 16:28     ` Greg KH

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=1426248117-14312-19-git-send-email-kishon@ti.com \
    --to=kishon@ti.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.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).