bfin_can: introduce ioremap to comply to archs with MMU

Blackfin was built without MMU, old driver code access the IO space by
physical address, introduce the ioremap approach to be compitable with
the common style supporting MMU enabled arch.

Signed-off-by: Aaron Wu <Aaron.wu@analog.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Aaron Wu 2015-02-10 17:40:35 +08:00 committed by Marc Kleine-Budde
parent e4936e01d0
commit dead83894c
1 changed files with 8 additions and 14 deletions

View File

@ -552,16 +552,10 @@ static int bfin_can_probe(struct platform_device *pdev)
goto exit; goto exit;
} }
if (!request_mem_region(res_mem->start, resource_size(res_mem),
dev_name(&pdev->dev))) {
err = -EBUSY;
goto exit;
}
/* request peripheral pins */ /* request peripheral pins */
err = peripheral_request_list(pdata, dev_name(&pdev->dev)); err = peripheral_request_list(pdata, dev_name(&pdev->dev));
if (err) if (err)
goto exit_mem_release; goto exit;
dev = alloc_bfin_candev(); dev = alloc_bfin_candev();
if (!dev) { if (!dev) {
@ -570,7 +564,13 @@ static int bfin_can_probe(struct platform_device *pdev)
} }
priv = netdev_priv(dev); priv = netdev_priv(dev);
priv->membase = (void __iomem *)res_mem->start;
priv->membase = devm_ioremap_resource(&pdev->dev, res_mem);
if (IS_ERR(priv->membase)) {
err = PTR_ERR(priv->membase);
goto exit_peri_pin_free;
}
priv->rx_irq = rx_irq->start; priv->rx_irq = rx_irq->start;
priv->tx_irq = tx_irq->start; priv->tx_irq = tx_irq->start;
priv->err_irq = err_irq->start; priv->err_irq = err_irq->start;
@ -602,8 +602,6 @@ exit_candev_free:
free_candev(dev); free_candev(dev);
exit_peri_pin_free: exit_peri_pin_free:
peripheral_free_list(pdata); peripheral_free_list(pdata);
exit_mem_release:
release_mem_region(res_mem->start, resource_size(res_mem));
exit: exit:
return err; return err;
} }
@ -612,15 +610,11 @@ static int bfin_can_remove(struct platform_device *pdev)
{ {
struct net_device *dev = platform_get_drvdata(pdev); struct net_device *dev = platform_get_drvdata(pdev);
struct bfin_can_priv *priv = netdev_priv(dev); struct bfin_can_priv *priv = netdev_priv(dev);
struct resource *res;
bfin_can_set_reset_mode(dev); bfin_can_set_reset_mode(dev);
unregister_candev(dev); unregister_candev(dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
release_mem_region(res->start, resource_size(res));
peripheral_free_list(priv->pin_list); peripheral_free_list(priv->pin_list);
free_candev(dev); free_candev(dev);