mirror of https://gitee.com/openkylin/linux.git
usb: mtu3: 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> Link: https://lore.kernel.org/r/1595404275-8449-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
0ed9498f9e
commit
5ad91812ea
|
@ -828,7 +828,6 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb)
|
||||||
struct device *dev = ssusb->dev;
|
struct device *dev = ssusb->dev;
|
||||||
struct platform_device *pdev = to_platform_device(dev);
|
struct platform_device *pdev = to_platform_device(dev);
|
||||||
struct mtu3 *mtu = NULL;
|
struct mtu3 *mtu = NULL;
|
||||||
struct resource *res;
|
|
||||||
int ret = -ENOMEM;
|
int ret = -ENOMEM;
|
||||||
|
|
||||||
mtu = devm_kzalloc(dev, sizeof(struct mtu3), GFP_KERNEL);
|
mtu = devm_kzalloc(dev, sizeof(struct mtu3), GFP_KERNEL);
|
||||||
|
@ -840,8 +839,7 @@ int ssusb_gadget_init(struct ssusb_mtk *ssusb)
|
||||||
return mtu->irq;
|
return mtu->irq;
|
||||||
dev_info(dev, "irq %d\n", mtu->irq);
|
dev_info(dev, "irq %d\n", mtu->irq);
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mac");
|
mtu->mac_base = devm_platform_ioremap_resource_byname(pdev, "mac");
|
||||||
mtu->mac_base = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(mtu->mac_base)) {
|
if (IS_ERR(mtu->mac_base)) {
|
||||||
dev_err(dev, "error mapping memory for dev mac\n");
|
dev_err(dev, "error mapping memory for dev mac\n");
|
||||||
return PTR_ERR(mtu->mac_base);
|
return PTR_ERR(mtu->mac_base);
|
||||||
|
|
|
@ -216,7 +216,6 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
|
||||||
struct device_node *node = pdev->dev.of_node;
|
struct device_node *node = pdev->dev.of_node;
|
||||||
struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
|
struct otg_switch_mtk *otg_sx = &ssusb->otg_switch;
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct resource *res;
|
|
||||||
int i;
|
int i;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -263,8 +262,7 @@ static int get_ssusb_rscs(struct platform_device *pdev, struct ssusb_mtk *ssusb)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "ippc");
|
ssusb->ippc_base = devm_platform_ioremap_resource_byname(pdev, "ippc");
|
||||||
ssusb->ippc_base = devm_ioremap_resource(dev, res);
|
|
||||||
if (IS_ERR(ssusb->ippc_base))
|
if (IS_ERR(ssusb->ippc_base))
|
||||||
return PTR_ERR(ssusb->ippc_base);
|
return PTR_ERR(ssusb->ippc_base);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue