From: Krzysztof Kozlowski <krzk@kernel.org>
To: Marek Szyprowski <m.szyprowski@samsung.com>
Cc: linux-gpio@vger.kernel.org, linux-samsung-soc@vger.kernel.org,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Linus Walleij <linus.walleij@linaro.org>,
Tomasz Figa <tomasz.figa@gmail.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
Chanwoo Choi <cw00.choi@samsung.com>
Subject: Re: [PATCH] pinctrl: samsung: Use bank name as irqchip name
Date: Wed, 10 Jun 2020 08:49:33 +0200 [thread overview]
Message-ID: <20200610064933.GA3716@kozik-lap> (raw)
In-Reply-To: <20200609082329.10184-1-m.szyprowski@samsung.com>
On Tue, Jun 09, 2020 at 10:23:29AM +0200, Marek Szyprowski wrote:
> Use the bank name as the irqchip name. This name is later visible in
> /proc/interrupts, what makes it possible to easily identify each
> GPIO interrupt.
>
> /proc/interrupts before this patch:
> 143: 0 exynos4210_wkup_irq_chip 7 Edge hdmi
> 144: 0 exynos4210_wkup_irq_chip 6 Level wm8994
> 145: 1 exynos4210_wkup_irq_chip 7 Edge max77686-pmic, max77686-rtc
> 146: 1 exynos_gpio_irq_chip 3 Edge 3-0048
>
> /proc/interrupts after this patch:
> 143: 0 gpx3 7 Edge hdmi
> 144: 0 gpx3 6 Level wm8994
> 145: 1 gpx0 7 Edge max77686-pmic, max77686-rtc
> 146: 1 gpm2 3 Edge 3-0048
>
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Hi Marek,
Nice idea!
> ---
> drivers/pinctrl/samsung/pinctrl-exynos.c | 27 +++++++++++++++---------
> 1 file changed, 17 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pinctrl/samsung/pinctrl-exynos.c b/drivers/pinctrl/samsung/pinctrl-exynos.c
> index 84501c785473..1c87cf41602a 100644
> --- a/drivers/pinctrl/samsung/pinctrl-exynos.c
> +++ b/drivers/pinctrl/samsung/pinctrl-exynos.c
> @@ -207,7 +207,7 @@ static void exynos_irq_release_resources(struct irq_data *irqd)
> /*
> * irq_chip for gpio interrupts.
> */
> -static struct exynos_irq_chip exynos_gpio_irq_chip = {
> +static const struct exynos_irq_chip exynos_gpio_irq_chip __initconst = {
> .chip = {
> .name = "exynos_gpio_irq_chip",
> .irq_unmask = exynos_irq_unmask,
> @@ -313,7 +313,13 @@ int exynos_eint_gpio_init(struct samsung_pinctrl_drv_data *d)
> goto err_domains;
> }
>
> - bank->irq_chip = &exynos_gpio_irq_chip;
> + bank->irq_chip = kmemdup(&exynos_gpio_irq_chip,
> + sizeof(*bank->irq_chip), GFP_KERNEL);
You cannot reference initconst memory from non-init function. Build with
SECTION_MISMATCH to see the warnings.
> + if (!bank->irq_chip) {
irq_domain_remove()
> + ret = -ENOMEM;
> + goto err_domains;
> + }
> + bank->irq_chip->chip.name = bank->name;
> }
>
> return 0;
> @@ -521,7 +527,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
> struct samsung_pin_bank *bank;
> struct exynos_weint_data *weint_data;
> struct exynos_muxed_weint_data *muxed_data;
> - struct exynos_irq_chip *irq_chip;
> + const struct exynos_irq_chip *irq_chip;
> unsigned int muxed_banks = 0;
> unsigned int i;
> int idx, irq;
> @@ -531,12 +537,7 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
>
> match = of_match_node(exynos_wkup_irq_ids, np);
> if (match) {
> - irq_chip = kmemdup(match->data,
> - sizeof(*irq_chip), GFP_KERNEL);
> - if (!irq_chip) {
> - of_node_put(np);
> - return -ENOMEM;
> - }
> + irq_chip = match->data;
> wkup_np = np;
> break;
> }
> @@ -557,7 +558,13 @@ int exynos_eint_wkup_init(struct samsung_pinctrl_drv_data *d)
> return -ENXIO;
> }
>
> - bank->irq_chip = irq_chip;
> + bank->irq_chip = kmemdup(irq_chip, sizeof(*irq_chip),
> + GFP_KERNEL);
> + if (!bank->irq_chip) {
> + of_node_put(wkup_np);
irq_domain_remove()
Best regards,
Krzysztof
> + return -ENOMEM;
> + }
> + bank->irq_chip->chip.name = bank->name;
>
> if (!of_find_property(bank->of_node, "interrupts", NULL)) {
> bank->eint_type = EINT_TYPE_WKUP_MUX;
> --
> 2.17.1
>
next prev parent reply other threads:[~2020-06-10 6:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20200609082341eucas1p2e24e71598af14d994520b79494e96b15@eucas1p2.samsung.com>
2020-06-09 8:23 ` [PATCH] pinctrl: samsung: Use bank name as irqchip name Marek Szyprowski
2020-06-09 12:34 ` kernel test robot
2020-06-10 6:49 ` Krzysztof Kozlowski [this message]
2020-07-20 14:54 Krzysztof Kozlowski
2020-07-26 22:37 ` Linus Walleij
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=20200610064933.GA3716@kozik-lap \
--to=krzk@kernel.org \
--cc=b.zolnierkie@samsung.com \
--cc=cw00.choi@samsung.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-samsung-soc@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=s.nawrocki@samsung.com \
--cc=tomasz.figa@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).