[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <201111291424.41178.arnd.bergmann@linaro.org>
Date: Tue, 29 Nov 2011 14:24:41 +0000
From: Arnd Bergmann <arnd.bergmann@...aro.org>
To: Linus Walleij <linus.walleij@...ricsson.com>
Cc: linux-kernel@...r.kernel.org, Stephen Warren <swarren@...dia.com>,
Grant Likely <grant.likely@...retlab.ca>,
Barry Song <21cnbao@...il.com>,
Shawn Guo <shawn.guo@...escale.com>,
Thomas Abraham <thomas.abraham@...aro.org>,
Dong Aisheng <dong.aisheng@...aro.org>,
Rajendra Nayak <rajendra.nayak@...aro.org>,
Linus Walleij <linus.walleij@...aro.org>
Subject: Re: [PATCH] pinctrl: make a deep copy of pinmux map
On Tuesday 29 November 2011, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@...aro.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@...aro.org>
> Signed-off-by: Linus Walleij <linus.walleij@...aro.org>
Very nice!
> /**
> * pinmux_register_mappings() - register a set of pinmux mappings
> - * @maps: the pinmux mappings table to register
> + * @maps: the pinmux mappings table to register, this should be marked with
> + * __initdata so it can be discarded after boot, this function will
> + * perform a deep copy (including strings) for the mapping entries.
> * @num_maps: the number of maps in the mapping table
> *
Is it actually necessary to copy the strings? I always thought they
end up in the constant data section even if the data structure that
they are defined in is in initdata.
> +
> + /* Allocate a deep copy of the map array */
> + pinmux_maps = kzalloc(sizeof(struct pinmux_map) * num_maps,
> + GFP_KERNEL);
I guess it's easier to use kmemdup here. At least there is no
point in zeroing the array when the next step is to overwrite it.
Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists