diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2018-06-07 08:24:34 -0400 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2018-06-18 01:56:05 -0400 |
commit | 7d71b5f4b2fb5b2a38794fe029d6245c86244de6 (patch) | |
tree | 48e5f2ac3dfd604237f651d2c657e3ec4d0bf72c /drivers/pinctrl/pinctrl-single.c | |
parent | 7547b5969e069520d4cf23ba43b4ac889f8bd0ef (diff) |
pinctrl: pinctrl-single: Avoid divisions in context save/restore
The divisions (and multiplications) can be avoided by changing the loops
to use increments of mux_bytes instead of 1.
While at it, remove the unneeded casts when assigning void pointers.
This saves +100 bytes of kernel size on arm32/arm64.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Tony Lindgren <tony@atomide.com>
Tested-by: Keerthy <j-keerthy@ti.com>
Reviewed-by: Keerthy <j-keerthy@ti.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/pinctrl-single.c')
-rw-r--r-- | drivers/pinctrl/pinctrl-single.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c index b3153c095199..92b694675a56 100644 --- a/drivers/pinctrl/pinctrl-single.c +++ b/drivers/pinctrl/pinctrl-single.c | |||
@@ -1595,19 +1595,19 @@ static int pcs_save_context(struct pcs_device *pcs) | |||
1595 | 1595 | ||
1596 | switch (pcs->width) { | 1596 | switch (pcs->width) { |
1597 | case 64: | 1597 | case 64: |
1598 | regsl = (u64 *)pcs->saved_vals; | 1598 | regsl = pcs->saved_vals; |
1599 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1599 | for (i = 0; i < pcs->size; i += mux_bytes) |
1600 | regsl[i] = pcs->read(pcs->base + i * mux_bytes); | 1600 | *regsl++ = pcs->read(pcs->base + i); |
1601 | break; | 1601 | break; |
1602 | case 32: | 1602 | case 32: |
1603 | regsw = (u32 *)pcs->saved_vals; | 1603 | regsw = pcs->saved_vals; |
1604 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1604 | for (i = 0; i < pcs->size; i += mux_bytes) |
1605 | regsw[i] = pcs->read(pcs->base + i * mux_bytes); | 1605 | *regsw++ = pcs->read(pcs->base + i); |
1606 | break; | 1606 | break; |
1607 | case 16: | 1607 | case 16: |
1608 | regshw = (u16 *)pcs->saved_vals; | 1608 | regshw = pcs->saved_vals; |
1609 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1609 | for (i = 0; i < pcs->size; i += mux_bytes) |
1610 | regshw[i] = pcs->read(pcs->base + i * mux_bytes); | 1610 | *regshw++ = pcs->read(pcs->base + i); |
1611 | break; | 1611 | break; |
1612 | } | 1612 | } |
1613 | 1613 | ||
@@ -1625,19 +1625,19 @@ static void pcs_restore_context(struct pcs_device *pcs) | |||
1625 | 1625 | ||
1626 | switch (pcs->width) { | 1626 | switch (pcs->width) { |
1627 | case 64: | 1627 | case 64: |
1628 | regsl = (u64 *)pcs->saved_vals; | 1628 | regsl = pcs->saved_vals; |
1629 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1629 | for (i = 0; i < pcs->size; i += mux_bytes) |
1630 | pcs->write(regsl[i], pcs->base + i * mux_bytes); | 1630 | pcs->write(*regsl++, pcs->base + i); |
1631 | break; | 1631 | break; |
1632 | case 32: | 1632 | case 32: |
1633 | regsw = (u32 *)pcs->saved_vals; | 1633 | regsw = pcs->saved_vals; |
1634 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1634 | for (i = 0; i < pcs->size; i += mux_bytes) |
1635 | pcs->write(regsw[i], pcs->base + i * mux_bytes); | 1635 | pcs->write(*regsw++, pcs->base + i); |
1636 | break; | 1636 | break; |
1637 | case 16: | 1637 | case 16: |
1638 | regshw = (u16 *)pcs->saved_vals; | 1638 | regshw = pcs->saved_vals; |
1639 | for (i = 0; i < pcs->size / mux_bytes; i++) | 1639 | for (i = 0; i < pcs->size; i += mux_bytes) |
1640 | pcs->write(regshw[i], pcs->base + i * mux_bytes); | 1640 | pcs->write(*regshw++, pcs->base + i); |
1641 | break; | 1641 | break; |
1642 | } | 1642 | } |
1643 | } | 1643 | } |