diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 14:12:04 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-03-23 14:12:04 -0700 |
commit | fc2bb8d1cde1296d210a0f1ff9ee979a447d0a34 (patch) | |
tree | 725696adebdc70e1b4e0ce8537da25eb5f2bf564 /drivers/i2c/busses/i2c-s3c2410.c | |
parent | 475c77edf826333aa61625f49d6a2bec26ecb5a6 (diff) | |
parent | bbceeee82ef55c11db0161f4078edd79290e3bcf (diff) |
Merge branch 'i2c-embedded/for-3.4' of git://git.pengutronix.de/git/wsa/linux
Pull i2c embedded updates from Wolfram Sang:
"Nothing special from i2c-embedded for this merge window. Two new
drivers, minor feature additions, bugfixes, cleanups.
All patches have been in linux-next for some time, too."
* 'i2c-embedded/for-3.4' of git://git.pengutronix.de/git/wsa/linux:
i2c-eg20t: Remove write-only variables
i2c-eg20t: Rework pch_i2c_wait_for_bus_idle to reduce wait time
i2c-s3c2410: Add stub runtime power management
i2c-s3c2410: Convert to devm_kzalloc()
i2c: add CSR SiRFprimaII on-chip I2C controllers driver
i2c: tegra: Remove unnecessary write to INT_STATUS
i2c: imx: fix imx driver to work though signal is pending
i2c: designware: dw_i2c_init_driver as subsys initcall
misc: at24: describe platform_data with kernel_doc
i2c: Move I2C_EG20T option to the right place.
i2c: Support for Netlogic XLR/XLS I2C controller.
i2c: mpc: Add support for SMBUS_READ_BLOCK_DATA
i2c: versatile: Add Device Tree support
Diffstat (limited to 'drivers/i2c/busses/i2c-s3c2410.c')
-rw-r--r-- | drivers/i2c/busses/i2c-s3c2410.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c index 4c171808168..737f7218a32 100644 --- a/drivers/i2c/busses/i2c-s3c2410.c +++ b/drivers/i2c/busses/i2c-s3c2410.c @@ -31,6 +31,7 @@ #include <linux/errno.h> #include <linux/err.h> #include <linux/platform_device.h> +#include <linux/pm_runtime.h> #include <linux/clk.h> #include <linux/cpufreq.h> #include <linux/slab.h> @@ -564,6 +565,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, int retry; int ret; + pm_runtime_get_sync(&adap->dev); clk_enable(i2c->clk); for (retry = 0; retry < adap->retries; retry++) { @@ -572,6 +574,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, if (ret != -EAGAIN) { clk_disable(i2c->clk); + pm_runtime_put_sync(&adap->dev); return ret; } @@ -581,6 +584,7 @@ static int s3c24xx_i2c_xfer(struct i2c_adapter *adap, } clk_disable(i2c->clk); + pm_runtime_put_sync(&adap->dev); return -EREMOTEIO; } @@ -890,7 +894,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) } } - i2c = kzalloc(sizeof(struct s3c24xx_i2c), GFP_KERNEL); + i2c = devm_kzalloc(&pdev->dev, sizeof(struct s3c24xx_i2c), GFP_KERNEL); if (!i2c) { dev_err(&pdev->dev, "no memory for state\n"); return -ENOMEM; @@ -1013,6 +1017,9 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) of_i2c_register_devices(&i2c->adap); platform_set_drvdata(pdev, i2c); + pm_runtime_enable(&pdev->dev); + pm_runtime_enable(&i2c->adap.dev); + dev_info(&pdev->dev, "%s: S3C I2C adapter\n", dev_name(&i2c->adap.dev)); clk_disable(i2c->clk); return 0; @@ -1035,7 +1042,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev) clk_put(i2c->clk); err_noclk: - kfree(i2c); return ret; } @@ -1048,6 +1054,9 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) { struct s3c24xx_i2c *i2c = platform_get_drvdata(pdev); + pm_runtime_disable(&i2c->adap.dev); + pm_runtime_disable(&pdev->dev); + s3c24xx_i2c_deregister_cpufreq(i2c); i2c_del_adapter(&i2c->adap); @@ -1061,7 +1070,6 @@ static int s3c24xx_i2c_remove(struct platform_device *pdev) release_resource(i2c->ioarea); s3c24xx_i2c_dt_gpio_free(i2c); kfree(i2c->ioarea); - kfree(i2c); return 0; } |