From: Arnd Bergmann <arnd.bergmann@linaro.org>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-kernel@vger.kernel.org, Stephen Warren <swarren@nvidia.com>,
Grant Likely <grant.likely@secretlab.ca>,
Barry Song <21cnbao@gmail.com>,
Shawn Guo <shawn.guo@freescale.com>,
Thomas Abraham <thomas.abraham@linaro.org>,
Dong Aisheng <dong.aisheng@linaro.org>,
Rajendra Nayak <rajendra.nayak@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: Re: [PATCH] pinctrl: make a deep copy of pinmux map
Date: Tue, 29 Nov 2011 14:24:41 +0000 [thread overview]
Message-ID: <201111291424.41178.arnd.bergmann@linaro.org> (raw)
In-Reply-To: <1322567938-28321-1-git-send-email-linus.walleij@stericsson.com>
On Tuesday 29 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>
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
prev parent reply other threads:[~2011-11-29 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-29 11:58 Linus Walleij
2011-11-29 14:24 ` Arnd Bergmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201111291424.41178.arnd.bergmann@linaro.org \
--to=arnd.bergmann@linaro.org \
--cc=21cnbao@gmail.com \
--cc=dong.aisheng@linaro.org \
--cc=grant.likely@secretlab.ca \
--cc=linus.walleij@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rajendra.nayak@linaro.org \
--cc=shawn.guo@freescale.com \
--cc=swarren@nvidia.com \
--cc=thomas.abraham@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®