Skip to content

Commit

Permalink
pinctrl: Don't copy pin names when registering them
Browse files Browse the repository at this point in the history
A pin controller's names array is no longer marked __refdata. Hence, we
can avoid copying a pin's name into the descriptor when registering it.
Instead, just point at the string supplied in the pin array.

This both simplifies and speeds up pin controller initialization, but
also removes the hard-coded maximum pin name length.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
  • Loading branch information
Stephen Warren authored and Linus Walleij committed Oct 20, 2011
1 parent 25aec32 commit 9af1e44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions drivers/pinctrl/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,8 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
/* Set owner */
pindesc->pctldev = pctldev;

/* Copy optional basic pin info */
if (name)
strlcpy(pindesc->name, name, sizeof(pindesc->name));
/* Copy basic pin info */
pindesc->name = name;

spin_lock(&pctldev->pin_desc_tree_lock);
radix_tree_insert(&pctldev->pin_desc_tree, number, pindesc);
Expand Down
2 changes: 1 addition & 1 deletion drivers/pinctrl/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ struct pinctrl_dev {
*/
struct pin_desc {
struct pinctrl_dev *pctldev;
char name[16];
const char *name;
spinlock_t lock;
/* These fields only added when supporting pinmux drivers */
#ifdef CONFIG_PINMUX
Expand Down

0 comments on commit 9af1e44

Please sign in to comment.