Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus/i2c' of git://git.fluff.org/bjdooks/linux

* 'for-linus/i2c' of git://git.fluff.org/bjdooks/linux:
i2c: imx: call ioremap only after request_mem_region
i2c: mxc: let time to generate stop bit

+14 -12
+14 -12
drivers/i2c/busses/i2c-imx.c
··· 226 226 temp = readb(i2c_imx->base + IMX_I2C_I2CR); 227 227 temp &= ~(I2CR_MSTA | I2CR_MTX); 228 228 writeb(temp, i2c_imx->base + IMX_I2C_I2CR); 229 - i2c_imx->stopped = 1; 230 229 } 231 230 if (cpu_is_mx1()) { 232 231 /* ··· 235 236 udelay(i2c_imx->disable_delay); 236 237 } 237 238 238 - if (!i2c_imx->stopped) 239 + if (!i2c_imx->stopped) { 239 240 i2c_imx_bus_busy(i2c_imx, 0); 241 + i2c_imx->stopped = 1; 242 + } 240 243 241 244 /* Disable I2C controller */ 242 245 writeb(0, i2c_imx->base + IMX_I2C_I2CR); ··· 497 496 } 498 497 499 498 res_size = resource_size(res); 499 + 500 + if (!request_mem_region(res->start, res_size, DRIVER_NAME)) { 501 + ret = -EBUSY; 502 + goto fail0; 503 + } 504 + 500 505 base = ioremap(res->start, res_size); 501 506 if (!base) { 502 507 dev_err(&pdev->dev, "ioremap failed\n"); 503 508 ret = -EIO; 504 - goto fail0; 509 + goto fail1; 505 510 } 506 511 507 512 i2c_imx = kzalloc(sizeof(struct imx_i2c_struct), GFP_KERNEL); 508 513 if (!i2c_imx) { 509 514 dev_err(&pdev->dev, "can't allocate interface\n"); 510 515 ret = -ENOMEM; 511 - goto fail1; 512 - } 513 - 514 - if (!request_mem_region(res->start, res_size, DRIVER_NAME)) { 515 - ret = -EBUSY; 516 516 goto fail2; 517 517 } 518 518 ··· 584 582 fail4: 585 583 clk_put(i2c_imx->clk); 586 584 fail3: 587 - release_mem_region(i2c_imx->res->start, resource_size(res)); 588 - fail2: 589 585 kfree(i2c_imx); 590 - fail1: 586 + fail2: 591 587 iounmap(base); 588 + fail1: 589 + release_mem_region(res->start, resource_size(res)); 592 590 fail0: 593 591 if (pdata && pdata->exit) 594 592 pdata->exit(&pdev->dev); ··· 620 618 621 619 clk_put(i2c_imx->clk); 622 620 623 - release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); 624 621 iounmap(i2c_imx->base); 622 + release_mem_region(i2c_imx->res->start, resource_size(i2c_imx->res)); 625 623 kfree(i2c_imx); 626 624 return 0; 627 625 }