Commit e7c706b1 authored by Axel Lin's avatar Axel Lin Committed by Samuel Ortiz

mfd: Use devm_* APIs for mc13xxx

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent e4ecf6ea
...@@ -723,10 +723,6 @@ void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx) ...@@ -723,10 +723,6 @@ void mc13xxx_common_cleanup(struct mc13xxx *mc13xxx)
free_irq(mc13xxx->irq, mc13xxx); free_irq(mc13xxx->irq, mc13xxx);
mfd_remove_devices(mc13xxx->dev); mfd_remove_devices(mc13xxx->dev);
regmap_exit(mc13xxx->regmap);
kfree(mc13xxx);
} }
EXPORT_SYMBOL_GPL(mc13xxx_common_cleanup); EXPORT_SYMBOL_GPL(mc13xxx_common_cleanup);
......
...@@ -63,7 +63,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, ...@@ -63,7 +63,7 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
if (of_id) if (of_id)
idrv->id_table = (const struct i2c_device_id*) of_id->data; idrv->id_table = (const struct i2c_device_id*) of_id->data;
mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL); mc13xxx = devm_kzalloc(&client->dev, sizeof(*mc13xxx), GFP_KERNEL);
if (!mc13xxx) if (!mc13xxx)
return -ENOMEM; return -ENOMEM;
...@@ -72,13 +72,13 @@ static int mc13xxx_i2c_probe(struct i2c_client *client, ...@@ -72,13 +72,13 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
mc13xxx->dev = &client->dev; mc13xxx->dev = &client->dev;
mutex_init(&mc13xxx->lock); 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)) { if (IS_ERR(mc13xxx->regmap)) {
ret = PTR_ERR(mc13xxx->regmap); ret = PTR_ERR(mc13xxx->regmap);
dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
ret); ret);
dev_set_drvdata(&client->dev, NULL); dev_set_drvdata(&client->dev, NULL);
kfree(mc13xxx);
return ret; return ret;
} }
......
...@@ -129,7 +129,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi) ...@@ -129,7 +129,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
if (of_id) if (of_id)
sdrv->id_table = &mc13xxx_device_id[(enum mc13xxx_id) of_id->data]; sdrv->id_table = &mc13xxx_device_id[(enum mc13xxx_id) of_id->data];
mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL); mc13xxx = devm_kzalloc(&spi->dev, sizeof(*mc13xxx), GFP_KERNEL);
if (!mc13xxx) if (!mc13xxx)
return -ENOMEM; return -ENOMEM;
...@@ -139,15 +139,12 @@ static int mc13xxx_spi_probe(struct spi_device *spi) ...@@ -139,15 +139,12 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
mc13xxx->dev = &spi->dev; mc13xxx->dev = &spi->dev;
mutex_init(&mc13xxx->lock); mutex_init(&mc13xxx->lock);
mc13xxx->regmap = regmap_init(&spi->dev, &regmap_mc13xxx_bus, &spi->dev, mc13xxx->regmap = devm_regmap_init_spi(spi, &mc13xxx_regmap_spi_config);
&mc13xxx_regmap_spi_config);
if (IS_ERR(mc13xxx->regmap)) { if (IS_ERR(mc13xxx->regmap)) {
ret = PTR_ERR(mc13xxx->regmap); ret = PTR_ERR(mc13xxx->regmap);
dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n", dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
ret); ret);
dev_set_drvdata(&spi->dev, NULL); dev_set_drvdata(&spi->dev, NULL);
kfree(mc13xxx);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment