phy: broadcom: convert to devm_platform_ioremap_resource(_byname)
Use devm_platform_ioremap_resource(_byname) to simplify code Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Cc: Al Cooper <alcooperx@gmail.com> Link: https://lore.kernel.org/r/1604642930-29019-3-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Vinod Koul <vkoul@kernel.org>
This commit is contained in:
Родитель
202de02556
Коммит
f669bc8b9f
|
@ -126,7 +126,6 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev)
|
|||
struct device_node *node = dev->of_node, *child;
|
||||
struct cygnus_pcie_phy_core *core;
|
||||
struct phy_provider *provider;
|
||||
struct resource *res;
|
||||
unsigned cnt = 0;
|
||||
int ret;
|
||||
|
||||
|
@ -141,8 +140,7 @@ static int cygnus_pcie_phy_probe(struct platform_device *pdev)
|
|||
|
||||
core->dev = dev;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
core->base = devm_ioremap_resource(dev, res);
|
||||
core->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(core->base))
|
||||
return PTR_ERR(core->base);
|
||||
|
||||
|
|
|
@ -94,7 +94,6 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev)
|
|||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct bcm_kona_usb *phy;
|
||||
struct resource *res;
|
||||
struct phy *gphy;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
|
@ -102,8 +101,7 @@ static int bcm_kona_usb2_probe(struct platform_device *pdev)
|
|||
if (!phy)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
phy->regs = devm_ioremap_resource(&pdev->dev, res);
|
||||
phy->regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(phy->regs))
|
||||
return PTR_ERR(phy->regs);
|
||||
|
||||
|
|
|
@ -83,7 +83,6 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
|
|||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct bcm_ns_usb2 *usb2;
|
||||
struct resource *res;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
usb2 = devm_kzalloc(&pdev->dev, sizeof(*usb2), GFP_KERNEL);
|
||||
|
@ -91,8 +90,7 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
usb2->dev = dev;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmu");
|
||||
usb2->dmu = devm_ioremap_resource(dev, res);
|
||||
usb2->dmu = devm_platform_ioremap_resource_byname(pdev, "dmu");
|
||||
if (IS_ERR(usb2->dmu)) {
|
||||
dev_err(dev, "Failed to map DMU regs\n");
|
||||
return PTR_ERR(usb2->dmu);
|
||||
|
|
|
@ -305,7 +305,6 @@ static int bcm_ns_usb3_probe(struct platform_device *pdev)
|
|||
struct device *dev = &pdev->dev;
|
||||
const struct of_device_id *of_id;
|
||||
struct bcm_ns_usb3 *usb3;
|
||||
struct resource *res;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
usb3 = devm_kzalloc(dev, sizeof(*usb3), GFP_KERNEL);
|
||||
|
@ -319,15 +318,13 @@ static int bcm_ns_usb3_probe(struct platform_device *pdev)
|
|||
return -EINVAL;
|
||||
usb3->family = (enum bcm_ns_family)of_id->data;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dmp");
|
||||
usb3->dmp = devm_ioremap_resource(dev, res);
|
||||
usb3->dmp = devm_platform_ioremap_resource_byname(pdev, "dmp");
|
||||
if (IS_ERR(usb3->dmp)) {
|
||||
dev_err(dev, "Failed to map DMP regs\n");
|
||||
return PTR_ERR(usb3->dmp);
|
||||
}
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ccb-mii");
|
||||
usb3->ccb_mii = devm_ioremap_resource(dev, res);
|
||||
usb3->ccb_mii = devm_platform_ioremap_resource_byname(pdev, "ccb-mii");
|
||||
if (IS_ERR(usb3->ccb_mii)) {
|
||||
dev_err(dev, "Failed to map ChipCommon B MII regs\n");
|
||||
return PTR_ERR(usb3->ccb_mii);
|
||||
|
|
|
@ -293,7 +293,6 @@ static int ns2_drd_phy_probe(struct platform_device *pdev)
|
|||
struct device *dev = &pdev->dev;
|
||||
struct ns2_phy_driver *driver;
|
||||
struct ns2_phy_data *data;
|
||||
struct resource *res;
|
||||
int ret;
|
||||
u32 val;
|
||||
|
||||
|
@ -307,23 +306,19 @@ static int ns2_drd_phy_probe(struct platform_device *pdev)
|
|||
if (!driver->data)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "icfg");
|
||||
driver->icfgdrd_regs = devm_ioremap_resource(dev, res);
|
||||
driver->icfgdrd_regs = devm_platform_ioremap_resource_byname(pdev, "icfg");
|
||||
if (IS_ERR(driver->icfgdrd_regs))
|
||||
return PTR_ERR(driver->icfgdrd_regs);
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "rst-ctrl");
|
||||
driver->idmdrd_rst_ctrl = devm_ioremap_resource(dev, res);
|
||||
driver->idmdrd_rst_ctrl = devm_platform_ioremap_resource_byname(pdev, "rst-ctrl");
|
||||
if (IS_ERR(driver->idmdrd_rst_ctrl))
|
||||
return PTR_ERR(driver->idmdrd_rst_ctrl);
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "crmu-ctrl");
|
||||
driver->crmu_usb2_ctrl = devm_ioremap_resource(dev, res);
|
||||
driver->crmu_usb2_ctrl = devm_platform_ioremap_resource_byname(pdev, "crmu-ctrl");
|
||||
if (IS_ERR(driver->crmu_usb2_ctrl))
|
||||
return PTR_ERR(driver->crmu_usb2_ctrl);
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "usb2-strap");
|
||||
driver->usb2h_strap_reg = devm_ioremap_resource(dev, res);
|
||||
driver->usb2h_strap_reg = devm_platform_ioremap_resource_byname(pdev, "usb2-strap");
|
||||
if (IS_ERR(driver->usb2h_strap_reg))
|
||||
return PTR_ERR(driver->usb2h_strap_reg);
|
||||
|
||||
|
|
|
@ -217,7 +217,6 @@ static int sr_pcie_phy_probe(struct platform_device *pdev)
|
|||
struct device *dev = &pdev->dev;
|
||||
struct device_node *node = dev->of_node;
|
||||
struct sr_pcie_phy_core *core;
|
||||
struct resource *res;
|
||||
struct phy_provider *provider;
|
||||
unsigned int phy_idx = 0;
|
||||
|
||||
|
@ -226,9 +225,7 @@ static int sr_pcie_phy_probe(struct platform_device *pdev)
|
|||
return -ENOMEM;
|
||||
|
||||
core->dev = dev;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
core->base = devm_ioremap_resource(core->dev, res);
|
||||
core->base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(core->base))
|
||||
return PTR_ERR(core->base);
|
||||
|
||||
|
|
|
@ -300,14 +300,12 @@ static int bcm_usb_phy_probe(struct platform_device *pdev)
|
|||
struct device *dev = &pdev->dev;
|
||||
struct device_node *dn = dev->of_node;
|
||||
const struct of_device_id *of_id;
|
||||
struct resource *res;
|
||||
void __iomem *regs;
|
||||
int ret;
|
||||
enum bcm_usb_phy_version version;
|
||||
struct phy_provider *phy_provider;
|
||||
|
||||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
|
||||
regs = devm_ioremap_resource(dev, res);
|
||||
regs = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(regs))
|
||||
return PTR_ERR(regs);
|
||||
|
||||
|
|
|
@ -726,7 +726,6 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
|
|||
struct device_node *dn = dev->of_node, *child;
|
||||
const struct of_device_id *of_id;
|
||||
struct brcm_sata_phy *priv;
|
||||
struct resource *res;
|
||||
struct phy_provider *provider;
|
||||
int ret, count = 0;
|
||||
|
||||
|
@ -739,8 +738,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
|
|||
dev_set_drvdata(dev, priv);
|
||||
priv->dev = dev;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "phy");
|
||||
priv->phy_base = devm_ioremap_resource(dev, res);
|
||||
priv->phy_base = devm_platform_ioremap_resource_byname(pdev, "phy");
|
||||
if (IS_ERR(priv->phy_base))
|
||||
return PTR_ERR(priv->phy_base);
|
||||
|
||||
|
@ -751,9 +749,7 @@ static int brcm_sata_phy_probe(struct platform_device *pdev)
|
|||
priv->version = BRCM_SATA_PHY_STB_28NM;
|
||||
|
||||
if (priv->version == BRCM_SATA_PHY_IPROC_NS2) {
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
"phy-ctrl");
|
||||
priv->ctrl_base = devm_ioremap_resource(dev, res);
|
||||
priv->ctrl_base = devm_platform_ioremap_resource_byname(pdev, "phy-ctrl");
|
||||
if (IS_ERR(priv->ctrl_base))
|
||||
return PTR_ERR(priv->ctrl_base);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче