Hi Kaneko-san,
On Wed, Dec 6, 2017 at 7:48 PM, Yoshihiro Kaneko <[email protected]> wrote:
> From: Hien Dang <[email protected]>
>
> This patch adds an implementation that saves and restores the state of
> GPIO configuration on suspend and resume.
>
> Signed-off-by: Hien Dang <[email protected]>
> Signed-off-by: Takeshi Kihara <[email protected]>
> Signed-off-by: Yoshihiro Kaneko <[email protected]>
Thanks for your patch!
> --- a/drivers/gpio/gpio-rcar.c
> +++ b/drivers/gpio/gpio-rcar.c
> @@ -31,6 +31,16 @@
> #include <linux/spinlock.h>
> #include <linux/slab.h>
>
> +struct gpio_rcar_bank_info {
> + bool iointsel;
> + bool inoutsel;
> + bool outdt;
> + bool active_high_rising_edge;
> + bool level_trigger;
> + bool both;
> + bool intmsk;
> +};
So for each GPIO, you save 7 bools = 7 bytes.
> struct gpio_rcar_priv {
> void __iomem *base;
> spinlock_t lock;
> @@ -41,6 +51,7 @@ struct gpio_rcar_priv {
> unsigned int irq_parent;
> bool has_both_edge_trigger;
> bool needs_clk;
> + struct gpio_rcar_bank_info bank_info[32];
That's 32 x 7 = 224 bytes in total.
What about just using 7 u32s instead, one for each register to save?
That way you only need 7 x 4 = 28 bytes, and you can probably optimize
the code to just save/restore the whole register at once.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds