RTC: s3c: Initialize driver data before using it
Subsystems (2)
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/2 RTC: s3c: Initialize driver data before using it
s3c_rtc_setfreq() uses the platform driver data to derive struct rtc_device, so make sure drvdata is set _before_ s3c_rtc_setfreq() is called.
--- drivers/rtc/rtc-s3c.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/rtc/rtc-s3c.c +3 -2
@@ -495,8 +495,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)pr_debug ("s3c2410_rtc: RTCCON=%02x\n" ,readb (s3c_rtc_base +S3C2410_RTCCON )); -s3c_rtc_setfreq (&pdev->dev,1 ); -device_init_wakeup (&pdev->dev,1 );/* register RTC and exit */
@@ -518,6 +516,9 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) s3c_rtc_cpu_type =platform_get_device_id (pdev)->driver_data;platform_set_drvdata (pdev, rtc); + +s3c_rtc_setfreq (&pdev->dev,1 ); +return 0 ; err_nortc:
Signature · 1 line
1.7.1
Quoted 22 lines · On Thu, 27 May 2010 23:28:45 +0200 Maurus Cuelenaere <[email protected]>…
s3c_rtc_setfreq()uses the platform driver data to derive structrtc_device, so make sure drvdata is set _before_s3c_rtc_setfreq()is called.Signed-off-by Maurus Cuelenaere <[email protected]>--- drivers/rtc/rtc-s3c.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)drivers/rtc/rtc-s3c.c +0
-2@@ -495,8 +495,6 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)pr_debug ("s3c2410_rtc: RTCCON=%02x\n" ,readb (s3c_rtc_base +S3C2410_RTCCON )); -s3c_rtc_setfreq (&pdev->dev,1 ); -device_init_wakeup (&pdev->dev,1 );/* register RTC and exit */
drivers/rtc/rtc-s3c.c static int __devinit s3c_rtc_probe(struct platform_device *pdev) · line 524
Quoted 9 lines
drivers/rtc/rtc-s3c.c +3
-0@@ -518,6 +516,9 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) s3c_rtc_cpu_type =platform_get_device_id (pdev)->driver_data;platform_set_drvdata (pdev, rtc); + +s3c_rtc_setfreq (&pdev->dev,1 ); +return 0 ; err_nortc:
This one I tagged for a -stable backport.
PATCH 2/2 RTC: s3c: Initialize s3c_rtc_cpu_type before using it
In reply to a message not in the archiveMake sure s3c_rtc_cpu_type is initialised _before_ it's used in an if() check.
This was probably caused due to a merge mistake.
--- drivers/rtc/rtc-s3c.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-s3c.c +2 -2
@@ -508,13 +508,13 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) goto err_nortc; } + s3c_rtc_cpu_type =platform_get_device_id (pdev)->driver_data; +if (s3c_rtc_cpu_type ==TYPE_S3C64XX ) rtc->max_user_freq =32768 ;else rtc->max_user_freq =128 ; - s3c_rtc_cpu_type =platform_get_device_id (pdev)->driver_data; -platform_set_drvdata (pdev, rtc);s3c_rtc_setfreq (&pdev->dev,1 );
Signature · 1 line
1.7.1
Re: [PATCH 2/2] RTC: s3c: Initialize s3c_rtc_cpu_type before using it
Quoted 3 lines · On Thu, 27 May 2010 23:28:47 +0200 Maurus Cuelenaere <[email protected]>…
Make sure
s3c_rtc_cpu_typeis initialised _before_ it's used in anif()check.This was probably caused due to a merge mistake.
Nope, I went back to your original email:
@@ -471,7 +509,12 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev)
goto err_nortc;
}- rtc->max_user_freq = 128;
+ if (s3c_rtc_cpu_type == TYPE_S3C64XX)
+ rtc->max_user_freq = 32768;
+ else
+ rtc->max_user_freq = 128;
+
+ s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
Re: [PATCH 2/2] RTC: s3c: Initialize s3c_rtc_cpu_type before using it
Op 27-05-10 23:52, Andrew Morton schreef:
Quoted 13 lines
Quoted 4 lines · On Thu, 27 May 2010 23:28:47 +0200 Maurus Cuelenaere <[email protected]>…
Make sure
s3c_rtc_cpu_typeis initialised _before_ it's used in anif()check.This was probably caused due to a merge mistake.
Nope, I went back to your original email:
(quoted diff) +0
-0@@ -471,7 +509,12 @@ static int __devinit s3c_rtc_probe(struct platform_device *pdev) goto err_nortc;
Review static int __devinit s3c_rtc_probe(struct · line 519
Quoted 10 lines
(quoted diff) +6
-1} - rtc->max_user_freq = 128; + if (s3c_rtc_cpu_type == TYPE_S3C64XX) + rtc->max_user_freq = 32768; + else + rtc->max_user_freq = 128; + + s3c_rtc_cpu_type = platform_get_device_id(pdev)->driver_data;
Hmm, odd. Ok, I apologize for this (obvious) mistake then.
Signature · 1 line
Maurus Cuelenaere