Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1730825 > unrolled thread
| Started by | Colin King <colin.king@canonical.com> |
|---|---|
| First post | 2017-09-12 13:30 +0200 |
| Last post | 2017-09-12 16:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH] pinctrl: uniphier: make arrays static, reduces object code size Colin King <colin.king@canonical.com> - 2017-09-12 13:30 +0200
Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object code size Masahiro Yamada <yamada.masahiro@socionext.com> - 2017-09-12 15:40 +0200
Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object code size Linus Walleij <linus.walleij@linaro.org> - 2017-09-12 16:20 +0200
| From | Colin King <colin.king@canonical.com> |
|---|---|
| Date | 2017-09-12 13:30 +0200 |
| Subject | [PATCH] pinctrl: uniphier: make arrays static, reduces object code size |
| Message-ID | <uoRy9-Ch-7@gated-at.bofh.it> |
From: Colin Ian King <colin.king@canonical.com>
Don't populate const arrays on the stack, instead make them
static. Makes the object code smaller nearly 1000 bytes. Also
line break wide lines to avoid checkpatch warnings.
Before:
text data bss dec hex filename
13112 1996 0 15108 3b04 pinctrl-uniphier-core.o
After:
text data bss dec hex filename
11642 2476 0 14118 3726 pinctrl-uniphier-core.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/pinctrl/uniphier/pinctrl-uniphier-core.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
index f9267fabe6b0..26fda5c53e65 100644
--- a/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
+++ b/drivers/pinctrl/uniphier/pinctrl-uniphier-core.c
@@ -204,9 +204,10 @@ static int uniphier_conf_pin_drive_get(struct pinctrl_dev *pctldev,
const struct pin_desc *desc = pin_desc_get(pctldev, pin);
enum uniphier_pin_drv_type type =
uniphier_pin_get_drv_type(desc->drv_data);
- const unsigned int strength_1bit[] = {4, 8};
- const unsigned int strength_2bit[] = {8, 12, 16, 20};
- const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14, 16};
+ static const unsigned int strength_1bit[] = {4, 8};
+ static const unsigned int strength_2bit[] = {8, 12, 16, 20};
+ static const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12,
+ 14, 16};
const unsigned int *supported_strength;
unsigned int drvctrl, reg, shift, mask, width, val;
int ret;
@@ -399,9 +400,10 @@ static int uniphier_conf_pin_drive_set(struct pinctrl_dev *pctldev,
const struct pin_desc *desc = pin_desc_get(pctldev, pin);
enum uniphier_pin_drv_type type =
uniphier_pin_get_drv_type(desc->drv_data);
- const unsigned int strength_1bit[] = {4, 8, -1};
- const unsigned int strength_2bit[] = {8, 12, 16, 20, -1};
- const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14, 16, -1};
+ static const unsigned int strength_1bit[] = {4, 8, -1};
+ static const unsigned int strength_2bit[] = {8, 12, 16, 20, -1};
+ static const unsigned int strength_3bit[] = {4, 5, 7, 9, 11, 12, 14,
+ 16, -1};
const unsigned int *supported_strength;
unsigned int drvctrl, reg, shift, mask, width, val;
--
2.14.1
[toc] | [next] | [standalone]
| From | Masahiro Yamada <yamada.masahiro@socionext.com> |
|---|---|
| Date | 2017-09-12 15:40 +0200 |
| Subject | Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object code size |
| Message-ID | <uoTzY-1Rh-15@gated-at.bofh.it> |
| In reply to | #1730825 |
2017-09-12 20:21 GMT+09:00 Colin King <colin.king@canonical.com>: > From: Colin Ian King <colin.king@canonical.com> > > Don't populate const arrays on the stack, instead make them > static. Makes the object code smaller nearly 1000 bytes. Also > line break wide lines to avoid checkpatch warnings. > > Before: > text data bss dec hex filename > 13112 1996 0 15108 3b04 pinctrl-uniphier-core.o > > After: > text data bss dec hex filename > 11642 2476 0 14118 3726 pinctrl-uniphier-core.o > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Masahiro Yamada <yamada.masahiro@socionext.com> Thanks! -- Best Regards Masahiro Yamada
[toc] | [prev] | [next] | [standalone]
| From | Linus Walleij <linus.walleij@linaro.org> |
|---|---|
| Date | 2017-09-12 16:20 +0200 |
| Subject | Re: [PATCH] pinctrl: uniphier: make arrays static, reduces object code size |
| Message-ID | <uoUcF-2jr-19@gated-at.bofh.it> |
| In reply to | #1730825 |
On Tue, Sep 12, 2017 at 1:21 PM, Colin King <colin.king@canonical.com> wrote: > From: Colin Ian King <colin.king@canonical.com> > > Don't populate const arrays on the stack, instead make them > static. Makes the object code smaller nearly 1000 bytes. Also > line break wide lines to avoid checkpatch warnings. > > Before: > text data bss dec hex filename > 13112 1996 0 15108 3b04 pinctrl-uniphier-core.o > > After: > text data bss dec hex filename > 11642 2476 0 14118 3726 pinctrl-uniphier-core.o > > Signed-off-by: Colin Ian King <colin.king@canonical.com> Patch applied with Masahiro's ACK. Yours, Linus Walleij
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web