mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Manuel Schölling" <manuel.schoelling@gmx.de>
To: linus.walleij@linaro.org
Cc: swarren@wwwdotorg.org, thierry.reding@gmail.com,
	linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
	"Manuel Schölling" <manuel.schoelling@gmx.de>
Subject: [PATCH] pinctrl: Cleanup string initializations (char[] instead of char *)
Date: Sat, 17 May 2014 16:37:25 +0200	[thread overview]
Message-ID: <1400337445-25750-1-git-send-email-manuel.schoelling@gmx.de> (raw)

Initializations like 'char *foo = "bar"' will create two variables: a static
string and a pointer (foo) to that static string. Instead 'char foo[] = "bar"'
will declare a single variable and will end up in shorter
assembly (according to Jeff Garzik on the KernelJanitor's TODO list).

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
---
 drivers/pinctrl/pinctrl-mxs.c    |    6 +++---
 drivers/pinctrl/pinctrl-single.c |    4 ++--
 drivers/pinctrl/pinctrl-tegra.c  |    2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-mxs.c b/drivers/pinctrl/pinctrl-mxs.c
index 40c76f2..cd4215e 100644
--- a/drivers/pinctrl/pinctrl-mxs.c
+++ b/drivers/pinctrl/pinctrl-mxs.c
@@ -351,7 +351,7 @@ static int mxs_pinctrl_parse_group(struct platform_device *pdev,
 	struct mxs_pinctrl_data *d = platform_get_drvdata(pdev);
 	struct mxs_group *g = &d->soc->groups[idx];
 	struct property *prop;
-	const char *propname = "fsl,pinmux-ids";
+	const char propname[] = "fsl,pinmux-ids";
 	char *group;
 	int length = strlen(np->name) + SUFFIX_LEN;
 	u32 val, i;
@@ -399,8 +399,8 @@ static int mxs_pinctrl_probe_dt(struct platform_device *pdev,
 	struct device_node *np = pdev->dev.of_node;
 	struct device_node *child;
 	struct mxs_function *f;
-	const char *gpio_compat = "fsl,mxs-gpio";
-	const char *fn, *fnull = "";
+	const char gpio_compat[] = "fsl,mxs-gpio";
+	const char *fn, fnull[] = "";
 	int i = 0, idxf = 0, idxg = 0;
 	int ret;
 	u32 val;
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 2960557..a3ed99f 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1561,8 +1561,8 @@ static struct of_device_id pcs_of_match[];
 
 static int pcs_add_gpio_func(struct device_node *node, struct pcs_device *pcs)
 {
-	const char *propname = "pinctrl-single,gpio-range";
-	const char *cellname = "#pinctrl-single,gpio-range-cells";
+	const char propname[] = "pinctrl-single,gpio-range";
+	const char cellname[] = "#pinctrl-single,gpio-range-cells";
 	struct of_phandle_args gpiospec;
 	struct pcs_gpiofunc_range *range;
 	int ret, i;
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
index 6545809..43eeb1b 100644
--- a/drivers/pinctrl/pinctrl-tegra.c
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -576,7 +576,7 @@ static void tegra_pinconf_config_dbg_show(struct pinctrl_dev *pctldev,
 {
 	enum tegra_pinconf_param param = TEGRA_PINCONF_UNPACK_PARAM(config);
 	u16 arg = TEGRA_PINCONF_UNPACK_ARG(config);
-	const char *pname = "unknown";
+	const char pname[] = "unknown";
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(cfg_params); i++) {
-- 
1.7.10.4


             reply	other threads:[~2014-05-17 14:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-17 14:37 Manuel Schölling [this message]
2014-05-17 21:24 ` Thierry Reding
2014-05-22 21:57 ` Linus Walleij

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=1400337445-25750-1-git-send-email-manuel.schoelling@gmx.de \
    --to=manuel.schoelling@gmx.de \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=thierry.reding@gmail.com \
    /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®