usb: musb: switch over to devm_ioremap_resource()
this will make sure that request_memory_region() will be called and that we don't need to manually call iounmap() on ->remove(). Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
6110a7ebda
commit
b42f7f3091
1 changed files with 4 additions and 13 deletions
|
@ -2008,7 +2008,6 @@ static int musb_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
int irq = platform_get_irq_byname(pdev, "mc");
|
int irq = platform_get_irq_byname(pdev, "mc");
|
||||||
int status;
|
|
||||||
struct resource *iomem;
|
struct resource *iomem;
|
||||||
void __iomem *base;
|
void __iomem *base;
|
||||||
|
|
||||||
|
@ -2016,24 +2015,17 @@ static int musb_probe(struct platform_device *pdev)
|
||||||
if (!iomem || irq <= 0)
|
if (!iomem || irq <= 0)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
base = ioremap(iomem->start, resource_size(iomem));
|
base = devm_ioremap_resource(dev, iomem);
|
||||||
if (!base) {
|
if (IS_ERR(base))
|
||||||
dev_err(dev, "ioremap failed\n");
|
return PTR_ERR(base);
|
||||||
return -ENOMEM;
|
|
||||||
}
|
|
||||||
|
|
||||||
status = musb_init_controller(dev, irq, base);
|
return musb_init_controller(dev, irq, base);
|
||||||
if (status < 0)
|
|
||||||
iounmap(base);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int musb_remove(struct platform_device *pdev)
|
static int musb_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct device *dev = &pdev->dev;
|
struct device *dev = &pdev->dev;
|
||||||
struct musb *musb = dev_to_musb(dev);
|
struct musb *musb = dev_to_musb(dev);
|
||||||
void __iomem *ctrl_base = musb->ctrl_base;
|
|
||||||
|
|
||||||
/* this gets called on rmmod.
|
/* this gets called on rmmod.
|
||||||
* - Host mode: host may still be active
|
* - Host mode: host may still be active
|
||||||
|
@ -2044,7 +2036,6 @@ static int musb_remove(struct platform_device *pdev)
|
||||||
musb_shutdown(pdev);
|
musb_shutdown(pdev);
|
||||||
|
|
||||||
musb_free(musb);
|
musb_free(musb);
|
||||||
iounmap(ctrl_base);
|
|
||||||
device_init_wakeup(dev, 0);
|
device_init_wakeup(dev, 0);
|
||||||
#ifndef CONFIG_MUSB_PIO_ONLY
|
#ifndef CONFIG_MUSB_PIO_ONLY
|
||||||
dma_set_mask(dev, *dev->parent->dma_mask);
|
dma_set_mask(dev, *dev->parent->dma_mask);
|
||||||
|
|
Loading…
Add table
Reference in a new issue