pinctrl: Enable "power-source" to be extracted from DT files
[linux-2.6-block.git] / drivers / pinctrl / pinconf-generic.c
index 3d9a999fb6997f76028af553271708e86b4969b8..29ff77f90fcb290baad5e4ddde60690e6d3950b4 100644 (file)
@@ -166,6 +166,7 @@ static struct pinconf_generic_dt_params dt_params[] = {
        { "input-schmitt-enable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 1 },
        { "input-schmitt-disable", PIN_CONFIG_INPUT_SCHMITT_ENABLE, 0 },
        { "input-debounce", PIN_CONFIG_INPUT_DEBOUNCE, 0 },
+       { "power-source", PIN_CONFIG_POWER_SOURCE, 0 },
        { "low-power-enable", PIN_CONFIG_LOW_POWER_MODE, 1 },
        { "low-power-disable", PIN_CONFIG_LOW_POWER_MODE, 0 },
        { "output-low", PIN_CONFIG_OUTPUT, 0, },
@@ -228,13 +229,12 @@ int pinconf_generic_parse_dt_config(struct device_node *np,
         * Now limit the number of configs to the real number of
         * found properties.
         */
-       *configs = kzalloc(ncfg * sizeof(unsigned long), GFP_KERNEL);
+       *configs = kmemdup(cfg, ncfg * sizeof(unsigned long), GFP_KERNEL);
        if (!*configs) {
                ret = -ENOMEM;
                goto out;
        }
 
-       memcpy(*configs, cfg, ncfg * sizeof(unsigned long));
        *nconfigs = ncfg;
 
 out: