diff options
author | Alexander Shiyan <shc_work@mail.ru> | 2013-12-14 17:03:12 +0400 |
---|---|---|
committer | Lee Jones <lee.jones@linaro.org> | 2014-01-21 08:28:10 +0000 |
commit | db9ef449aaa550389008c2020fba02e4440ce24b (patch) | |
tree | af101d60af6701be60d1d7659248f509b99fa222 /drivers/mfd/mc13xxx-i2c.c | |
parent | e5a3da2143962edff6c8a66dec43654c2951804f (diff) | |
download | blackbird-op-linux-db9ef449aaa550389008c2020fba02e4440ce24b.tar.gz blackbird-op-linux-db9ef449aaa550389008c2020fba02e4440ce24b.zip |
mfd: mc13xxx: Simplify probe() & remove()
This patch simplifies probe() and remove() functions by moving
some initialisation code out from the I2C/SPI init() and exit()
functions and into the core driver.
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Diffstat (limited to 'drivers/mfd/mc13xxx-i2c.c')
-rw-r--r-- | drivers/mfd/mc13xxx-i2c.c | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c index 898bd335cd8e..ae3addb153a2 100644 --- a/drivers/mfd/mc13xxx-i2c.c +++ b/drivers/mfd/mc13xxx-i2c.c @@ -10,7 +10,6 @@ #include <linux/slab.h> #include <linux/module.h> #include <linux/platform_device.h> -#include <linux/mutex.h> #include <linux/mfd/core.h> #include <linux/mfd/mc13xxx.h> #include <linux/of.h> @@ -60,7 +59,6 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { struct mc13xxx *mc13xxx; - struct mc13xxx_platform_data *pdata = dev_get_platdata(&client->dev); int ret; mc13xxx = devm_kzalloc(&client->dev, sizeof(*mc13xxx), GFP_KERNEL); @@ -69,15 +67,13 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, dev_set_drvdata(&client->dev, mc13xxx); - mc13xxx->dev = &client->dev; - mutex_init(&mc13xxx->lock); + mc13xxx->irq = client->irq; mc13xxx->regmap = devm_regmap_init_i2c(client, &mc13xxx_regmap_i2c_config); if (IS_ERR(mc13xxx->regmap)) { ret = PTR_ERR(mc13xxx->regmap); - dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", - ret); + dev_err(&client->dev, "Failed to initialize regmap: %d\n", ret); return ret; } @@ -89,18 +85,12 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, mc13xxx->variant = (void *)id->driver_data; } - ret = mc13xxx_common_init(mc13xxx, pdata, client->irq); - - return ret; + return mc13xxx_common_init(&client->dev); } static int mc13xxx_i2c_remove(struct i2c_client *client) { - struct mc13xxx *mc13xxx = dev_get_drvdata(&client->dev); - - mc13xxx_common_cleanup(mc13xxx); - - return 0; + return mc13xxx_common_exit(&client->dev); } static struct i2c_driver mc13xxx_i2c_driver = { |