From: Kishon Vijay Abraham I <kishon@ti.com>
To: <gregkh@linuxfoundation.org>
Cc: <kishon@ti.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH 08/20] phy: berlin-usb: Set drvdata for phy and use it
Date: Fri, 3 Apr 2015 21:56:36 +0530 [thread overview]
Message-ID: <1428078408-13344-9-git-send-email-kishon@ti.com> (raw)
In-Reply-To: <1428078408-13344-1-git-send-email-kishon@ti.com>
From: Axel Lin <axel.lin@ingics.com>
At the context where we have pointer to struct phy, it's useful to call
phy_get_drvdata() to get the address of priv. With this change, we can
remove the to_phy_berlin_usb_priv() macro and remove *phy from struct
phy_berlin_usb_priv.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
---
drivers/phy/phy-berlin-usb.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/phy-berlin-usb.c b/drivers/phy/phy-berlin-usb.c
index 9f7cc7e..c6fc95b 100644
--- a/drivers/phy/phy-berlin-usb.c
+++ b/drivers/phy/phy-berlin-usb.c
@@ -103,9 +103,6 @@
#define MODE_TEST_EN BIT(11)
#define ANA_TEST_DC_CTRL(x) ((x) << 12)
-#define to_phy_berlin_usb_priv(p) \
- container_of((p), struct phy_berlin_usb_priv, phy)
-
static const u32 phy_berlin_pll_dividers[] = {
/* Berlin 2 */
CLK_REF_DIV(0xc) | FEEDBACK_CLK_DIV(0x54),
@@ -115,14 +112,13 @@ static const u32 phy_berlin_pll_dividers[] = {
struct phy_berlin_usb_priv {
void __iomem *base;
- struct phy *phy;
struct reset_control *rst_ctrl;
u32 pll_divider;
};
static int phy_berlin_usb_power_on(struct phy *phy)
{
- struct phy_berlin_usb_priv *priv = dev_get_drvdata(phy->dev.parent);
+ struct phy_berlin_usb_priv *priv = phy_get_drvdata(phy);
reset_control_reset(priv->rst_ctrl);
@@ -175,6 +171,7 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
of_match_device(phy_berlin_sata_of_match, &pdev->dev);
struct phy_berlin_usb_priv *priv;
struct resource *res;
+ struct phy *phy;
struct phy_provider *phy_provider;
priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
@@ -192,13 +189,14 @@ static int phy_berlin_usb_probe(struct platform_device *pdev)
priv->pll_divider = *((u32 *)match->data);
- priv->phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
- if (IS_ERR(priv->phy)) {
+ phy = devm_phy_create(&pdev->dev, NULL, &phy_berlin_usb_ops);
+ if (IS_ERR(phy)) {
dev_err(&pdev->dev, "failed to create PHY\n");
- return PTR_ERR(priv->phy);
+ return PTR_ERR(phy);
}
platform_set_drvdata(pdev, priv);
+ phy_set_drvdata(phy, priv);
phy_provider =
devm_of_phy_provider_register(&pdev->dev, of_phy_simple_xlate);
--
1.7.9.5
next prev parent reply other threads:[~2015-04-03 16:30 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-03 16:26 [GIT PULL 00/20] phy: for 4.1 merge window Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 01/20] phy: berlin-usb: Use PTR_ERR_OR_ZERO Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 02/20] phy: xgene: " Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 03/20] phy: berlin-sata: Use devm_kcalloc at appropriate place Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 04/20] phy: miphy28lp: Use PTR_ERR_OR_ZERO Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 05/20] phy: omap-control: Remove unneeded ifdef CONFIG_OF guard and of_match_ptr Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 06/20] phy: omap-usb2: " Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 07/20] phy: ti-pipe3: " Kishon Vijay Abraham I
2015-04-03 16:26 ` Kishon Vijay Abraham I [this message]
2015-04-03 16:26 ` [PATCH 09/20] phy: stih41x-usb: Fixup stih41x_usb_phy_power_on failure path Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 10/20] phy: qcom-ufs: Catch devm_phy_create failure in ufs_qcom_phy_generic_probe Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 11/20] phy: exynos5-usbdrd: Add to support for Exynos5433 SoC Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 12/20] phy: samsung_usb2: Fixup samsung_usb2_phy_power_on/off paths Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 13/20] phy: qcom-ufs: Fix build error due to missing export symbols Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 14/20] phy: qcom-ufs: Don't return error if fail to get optional resource Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 15/20] phy: Add a driver for dm816x USB PHY Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 16/20] phy: Add driver to support individual USB PHYs on sun9i Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 17/20] phy: miphy365x: Use the generic phy type constants in dt-bindings/phy/phy.h Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 18/20] phy: spear1310-miphy: Return proper error for spear1310_miphy_xlate Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 19/20] phy: spear1340-miphy: Return proper error for spear1340_miphy_xlate Kishon Vijay Abraham I
2015-04-03 16:26 ` [PATCH 20/20] MAINTAINERS: Add phy-miphy28lp.c and phy-miphy365x.c to ARCH/STI architecture Kishon Vijay Abraham I
2015-04-08 5:50 ` [GIT PULL 00/20] phy: for 4.1 merge window Kishon Vijay Abraham I
2015-04-10 11:50 ` 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=1428078408-13344-9-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