summaryrefslogtreecommitdiffstats
path: root/drivers/base/regmap/regmap-spi.c
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-30 20:56:52 +0100
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-01-30 22:06:43 +0100
commitc0eb46766d395da8d62148bda2e59bad5e6ee2f2 (patch)
tree9b808ba04041f4f10d08b384b4ad8c608a86df4c /drivers/base/regmap/regmap-spi.c
parentMerge branches 'sched-urgent-for-linus', 'perf-urgent-for-linus' and 'x86-urg... (diff)
downloadlinux-c0eb46766d395da8d62148bda2e59bad5e6ee2f2.tar.xz
linux-c0eb46766d395da8d62148bda2e59bad5e6ee2f2.zip
regmap: Implement managed regmap_init()
Save error handling and unwinding code in drivers by providing managed versions of the regmap init functions, simplifying usage. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/base/regmap/regmap-spi.c')
-rw-r--r--drivers/base/regmap/regmap-spi.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/base/regmap/regmap-spi.c b/drivers/base/regmap/regmap-spi.c
index 2560658de344..7c0c35a39c33 100644
--- a/drivers/base/regmap/regmap-spi.c
+++ b/drivers/base/regmap/regmap-spi.c
@@ -70,4 +70,21 @@ struct regmap *regmap_init_spi(struct spi_device *spi,
}
EXPORT_SYMBOL_GPL(regmap_init_spi);
+/**
+ * devm_regmap_init_spi(): Initialise register map
+ *
+ * @spi: Device that will be interacted with
+ * @config: Configuration for register map
+ *
+ * The return value will be an ERR_PTR() on error or a valid pointer
+ * to a struct regmap. The map will be automatically freed by the
+ * device management code.
+ */
+struct regmap *devm_regmap_init_spi(struct spi_device *spi,
+ const struct regmap_config *config)
+{
+ return devm_regmap_init(&spi->dev, &regmap_spi, config);
+}
+EXPORT_SYMBOL_GPL(devm_regmap_init_spi);
+
MODULE_LICENSE("GPL");