diff mbox

Re: [PATCH] rtc: rv3029c2: Fix potential race condition

Message ID e6ca72fc-421c-4b68-9b26-1f174504c6ec@googlegroups.com
State Rejected
Headers show

Commit Message

bjoernschrader1980@gmail.com July 2, 2014, 7:41 a.m. UTC
Hello,
is it possible to set the flag "uie_unsupported" in the rtc_driver-struct 
of this driver?
As far as I see there is no real Interrupt handling in the driver, or do I 
miss something?

This would solve a problem with the command "hwclock" waiting for an 
Interrupt to get the sub-second time which times out.
If the mentioned flag is set the command will try to get the correct offset 
on its own by reading the RTC very often until the time jumps to the next 
second. There is also an emulation like this in the kernel itself 
(RTC_INTF_DEV_UIE_EMUL) which is enabled by setting this Flag (and 
configuring the mentioned Option in the configuration, of course.)

Would be as easy as:

And solves the hwclock problems to me.

Thanks and regards
Björn Schrader

Am Montag, 24. März 2014 09:26:38 UTC+1 schrieb Gregory Hermant:
>
> RTC drivers must not return an error after 
> device registration. 
>
> Acked-by: Alessandro Zummo <a.z...@towertech.it <javascript:>> 
> Signed-off-by: Gregory Hermant <gregory...@calao-systems.com <javascript:>> 
>
> --- 
>  drivers/rtc/rtc-rv3029c2.c |   12 ++++++------ 
>  1 file changed, 6 insertions(+), 6 deletions(-) 
>
> diff --git a/drivers/rtc/rtc-rv3029c2.c b/drivers/rtc/rtc-rv3029c2.c 
> index 1a779a6..e9ac5a4 100644 
> --- a/drivers/rtc/rtc-rv3029c2.c 
> +++ b/drivers/rtc/rtc-rv3029c2.c 
> @@ -395,6 +395,12 @@ static int rv3029c2_probe(struct i2c_client *client, 
>          if (!i2c_check_functionality(client->adapter, 
> I2C_FUNC_SMBUS_EMUL)) 
>                  return -ENODEV; 
>   
> +        rc = rv3029c2_i2c_get_sr(client, buf); 
> +        if (rc < 0) { 
> +                dev_err(&client->dev, "reading status failed\n"); 
> +                return rc; 
> +        } 
> + 
>          rtc = devm_rtc_device_register(&client->dev, client->name, 
>                                          &rv3029c2_rtc_ops, THIS_MODULE); 
>   
> @@ -403,12 +409,6 @@ static int rv3029c2_probe(struct i2c_client *client, 
>   
>          i2c_set_clientdata(client, rtc); 
>   
> -        rc = rv3029c2_i2c_get_sr(client, buf); 
> -        if (rc < 0) { 
> -                dev_err(&client->dev, "reading status failed\n"); 
> -                return rc; 
> -        } 
> - 
>          return 0; 
>  } 
>   
> -- 
> 1.7.9.5 
>
>
diff mbox

Patch

--- rtc-rv3029c2.c.old  2014-06-26 18:04:03.000000000 +0000
+++ rtc-rv3029c2.c      2014-07-01 18:37:55.000000000 +0000
@@ -408,6 +408,8 @@ 
                dev_err(&client->dev, "reading status failed\n");
                return rc;
        }
+
+        rtc->uie_unsupported = 1;

        return 0;
 }