Re: [PATCH V2 2/2] bfin_can: rewrite the driver to support the common

From: Marc Kleine-Budde
Date: Thu Jan 08 2015 - 04:00:39 EST


On 01/08/2015 07:57 AM, Aaron Wu wrote:
> Rewrite the driver to comply to common style with MMU
>
> Signed-off-by: Aaron Wu <Aaron.wu@xxxxxxxxxx>

Can you please rephrase the subject into a more complete English
sentence. You may use something like "convert driver to use
devm_ioremap_resource()"

> ---
> drivers/net/can/bfin_can.c | 21 ++++++++-------------
> 1 file changed, 8 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
> index 0a5eff4..1d116a7 100644
> --- a/drivers/net/can/bfin_can.c
> +++ b/drivers/net/can/bfin_can.c
> @@ -551,16 +551,10 @@ static int bfin_can_probe(struct platform_device *pdev)
> goto exit;
> }
>
> - if (!request_mem_region(res_mem->start, resource_size(res_mem),
> - dev_name(&pdev->dev))) {
> - err = -EBUSY;
> - goto exit;
> - }
> -
> /* request peripheral pins */
> err = peripheral_request_list(pdata, dev_name(&pdev->dev));
> if (err)
> - goto exit_mem_release;
> + goto exit;
>
> dev = alloc_bfin_candev();
> if (!dev) {
> @@ -569,7 +563,13 @@ static int bfin_can_probe(struct platform_device *pdev)
> }
>
> priv = netdev_priv(dev);
> - priv->membase = (void __iomem *)res_mem->start;
> +
> + priv->membase = devm_ioremap_resource(&pdev->dev, res_mem);
> + if (IS_ERR((void *)priv->membase)) {
Is this cast needed?
> + dev_err(&pdev->dev, "Cannot map IO\n");
> + return PTR_ERR((void *)priv->membase);
Is this cast needed?
> + }
> +
> priv->rx_irq = rx_irq->start;
> priv->tx_irq = tx_irq->start;
> priv->err_irq = err_irq->start;
> @@ -601,8 +601,6 @@ exit_candev_free:
> free_candev(dev);
> exit_peri_pin_free:
> peripheral_free_list(pdata);
> -exit_mem_release:
> - release_mem_region(res_mem->start, resource_size(res_mem));
> exit:
> return err;
> }
> @@ -617,9 +615,6 @@ static int bfin_can_remove(struct platform_device *pdev)
>
> 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);
>
> free_candev(dev);
>

Marc

--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |

Attachment: signature.asc
Description: OpenPGP digital signature