Re: [PATCH v3 1/4] rtc: isl1208: enable interrupt after context preparation

2018-03-06 Thread Alexandre Belloni
On 05/03/2018 at 10:43:53 +, Denis OSTERLAND wrote:
> From: Michael Grzeschik 
> 
> 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.
> 
> Signed-off-by: Michael Grzeschik 
> Signed-off-by: Denis Osterland 
> ---
>  drivers/rtc/rtc-isl1208.c | 34 +-
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH v3 1/4] rtc: isl1208: enable interrupt after context preparation

2018-03-06 Thread Alexandre Belloni
On 05/03/2018 at 10:43:53 +, Denis OSTERLAND wrote:
> From: Michael Grzeschik 
> 
> 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.
> 
> Signed-off-by: Michael Grzeschik 
> Signed-off-by: Denis Osterland 
> ---
>  drivers/rtc/rtc-isl1208.c | 34 +-
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
Applied, thanks.

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH v3 1/4] rtc: isl1208: enable interrupt after context preparation

2018-03-05 Thread Denis OSTERLAND
From: Michael Grzeschik 

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.

Signed-off-by: Michael Grzeschik 
Signed-off-by: Denis Osterland 
---
 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 c8b4953..a13a4ba 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(>dev, client->irq, NULL,
-  isl1208_rtc_interrupt,
-  IRQF_SHARED | IRQF_ONESHOT,
-  isl1208_driver.driver.name,
-  client);
-   if (!rc) {
-   device_init_wakeup(>dev, 1);
-   enable_irq_wake(client->irq);
-   } else {
-   dev_err(>dev,
-   "Unable to request irq %d, no alarm support\n",
-   client->irq);
-   client->irq = 0;
-   }
-   }
-
rtc = devm_rtc_device_register(>dev, isl1208_driver.driver.name,
  _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(>dev, client->irq, NULL,
+  isl1208_rtc_interrupt,
+  IRQF_SHARED | IRQF_ONESHOT,
+  isl1208_driver.driver.name,
+  client);
+   if (!rc) {
+   device_init_wakeup(>dev, 1);
+   enable_irq_wake(client->irq);
+   } else {
+   dev_err(>dev,
+   "Unable to request irq %d, no alarm support\n",
+   client->irq);
+   client->irq = 0;
+   }
+   }
+
return 0;
 }
 
-- 
2.7.4


Diehl AKO Stiftung & Co. KG, Pfannerstraße 75-83, 88239 Wangen im Allgäu
Bereichsvorstand: Dr.-Ing. Michael Siedentop (Sprecher), Josef Fellner 
(Mitglied)
Sitz der Gesellschaft: Wangen i.A. – Registergericht: Amtsgericht Ulm HRA 
620609 – Persönlich haftende Gesellschafterin: Diehl Verwaltungs-Stiftung – 
Sitz: Nürnberg – Registergericht: Amtsgericht Nürnberg HRA 11756 –
Vorstand: Dr.-Ing. E.h. Thomas Diehl (†) (Vorsitzender), Herr 
Dipl.-Wirtsch.-Ing. Wolfgang Weggen (stellvertretender Vorsitzender), 
Dipl.-Kfm. Claus Günther, Dipl.-Kfm. Frank Gutzeit, Dr.-Ing. Heinrich Schunk, 
Dr.-Ing. Michael Siedentop , Dipl.-Kfm. Dr.-Ing. Martin Sommer, Dipl.-Ing. (FH) 
Rainer von Borstel, Vorsitzender des Aufsichtsrates: Dr. Klaus Maier
___
Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail 
enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten 
haben. Bitte loeschen Sie in diesem Fall die Nachricht. Jede unerlaubte Form 
der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation 
dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail 
contains confidential and/or legally protected information. Please inform us if 
you have received this e-mail by mistake and delete it in such a case. Each 
unauthorized reproduction, disclosure, alteration, distribution and/or 
publication of this e-mail is strictly prohibited.


[PATCH v3 1/4] rtc: isl1208: enable interrupt after context preparation

2018-03-05 Thread Denis OSTERLAND
From: Michael Grzeschik 

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.

Signed-off-by: Michael Grzeschik 
Signed-off-by: Denis Osterland 
---
 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 c8b4953..a13a4ba 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(>dev, client->irq, NULL,
-  isl1208_rtc_interrupt,
-  IRQF_SHARED | IRQF_ONESHOT,
-  isl1208_driver.driver.name,
-  client);
-   if (!rc) {
-   device_init_wakeup(>dev, 1);
-   enable_irq_wake(client->irq);
-   } else {
-   dev_err(>dev,
-   "Unable to request irq %d, no alarm support\n",
-   client->irq);
-   client->irq = 0;
-   }
-   }
-
rtc = devm_rtc_device_register(>dev, isl1208_driver.driver.name,
  _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(>dev, client->irq, NULL,
+  isl1208_rtc_interrupt,
+  IRQF_SHARED | IRQF_ONESHOT,
+  isl1208_driver.driver.name,
+  client);
+   if (!rc) {
+   device_init_wakeup(>dev, 1);
+   enable_irq_wake(client->irq);
+   } else {
+   dev_err(>dev,
+   "Unable to request irq %d, no alarm support\n",
+   client->irq);
+   client->irq = 0;
+   }
+   }
+
return 0;
 }
 
-- 
2.7.4


Diehl AKO Stiftung & Co. KG, Pfannerstraße 75-83, 88239 Wangen im Allgäu
Bereichsvorstand: Dr.-Ing. Michael Siedentop (Sprecher), Josef Fellner 
(Mitglied)
Sitz der Gesellschaft: Wangen i.A. – Registergericht: Amtsgericht Ulm HRA 
620609 – Persönlich haftende Gesellschafterin: Diehl Verwaltungs-Stiftung – 
Sitz: Nürnberg – Registergericht: Amtsgericht Nürnberg HRA 11756 –
Vorstand: Dr.-Ing. E.h. Thomas Diehl (†) (Vorsitzender), Herr 
Dipl.-Wirtsch.-Ing. Wolfgang Weggen (stellvertretender Vorsitzender), 
Dipl.-Kfm. Claus Günther, Dipl.-Kfm. Frank Gutzeit, Dr.-Ing. Heinrich Schunk, 
Dr.-Ing. Michael Siedentop , Dipl.-Kfm. Dr.-Ing. Martin Sommer, Dipl.-Ing. (FH) 
Rainer von Borstel, Vorsitzender des Aufsichtsrates: Dr. Klaus Maier
___
Der Inhalt der vorstehenden E-Mail ist nicht rechtlich bindend. Diese E-Mail 
enthaelt vertrauliche und/oder rechtlich geschuetzte Informationen.
Informieren Sie uns bitte, wenn Sie diese E-Mail faelschlicherweise erhalten 
haben. Bitte loeschen Sie in diesem Fall die Nachricht. Jede unerlaubte Form 
der Reproduktion, Bekanntgabe, Aenderung, Verteilung und/oder Publikation 
dieser E-Mail ist strengstens untersagt.
The contents of the above mentioned e-mail is not legally binding. This e-mail 
contains confidential and/or legally protected information. Please inform us if 
you have received this e-mail by mistake and delete it in such a case. Each 
unauthorized reproduction, disclosure, alteration, distribution and/or 
publication of this e-mail is strictly prohibited.