summaryrefslogtreecommitdiff
path: root/drivers/base
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 00:17:46 +0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-04-02 00:17:46 +0400
commit3786075b5ebc8c4eaefd9e3ebf72883934fb64b3 (patch)
treea1fdfae07be08bd315c57d3beaee941976ecee17 /drivers/base
parentc6b38ec06e281af0608f02763ac7484ace267024 (diff)
parent5481b348e80fb280ff9eaa17ad99a5b592c7e145 (diff)
downloadlinux-3786075b5ebc8c4eaefd9e3ebf72883934fb64b3.tar.xz
Merge tag 'regulator-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
Pull regulator updates from Mark Brown: "This release has lots and lots of small cleanups and fixes in the regulator subsystem, mainly cleaning up some bad patterns that got duplicated in DT code, but otherwise very little of note outside of the scope of the relevant drivers: - Support for configuration of the initial state for gpio regulators with multi-voltage support. - Support for calling regulator_set_voltage() on fixed regulators. - New drivers for Broadcom BCM590xx, Freescale pfuze200, Samsung S2MPA01 & S2MPS11/4, some PWM controlled regulators found on some ST boards and TI TPS65218" * tag 'regulator-v3.15' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (154 commits) regulator: aat2870: Use regulator_map_voltage_ascend regulator: st-pwm: Convert to get_voltage_sel regulator: Add new driver for ST's PWM controlled voltage regulators regulator: bcm590xx: Remove **rdev from struct bcm590xx_reg regulator: bcm590xx: Make the modalias matches the driver name regulator: s5m8767: Convert to use regulator_[enable|disable|is_enabled]_regmap regulator: db8500-prcmu: Set 1.8V as a fixed voltage for vsmps2 regulator: s2mps11: Add missing of_node_put regulator: s2mps11: Use of_get_child_by_name Documentation: mfd: s2mps11: Document support for S2MPS14 regulator: s2mps11: Add set_suspend_disable for S2MPS14 regulator: s2mps11: Add support for S2MPS14 regulators regulator: max8660: Fix brace alignment regulator: dbx500: use seq_puts() instead of seq_printf() regulator: dbx500-prcmu: Silence checkpatch warnings regulator: anatop: Remove checking control_reg in [set|get]_voltage_sel regulator: max8952: Silence checkpatch warning regulator: max8925: Silence checkpatch warning regulator: max8660: Silence checkpatch warnings regulator: arizona-ldo1: Correct default regulator init_data ...
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/devres.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/base/devres.c b/drivers/base/devres.c
index 545c4de412c3..db4e264eecb6 100644
--- a/drivers/base/devres.c
+++ b/drivers/base/devres.c
@@ -791,6 +791,32 @@ void * devm_kmalloc(struct device *dev, size_t size, gfp_t gfp)
EXPORT_SYMBOL_GPL(devm_kmalloc);
/**
+ * devm_kstrdup - Allocate resource managed space and
+ * copy an existing string into that.
+ * @dev: Device to allocate memory for
+ * @s: the string to duplicate
+ * @gfp: the GFP mask used in the devm_kmalloc() call when
+ * allocating memory
+ * RETURNS:
+ * Pointer to allocated string on success, NULL on failure.
+ */
+char *devm_kstrdup(struct device *dev, const char *s, gfp_t gfp)
+{
+ size_t size;
+ char *buf;
+
+ if (!s)
+ return NULL;
+
+ size = strlen(s) + 1;
+ buf = devm_kmalloc(dev, size, gfp);
+ if (buf)
+ memcpy(buf, s, size);
+ return buf;
+}
+EXPORT_SYMBOL_GPL(devm_kstrdup);
+
+/**
* devm_kfree - Resource-managed kfree
* @dev: Device this memory belongs to
* @p: Memory to free