mfd: mc13xxx-i2c: Convert to devm_regmap_init_i2c()
PATCH 1/2 mfd: mc13xxx-i2c: Convert to devm_regmap_init_i2c()
From: Fabio Estevam <[email protected]>
Current code misses a "regmap_exit(mc13xxx->regmap)" in the error and remove paths.
Converting to devm_regmap_init_i2c() makes the regmap_exit unnecessary.
--- drivers/mfd/mc13xxx-i2c.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/mc13xxx-i2c.c +1 -1
@@ -72,7 +72,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, mc13xxx->dev = &client->dev;mutex_init (&mc13xxx->lock); - mc13xxx->regmap =regmap_init_i2c (client, &mc13xxx_regmap_i2c_config); + 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",
Signature · 1 line
1.7.1
PATCH 2/2 mfd: mc13xxx-spi: Convert to devm_regmap_init_spi()
From: Fabio Estevam <[email protected]>
Current code misses a "regmap_exit(mc13xxx->regmap)" in the error and remove paths.
Converting to devm_regmap_init_i2c() makes the regmap_exit unnecessary.
--- drivers/mfd/mc13xxx-spi.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/mfd/mc13xxx-spi.c +1 -1
@@ -78,7 +78,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi) mc13xxx->dev = &spi->dev;mutex_init (&mc13xxx->lock); - mc13xxx->regmap =regmap_init_spi (spi, &mc13xxx_regmap_spi_config); + mc13xxx->regmap =devm_regmap_init_spi (spi, &mc13xxx_regmap_spi_config);if (IS_ERR (mc13xxx->regmap)) { ret =PTR_ERR (mc13xxx->regmap); dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
Signature · 1 line
1.7.1
2012/6/9 Fabio Estevam <[email protected]>:
Quoted 5 lines
From: Fabio Estevam <[email protected]>
Current code misses a "
regmap_exit(mc13xxx->regmap)" in the error and remove paths.Converting to
devm_regmap_init_i2c()makes theregmap_exitunnecessary.
This is already included in this patch: (although it is not yet upstream)
http://www.spinics.net/lists/kernel/msg1346844.html
Quoted 11 lines
Signed-off-by Fabio Estevam <[email protected]>---
drivers/mfd/mc13xxx-i2c.c | 2 +-1 files changed, 1 insertions(+), 1 deletions(-)drivers/mfd/mc13xxx-i2c.c +0
-0
drivers/mfd/mc13xxx-i2c.c static int mc13xxx_i2c_probe(struct i2c_client *client, · line 75
Quoted 5 lines
drivers/mfd/mc13xxx-i2c.c +1
-1@@ -72,7 +72,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, mc13xxx->dev = &client->dev; mutex_init(&mc13xxx->lock); - mc13xxx->regmap = regmap_init_i2c(client, &mc13xxx_regmap_i2c_config); + mc13xxx->regmap = devm_regmap_init_i2c(client, &mc13xxx_regmap_i2c_config);
To convert to devm_regmap_init_i2c(), you also need to remove the regmap_exit() call
in mc13xxx_common_cleanup().
Axel