[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20200409084953.46265-1-hui.song_1@nxp.com>
Date: Thu, 9 Apr 2020 16:49:53 +0800
From: Hui Song <hui.song_1@....com>
To: Shawn Guo <shawnguo@...nel.org>, Li Yang <leoyang.li@....com>,
Rob Herring <robh+dt@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Cc: linux-arm-kernel@...ts.infradead.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-gpio@...r.kernel.org,
Song Hui <hui.song_1@....com>
Subject: [PATCH] gpio: mpc8xxx: Add shutdown function.
From: Song Hui <hui.song_1@....com>
When the kexec command is executed, the memory area will be re-paginated.
The shutdown function needed to make interrupt handler to be NULL.If
not, an interrupt will be generated during this period. When the interrupt
handler is executed,the handler function address changed and crash will
occur.
Signed-off-by: Song Hui <hui.song_1@....com>
---
drivers/gpio/gpio-mpc8xxx.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c
index 604dfec..a24e6c5 100644
--- a/drivers/gpio/gpio-mpc8xxx.c
+++ b/drivers/gpio/gpio-mpc8xxx.c
@@ -446,9 +446,21 @@ static int mpc8xxx_remove(struct platform_device *pdev)
return 0;
}
+static int mpc8xxx_shutdown(struct platform_device *pdev)
+{
+ struct mpc8xxx_gpio_chip *mpc8xxx_gc = platform_get_drvdata(pdev);
+
+ if (mpc8xxx_gc->irq) {
+ irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, NULL, NULL);
+ irq_domain_remove(mpc8xxx_gc->irq);
+ }
+
+ return 0;
+}
static struct platform_driver mpc8xxx_plat_driver = {
.probe = mpc8xxx_probe,
.remove = mpc8xxx_remove,
+ .shutdown = mpc8xxx_shutdown,
.driver = {
.name = "gpio-mpc8xxx",
.of_match_table = mpc8xxx_gpio_ids,
--
2.9.5
Powered by blists - more mailing lists