From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Laxman Dewangan <ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Cc: linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/2] pinctrl: utils : add support to pass config type in generic util APIs
Date: Tue, 20 Aug 2013 14:25:09 -0600 [thread overview]
Message-ID: <5213D0A5.7000504@wwwdotorg.org> (raw)
In-Reply-To: <1377000758-3795-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
On 08/20/2013 06:12 AM, Laxman Dewangan wrote:
> Add support to pass the config type like GROUP or PIN when using
> the utils or generic pin configuration APIs. This will make the
> APIs more generic.
I think passing in the type parameter to the *_to_map APIs makes sense,
but I don't think you need to have separate free functions; the way to
free any kind of map entry is always known, so you don't have to limit
the code to only freeing one type.
> diff --git a/drivers/pinctrl/pinctrl-utils.c b/drivers/pinctrl/pinctrl-utils.c
> -void pinctrl_utils_dt_free_map(struct pinctrl_dev *pctldev,
> - struct pinctrl_map *map, unsigned num_maps)
> +void pinctrl_utils_dt_free_map_config(struct pinctrl_dev *pctldev,
> + struct pinctrl_map *map, unsigned num_maps,
> + enum pinctrl_map_type type)
> {
> int i;
>
> for (i = 0; i < num_maps; i++)
> - if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
> + if (map[i].type == type)
> kfree(map[i].data.configs.configs);
In other words, replace that if with:
switch (maps[i].type) {
case PIN_MAP_TYPE_CONFIGS_PIN:
case PIN_MAP_TYPE_CONFIGS_GROUP:
kfree(map[i].data.configs.configs);
break;
default:
break;
}
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@wwwdotorg.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: linus.walleij@linaro.org, linux-kernel@vger.kernel.org,
linux-tegra@vger.kernel.org
Subject: Re: [PATCH 1/2] pinctrl: utils : add support to pass config type in generic util APIs
Date: Tue, 20 Aug 2013 14:25:09 -0600 [thread overview]
Message-ID: <5213D0A5.7000504@wwwdotorg.org> (raw)
In-Reply-To: <1377000758-3795-1-git-send-email-ldewangan@nvidia.com>
On 08/20/2013 06:12 AM, Laxman Dewangan wrote:
> Add support to pass the config type like GROUP or PIN when using
> the utils or generic pin configuration APIs. This will make the
> APIs more generic.
I think passing in the type parameter to the *_to_map APIs makes sense,
but I don't think you need to have separate free functions; the way to
free any kind of map entry is always known, so you don't have to limit
the code to only freeing one type.
> diff --git a/drivers/pinctrl/pinctrl-utils.c b/drivers/pinctrl/pinctrl-utils.c
> -void pinctrl_utils_dt_free_map(struct pinctrl_dev *pctldev,
> - struct pinctrl_map *map, unsigned num_maps)
> +void pinctrl_utils_dt_free_map_config(struct pinctrl_dev *pctldev,
> + struct pinctrl_map *map, unsigned num_maps,
> + enum pinctrl_map_type type)
> {
> int i;
>
> for (i = 0; i < num_maps; i++)
> - if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP)
> + if (map[i].type == type)
> kfree(map[i].data.configs.configs);
In other words, replace that if with:
switch (maps[i].type) {
case PIN_MAP_TYPE_CONFIGS_PIN:
case PIN_MAP_TYPE_CONFIGS_GROUP:
kfree(map[i].data.configs.configs);
break;
default:
break;
}
next prev parent reply other threads:[~2013-08-20 20:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-20 12:12 [PATCH 1/2] pinctrl: utils : add support to pass config type in generic util APIs Laxman Dewangan
2013-08-20 12:12 ` Laxman Dewangan
2013-08-20 12:12 ` [PATCH 2/2] pinctrl: tegra: use pinctrl-utils APIs for mapping Laxman Dewangan
2013-08-20 12:12 ` Laxman Dewangan
[not found] ` <1377000758-3795-2-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-08-20 20:28 ` Stephen Warren
2013-08-20 20:28 ` Stephen Warren
[not found] ` <1377000758-3795-1-git-send-email-ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-08-20 20:25 ` Stephen Warren [this message]
2013-08-20 20:25 ` [PATCH 1/2] pinctrl: utils : add support to pass config type in generic util APIs Stephen Warren
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=5213D0A5.7000504@wwwdotorg.org \
--to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
--cc=ldewangan-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
--cc=linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.