|
@@ -826,30 +826,17 @@ EXPORT_SYMBOL_GPL(pinmux_generic_remove_function);
|
|
|
* pinmux_generic_free_functions() - removes all functions
|
|
|
* @pctldev: pin controller device
|
|
|
*
|
|
|
- * Note that the caller must take care of locking.
|
|
|
+ * Note that the caller must take care of locking. The pinctrl
|
|
|
+ * functions are allocated with devm_kzalloc() so no need to free
|
|
|
+ * them here.
|
|
|
*/
|
|
|
void pinmux_generic_free_functions(struct pinctrl_dev *pctldev)
|
|
|
{
|
|
|
struct radix_tree_iter iter;
|
|
|
- struct function_desc *function;
|
|
|
- unsigned long *indices;
|
|
|
void **slot;
|
|
|
- int i = 0;
|
|
|
-
|
|
|
- indices = devm_kzalloc(pctldev->dev, sizeof(*indices) *
|
|
|
- pctldev->num_functions, GFP_KERNEL);
|
|
|
- if (!indices)
|
|
|
- return;
|
|
|
|
|
|
radix_tree_for_each_slot(slot, &pctldev->pin_function_tree, &iter, 0)
|
|
|
- indices[i++] = iter.index;
|
|
|
-
|
|
|
- for (i = 0; i < pctldev->num_functions; i++) {
|
|
|
- function = radix_tree_lookup(&pctldev->pin_function_tree,
|
|
|
- indices[i]);
|
|
|
- radix_tree_delete(&pctldev->pin_function_tree, indices[i]);
|
|
|
- devm_kfree(pctldev->dev, function);
|
|
|
- }
|
|
|
+ radix_tree_delete(&pctldev->pin_function_tree, iter.index);
|
|
|
|
|
|
pctldev->num_functions = 0;
|
|
|
}
|