From db9ef449aaa550389008c2020fba02e4440ce24b Mon Sep 17 00:00:00 2001 From: Alexander Shiyan Date: Sat, 14 Dec 2013 17:03:12 +0400 Subject: 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 Signed-off-by: Lee Jones --- drivers/mfd/mc13xxx-i2c.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'drivers/mfd/mc13xxx-i2c.c') diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c index 898bd335cd8..ae3addb153a 100644 --- a/drivers/mfd/mc13xxx-i2c.c +++ b/drivers/mfd/mc13xxx-i2c.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -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 = { -- cgit v1.2.3-70-g09d2