Commit c3c11d55 authored by Swapnil Jakhade's avatar Swapnil Jakhade Committed by Vinod Koul

phy: cadence: Sierra: 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>
Reviewed-by: default avatarAswath Govindraju <a-govindraju@ti.com>
Link: https://lore.kernel.org/r/20211223060137.9252-2-sjakhade@cadence.comSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 399c91c3
...@@ -253,7 +253,7 @@ struct cdns_regmap_cdb_context { ...@@ -253,7 +253,7 @@ struct cdns_regmap_cdb_context {
struct cdns_sierra_phy { struct cdns_sierra_phy {
struct device *dev; struct device *dev;
struct regmap *regmap; struct regmap *regmap;
struct cdns_sierra_data *init_data; const struct cdns_sierra_data *init_data;
struct cdns_sierra_inst phys[SIERRA_MAX_LANES]; struct cdns_sierra_inst phys[SIERRA_MAX_LANES];
struct reset_control *phy_rst; struct reset_control *phy_rst;
struct reset_control *apb_rst; struct reset_control *apb_rst;
...@@ -595,8 +595,6 @@ static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst, ...@@ -595,8 +595,6 @@ static int cdns_sierra_get_optional(struct cdns_sierra_inst *inst,
return 0; return 0;
} }
static const struct of_device_id cdns_sierra_id_table[];
static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base, static struct regmap *cdns_regmap_init(struct device *dev, void __iomem *base,
u32 block_offset, u8 reg_offset_shift, u32 block_offset, u8 reg_offset_shift,
const struct regmap_config *config) const struct regmap_config *config)
...@@ -829,8 +827,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -829,8 +827,7 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
struct cdns_sierra_phy *sp; struct cdns_sierra_phy *sp;
struct phy_provider *phy_provider; struct phy_provider *phy_provider;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
const struct of_device_id *match; const struct cdns_sierra_data *data;
struct cdns_sierra_data *data;
unsigned int id_value; unsigned int id_value;
int i, ret, node = 0; int i, ret, node = 0;
void __iomem *base; void __iomem *base;
...@@ -840,12 +837,10 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev) ...@@ -840,12 +837,10 @@ static int cdns_sierra_phy_probe(struct platform_device *pdev)
return -ENODEV; return -ENODEV;
/* Get init data for this PHY */ /* Get init data for this PHY */
match = of_match_device(cdns_sierra_id_table, dev); data = of_device_get_match_data(dev);
if (!match) if (!data)
return -EINVAL; return -EINVAL;
data = (struct cdns_sierra_data *)match->data;
sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL); sp = devm_kzalloc(dev, sizeof(*sp), GFP_KERNEL);
if (!sp) if (!sp)
return -ENOMEM; return -ENOMEM;
......
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