From: Dong Aisheng <aisheng.dong@freescale.com>
To: Devendra Naga <devendra.aaru@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V2 1/2] pinctrl: pinctrl-imx: free allocated pinctrl_map structure only once and use kernel facilities for IMX_PMX_DUMP
Date: Fri, 8 Jun 2012 10:59:17 +0800 [thread overview]
Message-ID: <20120608025916.GF8354@shlinux2.ap.freescale.net> (raw)
In-Reply-To: <1339087715-14683-1-git-send-email-devendra.aaru@gmail.com>
On Thu, Jun 07, 2012 at 10:18:35PM +0530, Devendra Naga wrote:
> a) as we allocate the pinctrl_map structure at imx_dt_node_to_map at line 167, anyway
> if its an element, or a num_elements * (sizeof(type)) elements allocated to one single
> pointer must be freed only once.
>
> CASE. A)
>
> as new_map is not moved and allocated like,
>
> for (i = 0; i < MAX_ELEMS; i++) {
> new_map[i] = kmalloc(numelems * size, GFP_KERNEL);
> }
>
> its freed as
>
> for (i = 0; i < MAX_ELEMS; i++) {
> kfree(new_map[i]);
> }
>
> CASE. B)
> and its allocated like
> new_map = kmalloc(numelems * size, GFP_KERNEL);
>
> it just needs kfree not as case A's.
>
> b) use KERN_DEBUG facility for the IMX_PMX_DUMP macro.
>
> Signed-off-by: Devendra Naga <devendra.aaru@gmail.com>
> Acked-by: Dong Aisheng <dong.aisheng@linaro.org>
> ---
> drivers/pinctrl/pinctrl-imx.c | 25 +++++++++++--------------
> 1 file changed, 11 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
> index f6e7c67..7a59a59 100644
> --- a/drivers/pinctrl/pinctrl-imx.c
> +++ b/drivers/pinctrl/pinctrl-imx.c
> @@ -27,16 +27,16 @@
> #include "core.h"
> #include "pinctrl-imx.h"
>
> -#define IMX_PMX_DUMP(info, p, m, c, n) \
> -{ \
> - int i, j; \
> - printk("Format: Pin Mux Config\n"); \
> - for (i = 0; i < n; i++) { \
> - j = p[i]; \
> - printk("%s %d 0x%lx\n", \
> - info->pins[j].name, \
> - m[i], c[i]); \
> - } \
> +#define IMX_PMX_DUMP(info, p, m, c, n) \
> +{ \
> + int i, j; \
> + printk(KERN_DEBUG "Format: Pin Mux Config\n"); \
> + for (i = 0; i < n; i++) { \
> + j = p[i]; \
> + printk(KERN_DEBUG "%s %d 0x%lx\n", \
> + info->pins[j].name, \
> + m[i], c[i]); \
> + } \
> }
>
Sorry i missed one more comment.
I think you may also need add below changes since the #ifdef DEBUG
is not needed anymore after using KERN_DEBUG.
diff --git a/drivers/pinctrl/pinctrl-imx.c b/drivers/pinctrl/pinctrl-imx.c
index d8fe1d8..4d073ef 100644
--- a/drivers/pinctrl/pinctrl-imx.c
+++ b/drivers/pinctrl/pinctrl-imx.c
@@ -475,9 +475,8 @@ static int __devinit imx_pinctrl_parse_groups(struct device_node *np,
grp->configs[j] = config & ~IMX_PAD_SION;
}
-#ifdef DEBUG
IMX_PMX_DUMP(info, grp->pins, grp->mux_mode, grp->configs, grp->npins);
-#endif
+
return 0;
}
Regards
Dong Aisheng
prev parent reply other threads:[~2012-06-08 2:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-07 16:48 Devendra Naga
2012-06-08 2:59 ` Dong Aisheng [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=20120608025916.GF8354@shlinux2.ap.freescale.net \
--to=aisheng.dong@freescale.com \
--cc=devendra.aaru@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-kernel@vger.kernel.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
Powered by JetHome