Messages in this thread | | | From | Arnd Bergmann <> | Subject | Re: [PATCH 1/2 v3] pinctrl: make a copy of pinmux map | Date | Wed, 30 Nov 2011 13:30:08 +0000 |
| |
On Wednesday 30 November 2011, Linus Walleij wrote: > From: Linus Walleij <linus.walleij@linaro.org> > > This makes a deep copy of the pinmux function map instead of > keeping the copy supplied from the platform around. This makes > it possible to tag the platforms map with __initdata as is also > done as part of this patch. > > Rationale: a certain target platform (PXA) has numerous > pinmux maps, many of which will be lying around unused after > boot in a multi-platform binary. Instead, deep-copy the one > we're going to use and tag them all __initdata so they go away > after boot. > > Suggested-by: Arnd Bergmann <arnd.bergmann@linaro.org> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Arnd Bergmann <arnd@linaro.org>
> @@ -348,32 +351,48 @@ EXPORT_SYMBOL_GPL(pinmux_gpio_direction_output); > int __init pinmux_register_mappings(struct pinmux_map const *maps, > unsigned num_maps) > { > + int ret = 0; > int i; > > - if (pinmux_maps != NULL) { > + if (pinmux_maps_num != 0) { > pr_err("pinmux mappings already registered, you can only " > "register one set of maps\n"); > return -EINVAL; > }
A trick pointed out by Rusty Russell in a recent blog post [1] is to not initialize the return value initially, but always set it only in the error path so that the compiler can warn you when you ever forget setting it in one path.
Arnd
[1] http://rusty.ozlabs.org/?p=232
| |