From: Alexandre Belloni <alexandre.belloni@free-electrons.com>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>
Cc: a.zummo@towertech.it, linux-rtc@vger.kernel.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux@roeck-us.net, jdelvare@suse.com, kernel@pengutronix.de,
Denis.Osterland@diehl.com
Subject: Re: [PATCH 3/4] rtc: isl1208: enable interrupt after context preparation
Date: Tue, 30 Jan 2018 11:34:21 +0100 [thread overview]
Message-ID: <20180130103421.GE2809@piout.net> (raw)
In-Reply-To: <20180123121801.4214-4-m.grzeschik@pengutronix.de>
Hi,
On 23/01/2018 at 13:18:00 +0100, Michael Grzeschik wrote:
> The interrupt handler got enabled very early. If the interrupt cause is
> triggering immediately before the context is fully prepared. This can
> lead to undefined behaviour. Therefor we move the interrupt enable code
> to the end of the probe function.
>
Can you fix it using devm_rtc_allocate_device()/rtc_register_device() as
done in https://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux.git/commit/?h=rtc-next&id=994ec64c0a193940be7a6fd074668b9446d3b6c3
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> Signed-off-by: Denis Osterland <Denis.Osterland@diehl.com>
> ---
> drivers/rtc/rtc-isl1208.c | 34 +++++++++++++++++-----------------
> 1 file changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/rtc/rtc-isl1208.c b/drivers/rtc/rtc-isl1208.c
> index c8b4953482296..a13a4ba79004d 100644
> --- a/drivers/rtc/rtc-isl1208.c
> +++ b/drivers/rtc/rtc-isl1208.c
> @@ -635,23 +635,6 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
> if (isl1208_i2c_validate_client(client) < 0)
> return -ENODEV;
>
> - if (client->irq > 0) {
> - rc = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> - isl1208_rtc_interrupt,
> - IRQF_SHARED | IRQF_ONESHOT,
> - isl1208_driver.driver.name,
> - client);
> - if (!rc) {
> - device_init_wakeup(&client->dev, 1);
> - enable_irq_wake(client->irq);
> - } else {
> - dev_err(&client->dev,
> - "Unable to request irq %d, no alarm support\n",
> - client->irq);
> - client->irq = 0;
> - }
> - }
> -
> rtc = devm_rtc_device_register(&client->dev, isl1208_driver.driver.name,
> &isl1208_rtc_ops,
> THIS_MODULE);
> @@ -674,6 +657,23 @@ isl1208_probe(struct i2c_client *client, const struct i2c_device_id *id)
> if (rc)
> return rc;
>
> + if (client->irq > 0) {
> + rc = devm_request_threaded_irq(&client->dev, client->irq, NULL,
> + isl1208_rtc_interrupt,
> + IRQF_SHARED | IRQF_ONESHOT,
> + isl1208_driver.driver.name,
> + client);
> + if (!rc) {
> + device_init_wakeup(&client->dev, 1);
> + enable_irq_wake(client->irq);
> + } else {
> + dev_err(&client->dev,
> + "Unable to request irq %d, no alarm support\n",
> + client->irq);
> + client->irq = 0;
> + }
> + }
> +
> return 0;
> }
>
> --
> 2.11.0
>
--
Alexandre Belloni, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
prev parent reply other threads:[~2018-01-30 10:34 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-23 12:17 [PATCH 0/4] rtc: isl1208: fixes, documentation and isl1219 support Michael Grzeschik
[not found] ` <20180123121801.4214-1-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2018-01-23 12:17 ` [PATCH 1/4] rtc: isl1208: Fix unintended clear of SR bits Michael Grzeschik
[not found] ` <20180123121801.4214-2-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2018-02-14 20:26 ` Alexandre Belloni
2018-02-15 7:27 ` Denis OSTERLAND
[not found] ` <1518679666.5448.4.camel-85mDkmTllUAAvxtiuMwx3w@public.gmane.org>
2018-02-15 8:30 ` Alexandre Belloni
2018-01-23 12:17 ` [PATCH 2/4] rtc: isl1208: Add device tree binding documentation Michael Grzeschik
2018-01-29 23:34 ` Rob Herring
2018-01-30 10:06 ` Alexandre Belloni
2018-01-23 12:18 ` [PATCH 4/4] rtc: isl1208: add support for isl1219 with hwmon for tamper detection Michael Grzeschik
[not found] ` <20180123121801.4214-5-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2018-01-23 18:22 ` Guenter Roeck
2018-01-24 9:03 ` Michael Grzeschik
2018-01-24 12:10 ` Michael Grzeschik
[not found] ` <20180124090333.r5o2mzpm4q536w4r-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2018-01-29 21:59 ` Guenter Roeck
2018-01-30 10:27 ` Alexandre Belloni
[not found] ` <20180130102740.GD2809-m++hUPXGwpdeoWH0uzbU5w@public.gmane.org>
2018-01-30 11:40 ` Denis OSTERLAND
[not found] ` <1517312409.5307.22.camel-85mDkmTllUAAvxtiuMwx3w@public.gmane.org>
2018-01-30 14:15 ` Guenter Roeck
2018-01-31 10:54 ` Alexandre Belloni
2018-01-29 23:41 ` Rob Herring
2018-01-30 8:56 ` Denis OSTERLAND
2018-01-30 14:41 ` Rob Herring
[not found] ` <CAL_JsqKEXtL0hvEgFALKaCgW2Go==wj14_dDomdK_hPU23oXLQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2018-01-30 14:44 ` Rob Herring
2018-01-23 12:18 ` [PATCH 3/4] rtc: isl1208: enable interrupt after context preparation Michael Grzeschik
2018-01-30 10:34 ` Alexandre Belloni [this message]
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=20180130103421.GE2809@piout.net \
--to=alexandre.belloni@free-electrons.com \
--cc=Denis.Osterland@diehl.com \
--cc=a.zummo@towertech.it \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=kernel@pengutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rtc@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=m.grzeschik@pengutronix.de \
/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).