Commit 29d1fd2f authored by Swapnil Jakhade's avatar Swapnil Jakhade Committed by Vinod Koul

phy: cadence-torrent: Use of_device_get_match_data() to get driver data

Use of_device_get_match_data() to get driver data instead of boilerplate
code.
Signed-off-by: default avatarSwapnil Jakhade <sjakhade@cadence.com>
Link: https://lore.kernel.org/r/1600280911-9214-2-git-send-email-sjakhade@cadence.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 885c4f4d
...@@ -183,8 +183,6 @@ static const struct reg_field phy_pma_pll_raw_ctrl = ...@@ -183,8 +183,6 @@ static const struct reg_field phy_pma_pll_raw_ctrl =
static const struct reg_field phy_reset_ctrl = static const struct reg_field phy_reset_ctrl =
REG_FIELD(PHY_RESET, 8, 8); REG_FIELD(PHY_RESET, 8, 8);
static const struct of_device_id cdns_torrent_phy_of_match[];
struct cdns_torrent_inst { struct cdns_torrent_inst {
struct phy *phy; struct phy *phy;
u32 mlane; u32 mlane;
...@@ -203,6 +201,7 @@ struct cdns_torrent_phy { ...@@ -203,6 +201,7 @@ struct cdns_torrent_phy {
unsigned long ref_clk_rate; unsigned long ref_clk_rate;
struct cdns_torrent_inst phys[MAX_NUM_LANES]; struct cdns_torrent_inst phys[MAX_NUM_LANES];
int nsubnodes; int nsubnodes;
const struct cdns_torrent_data *init_data;
struct regmap *regmap; struct regmap *regmap;
struct regmap *regmap_common_cdb; struct regmap *regmap_common_cdb;
struct regmap *regmap_phy_pcs_common_cdb; struct regmap *regmap_phy_pcs_common_cdb;
...@@ -1710,24 +1709,22 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev) ...@@ -1710,24 +1709,22 @@ static int cdns_torrent_phy_probe(struct platform_device *pdev)
struct cdns_torrent_phy *cdns_phy; struct cdns_torrent_phy *cdns_phy;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
const struct of_device_id *match; const struct cdns_torrent_data *data;
struct cdns_torrent_data *data;
struct device_node *child; struct device_node *child;
int ret, subnodes, node = 0, i; int ret, subnodes, node = 0, i;
/* Get init data for this PHY */ /* Get init data for this PHY */
match = of_match_device(cdns_torrent_phy_of_match, dev); data = of_device_get_match_data(dev);
if (!match) if (!data)
return -EINVAL; return -EINVAL;
data = (struct cdns_torrent_data *)match->data;
cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL); cdns_phy = devm_kzalloc(dev, sizeof(*cdns_phy), GFP_KERNEL);
if (!cdns_phy) if (!cdns_phy)
return -ENOMEM; return -ENOMEM;
dev_set_drvdata(dev, cdns_phy); dev_set_drvdata(dev, cdns_phy);
cdns_phy->dev = dev; cdns_phy->dev = dev;
cdns_phy->init_data = data;
cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0); cdns_phy->phy_rst = devm_reset_control_get_exclusive_by_index(dev, 0);
if (IS_ERR(cdns_phy->phy_rst)) { if (IS_ERR(cdns_phy->phy_rst)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment