提交 7d71b5f4 编写于 作者: G Geert Uytterhoeven 提交者: Linus Walleij

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: NGeert Uytterhoeven <geert+renesas@glider.be>
Acked-by: NTony Lindgren <tony@atomide.com>
Tested-by: NKeerthy <j-keerthy@ti.com>
Reviewed-by: NKeerthy <j-keerthy@ti.com>
Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
上级 7547b596
......@@ -1595,19 +1595,19 @@ static int pcs_save_context(struct pcs_device *pcs)
switch (pcs->width) {
case 64:
regsl = (u64 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
regsl[i] = pcs->read(pcs->base + i * mux_bytes);
regsl = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
*regsl++ = pcs->read(pcs->base + i);
break;
case 32:
regsw = (u32 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
regsw[i] = pcs->read(pcs->base + i * mux_bytes);
regsw = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
*regsw++ = pcs->read(pcs->base + i);
break;
case 16:
regshw = (u16 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
regshw[i] = pcs->read(pcs->base + i * mux_bytes);
regshw = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
*regshw++ = pcs->read(pcs->base + i);
break;
}
......@@ -1625,19 +1625,19 @@ static void pcs_restore_context(struct pcs_device *pcs)
switch (pcs->width) {
case 64:
regsl = (u64 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
pcs->write(regsl[i], pcs->base + i * mux_bytes);
regsl = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
pcs->write(*regsl++, pcs->base + i);
break;
case 32:
regsw = (u32 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
pcs->write(regsw[i], pcs->base + i * mux_bytes);
regsw = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
pcs->write(*regsw++, pcs->base + i);
break;
case 16:
regshw = (u16 *)pcs->saved_vals;
for (i = 0; i < pcs->size / mux_bytes; i++)
pcs->write(regshw[i], pcs->base + i * mux_bytes);
regshw = pcs->saved_vals;
for (i = 0; i < pcs->size; i += mux_bytes)
pcs->write(*regshw++, pcs->base + i);
break;
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册