From: Kishon Vijay Abraham I <kishon@ti.com>
To: <gregkh@linuxfoundation.org>
Cc: <kishon@ti.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 07/14] phy: core: Check requested PHY status in _of_phy_get()
Date: Tue, 2 Jun 2015 20:13:38 +0530 [thread overview]
Message-ID: <1433256225-476-8-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1433256225-476-1-git-send-email-kishon@ti.com>
From: Axel Lin <axel.lin@ingics.com>
This is a common checking in various drivers, so move the checking to
_of_phy_get().
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-core.c | 12 ++++++++++--
drivers/phy/phy-miphy28lp.c | 5 -----
drivers/phy/phy-miphy365x.c | 5 -----
drivers/phy/phy-rcar-gen2.c | 5 -----
4 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 5f729bb..7d535db 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -367,13 +367,21 @@ static struct phy *_of_phy_get(struct device_node *np, int index)
phy_provider = of_phy_provider_lookup(args.np);
if (IS_ERR(phy_provider) || !try_module_get(phy_provider->owner)) {
phy = ERR_PTR(-EPROBE_DEFER);
- goto err0;
+ goto out_unlock;
+ }
+
+ if (!of_device_is_available(args.np)) {
+ dev_warn(phy_provider->dev, "Requested PHY is disabled\n");
+ phy = ERR_PTR(-ENODEV);
+ goto out_put_module;
}
phy = phy_provider->of_xlate(phy_provider->dev, &args);
+
+out_put_module:
module_put(phy_provider->owner);
-err0:
+out_unlock:
mutex_unlock(&phy_provider_mutex);
of_node_put(args.np);
diff --git a/drivers/phy/phy-miphy28lp.c b/drivers/phy/phy-miphy28lp.c
index 58d5339..5e257ef 100644
--- a/drivers/phy/phy-miphy28lp.c
+++ b/drivers/phy/phy-miphy28lp.c
@@ -1107,11 +1107,6 @@ static struct phy *miphy28lp_xlate(struct device *dev,
struct device_node *phynode = args->np;
int ret, index = 0;
- if (!of_device_is_available(phynode)) {
- dev_warn(dev, "Requested PHY is disabled\n");
- return ERR_PTR(-ENODEV);
- }
-
if (args->args_count != 1) {
dev_err(dev, "Invalid number of cells in 'phy' property\n");
return ERR_PTR(-EINVAL);
diff --git a/drivers/phy/phy-miphy365x.c b/drivers/phy/phy-miphy365x.c
index ba6993d..0ff354d 100644
--- a/drivers/phy/phy-miphy365x.c
+++ b/drivers/phy/phy-miphy365x.c
@@ -476,11 +476,6 @@ static struct phy *miphy365x_xlate(struct device *dev,
struct device_node *phynode = args->np;
int ret, index;
- if (!of_device_is_available(phynode)) {
- dev_warn(dev, "Requested PHY is disabled\n");
- return ERR_PTR(-ENODEV);
- }
-
if (args->args_count != 1) {
dev_err(dev, "Invalid number of cells in 'phy' property\n");
return ERR_PTR(-EINVAL);
diff --git a/drivers/phy/phy-rcar-gen2.c b/drivers/phy/phy-rcar-gen2.c
index 778276a..f47bfd8 100644
--- a/drivers/phy/phy-rcar-gen2.c
+++ b/drivers/phy/phy-rcar-gen2.c
@@ -206,11 +206,6 @@ static struct phy *rcar_gen2_phy_xlate(struct device *dev,
struct device_node *np = args->np;
int i;
- if (!of_device_is_available(np)) {
- dev_warn(dev, "Requested PHY is disabled\n");
- return ERR_PTR(-ENODEV);
- }
-
drv = dev_get_drvdata(dev);
if (!drv)
return ERR_PTR(-EINVAL);
--
1.7.9.5
next prev parent reply other threads:[~2015-06-02 14:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-02 14:43 [GIT PULL] phy: for v4.2 merge window Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 01/14] phy: core: Add devm_of_phy_get_by_index to phy-core Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 02/14] usb: ehci-platform: Use devm_of_phy_get_by_index Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 03/14] usb: ohci-platform: " Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 04/14] phy: phy-core: allow specifying supply at port level Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 05/14] phy: miphy28lp: fix sparse warnings Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 06/14] phy: miphy365x: " Kishon Vijay Abraham I
2015-06-02 14:43 ` Kishon Vijay Abraham I [this message]
2015-06-02 14:43 ` [PATCH 08/14] phy: rcar-gen2: Add support for R-Car E2 Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 09/14] Documentation: devicetree: add Broadcom SATA PHY binding Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 10/14] phy: add Broadcom SATA3 PHY driver for Broadcom STB SoCs Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 11/14] phy: twl4030-usb: make runtime pm more reliable Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 12/14] phy: twl4030-usb: remove pointless 'suspended' test in 'suspend' callback Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 13/14] phy: twl4030-usb: remove incorrect pm_runtime_get_sync() in probe function Kishon Vijay Abraham I
2015-06-02 14:43 ` [PATCH 14/14] phy: twl4030-usb: add ABI documentation Kishon Vijay Abraham I
2015-06-03 5:14 ` [GIT PULL] phy: for v4.2 merge window Greg KH
2015-06-03 5:32 ` Kishon Vijay Abraham I
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=1433256225-476-8-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
all inboxes | Powered by JetHome®