From: Swapnil Jakhade <sjakhade@cadence.com>
To: <vkoul@kernel.org>, <kishon@ti.com>, <robh+dt@kernel.org>,
<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>
Cc: <mparab@cadence.com>, <sjakhade@cadence.com>,
<yamonkar@cadence.com>, <tomi.valkeinen@ti.com>, <jsarha@ti.com>,
<nsekhar@ti.com>
Subject: [PATCH v3 1/7] phy: cadence-torrent: Use of_device_get_match_data() to get driver data
Date: Wed, 16 Sep 2020 20:28:25 +0200 [thread overview]
Message-ID: <1600280911-9214-2-git-send-email-sjakhade@cadence.com> (raw)
In-Reply-To: <1600280911-9214-1-git-send-email-sjakhade@cadence.com>
Use of_device_get_match_data() to get driver data instead of boilerplate
code.
Signed-off-by: Swapnil Jakhade <sjakhade@cadence.com>
---
drivers/phy/cadence/phy-cadence-torrent.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/phy/cadence/phy-cadence-torrent.c b/drivers/phy/cadence/phy-cadence-torrent.c
index a065fc17de65..0211083a4d09 100644
--- a/drivers/phy/cadence/phy-cadence-torrent.c
+++ b/drivers/phy/cadence/phy-cadence-torrent.c
@@ -183,8 +183,6 @@ static const struct reg_field phy_pma_pll_raw_ctrl =
static const struct reg_field phy_reset_ctrl =
REG_FIELD(PHY_RESET, 8, 8);
-static const struct of_device_id cdns_torrent_phy_of_match[];
-
struct cdns_torrent_inst {
struct phy *phy;
u32 mlane;
@@ -203,6 +201,7 @@ struct cdns_torrent_phy {
unsigned long ref_clk_rate;
struct cdns_torrent_inst phys[MAX_NUM_LANES];
int nsubnodes;
+ const struct cdns_torrent_data *init_data;
struct regmap *regmap;
struct regmap *regmap_common_cdb;
struct regmap *regmap_phy_pcs_common_cdb;
@@ -1710,24 +1709,22 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev)
struct cdns_torrent_phy *cdns_phy;
struct device *dev = &pdev->dev;
struct phy_provider *phy_provider;
- const struct of_device_id *match;
- struct cdns_torrent_data *data;
+ const struct cdns_torrent_data *data;
struct device_node *child;
int ret, subnodes, node = 0, i;
/* Get init data for this PHY */
- match = of_match_device(cdns_torrent_phy_of_match, dev);
- if (!match)
+ data = of_device_get_match_data(dev);
+ if (!data)
return -EINVAL;
- data = (struct cdns_torrent_data *)match->data;
-
cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL);
if (!cdns_phy)
return -ENOMEM;
dev_set_drvdata(dev, cdns_phy);
cdns_phy->dev = dev;
+ cdns_phy->init_data = data;
cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0);
if (IS_ERR(cdns_phy->phy_rst)) {
--
2.26.1
next prev parent reply other threads:[~2020-09-16 18:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 18:28 [PATCH v3 0/7] PHY: Prepare Cadence Torrent PHY driver to support multilink configurations Swapnil Jakhade
2020-09-16 18:28 ` Swapnil Jakhade [this message]
2020-09-16 18:28 ` [PATCH v3 2/7] phy: cadence-torrent: Use devm_platform_ioremap_resource() to get reg addresses Swapnil Jakhade
2020-09-16 18:28 ` [PATCH v3 3/7] phy: cadence-torrent: Enable support for multiple subnodes Swapnil Jakhade
2020-09-16 18:28 ` [PATCH v3 4/7] phy: cadence-torrent: Add separate regmap functions for torrent and DP Swapnil Jakhade
2020-09-16 18:28 ` [PATCH v3 5/7] phy: cadence-torrent: Check total lane count for all subnodes is within limit Swapnil Jakhade
2020-09-16 18:28 ` [PATCH v3 6/7] dt-bindings: phy: cadence-torrent: Add binding to specify SSC mode Swapnil Jakhade
2020-09-16 18:28 ` [PATCH v3 7/7] dt-bindings: phy: cadence-torrent: Update Torrent PHY bindings for generic use Swapnil Jakhade
2020-09-18 5:06 ` [PATCH v3 0/7] PHY: Prepare Cadence Torrent PHY driver to support multilink configurations Vinod Koul
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=1600280911-9214-2-git-send-email-sjakhade@cadence.com \
--to=sjakhade@cadence.com \
--cc=devicetree@vger.kernel.org \
--cc=jsarha@ti.com \
--cc=kishon@ti.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mparab@cadence.com \
--cc=nsekhar@ti.com \
--cc=robh+dt@kernel.org \
--cc=tomi.valkeinen@ti.com \
--cc=vkoul@kernel.org \
--cc=yamonkar@cadence.com \
/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).