net: ethernet: bgmac: Use devm_platform_ioremap_resource_byname
Use the devm_platform_ioremap_resource_byname() helper instead of calling platform_get_resource_byname() and devm_ioremap_resource() separately. Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Родитель
b5d64b43f8
Коммит
3710e80952
|
@ -172,7 +172,6 @@ static int bgmac_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device_node *np = pdev->dev.of_node;
|
struct device_node *np = pdev->dev.of_node;
|
||||||
struct bgmac *bgmac;
|
struct bgmac *bgmac;
|
||||||
struct resource *regs;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
bgmac = bgmac_alloc(&pdev->dev);
|
bgmac = bgmac_alloc(&pdev->dev);
|
||||||
|
@ -206,21 +205,15 @@ static int bgmac_probe(struct platform_device *pdev)
|
||||||
if (IS_ERR(bgmac->plat.base))
|
if (IS_ERR(bgmac->plat.base))
|
||||||
return PTR_ERR(bgmac->plat.base);
|
return PTR_ERR(bgmac->plat.base);
|
||||||
|
|
||||||
regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "idm_base");
|
bgmac->plat.idm_base = devm_platform_ioremap_resource_byname(pdev, "idm_base");
|
||||||
if (regs) {
|
if (IS_ERR(bgmac->plat.idm_base))
|
||||||
bgmac->plat.idm_base = devm_ioremap_resource(&pdev->dev, regs);
|
return PTR_ERR(bgmac->plat.idm_base);
|
||||||
if (IS_ERR(bgmac->plat.idm_base))
|
else
|
||||||
return PTR_ERR(bgmac->plat.idm_base);
|
|
||||||
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
|
bgmac->feature_flags &= ~BGMAC_FEAT_IDM_MASK;
|
||||||
}
|
|
||||||
|
|
||||||
regs = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nicpm_base");
|
bgmac->plat.nicpm_base = devm_platform_ioremap_resource_byname(pdev, "nicpm_base");
|
||||||
if (regs) {
|
if (IS_ERR(bgmac->plat.nicpm_base))
|
||||||
bgmac->plat.nicpm_base = devm_ioremap_resource(&pdev->dev,
|
return PTR_ERR(bgmac->plat.nicpm_base);
|
||||||
regs);
|
|
||||||
if (IS_ERR(bgmac->plat.nicpm_base))
|
|
||||||
return PTR_ERR(bgmac->plat.nicpm_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
bgmac->read = platform_bgmac_read;
|
bgmac->read = platform_bgmac_read;
|
||||||
bgmac->write = platform_bgmac_write;
|
bgmac->write = platform_bgmac_write;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче