Commit 449d2c75 authored by Julia Lawall's avatar Julia Lawall Committed by Jean Delvare

i2c-pnx: Correct use of request_region/request_mem_region

request_mem_region should be used when ioremap is used subsequently.
release_region is then correspondingly replaced by release_mem_region.

The semantic patch that fixes this problem is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@r@
expression start,E;
@@

- request_region
+ request_mem_region
  (start,...)
... when != request_mem_region(start,...)
    when != start = E
ioremap(start,...)

@@
expression r.start;
@@

- release_region
+ release_mem_region
  (start,...)
// </smpl>
Signed-off-by: default avatarJulia Lawall <julia@diku.dk>
Cc: Vitaly Wool <vitalywool@gmail.com>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent a1867d36
...@@ -586,7 +586,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev) ...@@ -586,7 +586,8 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
alg_data->mif.timer.data = (unsigned long)i2c_pnx->adapter; alg_data->mif.timer.data = (unsigned long)i2c_pnx->adapter;
/* Register I/O resource */ /* Register I/O resource */
if (!request_region(alg_data->base, I2C_PNX_REGION_SIZE, pdev->name)) { if (!request_mem_region(alg_data->base, I2C_PNX_REGION_SIZE,
pdev->name)) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"I/O region 0x%08x for I2C already in use.\n", "I/O region 0x%08x for I2C already in use.\n",
alg_data->base); alg_data->base);
...@@ -650,7 +651,7 @@ out_clock: ...@@ -650,7 +651,7 @@ out_clock:
out_unmap: out_unmap:
iounmap((void *)alg_data->ioaddr); iounmap((void *)alg_data->ioaddr);
out_release: out_release:
release_region(alg_data->base, I2C_PNX_REGION_SIZE); release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
out_drvdata: out_drvdata:
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
out: out:
...@@ -667,7 +668,7 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev) ...@@ -667,7 +668,7 @@ static int __devexit i2c_pnx_remove(struct platform_device *pdev)
i2c_del_adapter(adap); i2c_del_adapter(adap);
i2c_pnx->set_clock_stop(pdev); i2c_pnx->set_clock_stop(pdev);
iounmap((void *)alg_data->ioaddr); iounmap((void *)alg_data->ioaddr);
release_region(alg_data->base, I2C_PNX_REGION_SIZE); release_mem_region(alg_data->base, I2C_PNX_REGION_SIZE);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment