[PATCH] pinctrl: Cleanup string initializations (char[] instead of char *)

From: Manuel SchÃlling
Date: Sat May 17 2014 - 10:38:09 EST


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@xxxxxx>
---
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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/