From: Thomas Gleixner <tglx@linutronix.de>
To: Claudiu <claudiu.beznea@tuxon.dev>,
robh+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
conor+dt@kernel.org, geert+renesas@glider.be,
magnus.damm@gmail.com, mturquette@baylibre.com, sboyd@kernel.org,
prabhakar.mahadev-lad.rj@bp.renesas.com
Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org,
Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
Subject: Re: [PATCH 5/7] irqchip/renesas-rzg2l: cache registers on suspend/resume
Date: Fri, 27 Oct 2023 19:57:23 +0200 [thread overview]
Message-ID: <87h6mc2bjw.ffs@tglx> (raw)
In-Reply-To: <20231023102223.1309614-6-claudiu.beznea.uj@bp.renesas.com>
On Mon, Oct 23 2023 at 13:22, Claudiu wrote:
> From: Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>
>
> Cache registers content when going to suspend and restore them in resume
> as these may be lost when switching to deep sleep states. With this
> driver data has been marked as static to be able to play with it
> in struct syscon_ops::{suspend, resume}.
I have no idea what you are trying to tell me here. Why do the
suspend/resume callbacks need a static data structure and cannot operate
on a pointer which wastes less builtin memory when the driver is not
used?
Also "play with it" is definitely not a technical term. See
Documentation/process/* which has lots of explanations how to write
proper change logs.
> Because IA55 input is from pin controller and IA55 resumes before pin
> controller we don't restore interrupt enable bits here but let the
> pinctrl to do it on IA55 behalf after pins are in proper state to
> avoid invalid interrupts.
> +
> +static struct rzg2l_irqc_priv {
> void __iomem *base;
> struct irq_fwspec fwspec[IRQC_NUM_IRQ];
> raw_spinlock_t lock;
> -};
> + struct rzg2l_irqc_reg_cache cache;
> +} priv;
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#struct-declarations-and-initializers
>
> static struct rzg2l_irqc_priv *irq_data_to_priv(struct irq_data *data)
> {
> @@ -238,6 +251,37 @@ static int rzg2l_irqc_set_type(struct irq_data *d, unsigned int type)
> return irq_chip_set_type_parent(d, IRQ_TYPE_LEVEL_HIGH);
> }
>
> +static int rzg2l_irqc_irq_suspend(void)
> +{
> + struct rzg2l_irqc_reg_cache *cache = &priv.cache;
> +
> + cache->iitsr = readl_relaxed(priv.base + IITSR);
> + for (u8 i = 0; i < 2; i++)
> + cache->titsr[i] = readl_relaxed(priv.base + TITSR(i));
> +
> + return 0;
> +}
> +
> +static void rzg2l_irqc_irq_resume(void)
> +{
> + struct rzg2l_irqc_reg_cache *cache = &priv.cache;
> + u8 i;
> +
> + /*
> + * Restore only interrupt type. TSSRx will be restored at the
> + * request of pin controller to avoid spurious interrupts due
> + * to invalid PIN states.
> + */
> + for (i = 0; i < 2; i++)
> + writel_relaxed(cache->titsr[i], priv.base + TITSR(i));
> + writel_relaxed(cache->iitsr, priv.base + IITSR);
> +}
> +
> +static struct syscore_ops rzg2l_irqc_syscore_ops = {
> + .suspend = rzg2l_irqc_irq_suspend,
> + .resume = rzg2l_irqc_irq_resume,
> +};
Ditto.
> static const struct irq_chip irqc_chip = {
> .name = "rzg2l-irqc",
> .irq_eoi = rzg2l_irqc_eoi,
> @@ -323,7 +367,6 @@ static int rzg2l_irqc_init(struct device_node *node, struct device_node *parent)
> struct irq_domain *irq_domain, *parent_domain;
> struct platform_device *pdev;
> struct reset_control *resetn;
> - struct rzg2l_irqc_priv *priv;
Make this pointer static at the top level and leave the rest of the code
alone and please give it a proper name. "priv" at the file level is
really non-descriptive.
Thanks,
tglx
next prev parent reply other threads:[~2023-10-27 17:57 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-23 10:22 [PATCH 0/7] irqchip/renesas-rzg2l: add support for RZ/G3S SoC Claudiu
2023-10-23 10:22 ` [PATCH 1/7] dt-bindings: interrupt-controller: renesas,rzg2l-irqc: document RZ/G3S Claudiu
2023-10-23 16:19 ` Conor Dooley
2023-10-23 10:22 ` [PATCH 2/7] clk: renesas: r9a08g045: add IA55 pclk and its reset Claudiu
2023-10-23 10:22 ` [PATCH 3/7] irqchip/renesas-rzg2l: add macros to retrieve TITSR index and associated selector Claudiu
2023-10-27 17:58 ` Thomas Gleixner
2023-10-23 10:22 ` [PATCH 4/7] irqchip/renesas-rzg2l: implement restriction when writing ISCR register Claudiu
2023-10-27 18:02 ` Thomas Gleixner
2023-10-23 10:22 ` [PATCH 5/7] irqchip/renesas-rzg2l: cache registers on suspend/resume Claudiu
2023-10-27 17:57 ` Thomas Gleixner [this message]
2023-10-23 10:22 ` [PATCH 6/7] irqchip/renesas-rzg2l: use tabs instead of spaces Claudiu
2023-10-27 17:57 ` Thomas Gleixner
2023-10-23 10:22 ` [PATCH 7/7] arm64: dts: renesas: r9108g045: add irqc Claudiu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87h6mc2bjw.ffs@tglx \
--to=tglx@linutronix.de \
--cc=claudiu.beznea.uj@bp.renesas.com \
--cc=claudiu.beznea@tuxon.dev \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=magnus.damm@gmail.com \
--cc=mturquette@baylibre.com \
--cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
--cc=robh+dt@kernel.org \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.