pinctrl: mediatek: 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: Wang Xiaojun <wangxiaojun11@huawei.com> Acked-by: Sean Wang <sean.wang@kernel.org> Link: https://lore.kernel.org/r/20200917064151.2184010-1-wangxiaojun11@huawei.com Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
98a40a34e0
commit
48548c7865
|
@ -589,7 +589,6 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
|
|||
const struct mtk_pin_soc *soc)
|
||||
{
|
||||
struct pinctrl_pin_desc *pins;
|
||||
struct resource *res;
|
||||
struct mtk_pinctrl *hw;
|
||||
int err, i;
|
||||
|
||||
|
@ -612,14 +611,8 @@ int mtk_moore_pinctrl_probe(struct platform_device *pdev,
|
|||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < hw->soc->nbase_names; i++) {
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
hw->base[i] = devm_platform_ioremap_resource_byname(pdev,
|
||||
hw->soc->base_names[i]);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "missing IO resource\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
hw->base[i] = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(hw->base[i]))
|
||||
return PTR_ERR(hw->base[i]);
|
||||
}
|
||||
|
|
|
@ -354,7 +354,6 @@ static const struct mtk_eint_xt mtk_eint_xt = {
|
|||
int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
|
||||
{
|
||||
struct device_node *np = pdev->dev.of_node;
|
||||
struct resource *res;
|
||||
|
||||
if (!IS_ENABLED(CONFIG_EINT_MTK))
|
||||
return 0;
|
||||
|
@ -366,13 +365,7 @@ int mtk_build_eint(struct mtk_pinctrl *hw, struct platform_device *pdev)
|
|||
if (!hw->eint)
|
||||
return -ENOMEM;
|
||||
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "eint");
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "Unable to get eint resource\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
hw->eint->base = devm_ioremap_resource(&pdev->dev, res);
|
||||
hw->eint->base = devm_platform_ioremap_resource_byname(pdev, "eint");
|
||||
if (IS_ERR(hw->eint->base))
|
||||
return PTR_ERR(hw->eint->base);
|
||||
|
||||
|
|
|
@ -940,7 +940,6 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
|
|||
{
|
||||
struct pinctrl_pin_desc *pins;
|
||||
struct mtk_pinctrl *hw;
|
||||
struct resource *res;
|
||||
int err, i;
|
||||
|
||||
hw = devm_kzalloc(&pdev->dev, sizeof(*hw), GFP_KERNEL);
|
||||
|
@ -963,14 +962,8 @@ int mtk_paris_pinctrl_probe(struct platform_device *pdev,
|
|||
return -ENOMEM;
|
||||
|
||||
for (i = 0; i < hw->soc->nbase_names; i++) {
|
||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
|
||||
hw->base[i] = devm_platform_ioremap_resource_byname(pdev,
|
||||
hw->soc->base_names[i]);
|
||||
if (!res) {
|
||||
dev_err(&pdev->dev, "missing IO resource\n");
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
hw->base[i] = devm_ioremap_resource(&pdev->dev, res);
|
||||
if (IS_ERR(hw->base[i]))
|
||||
return PTR_ERR(hw->base[i]);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue