All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
@ 2013-04-16  8:30 ` Peter Ujfalusi
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2013-04-16  8:30 UTC (permalink / raw)
  To: Alessandro Zummo, Tony Lindgren
  Cc: rtc-linux, linux-kernel, linux-omap, Christoph Fritz,
	Grygorii Strashko, Tomi Valkeinen

Initialize the rtc_reg_map in platform_driver's probe function instead at
module_init time. This way we can make sure that the twl-core has been already
probed and initialized (twl_priv->twl_id is valid) since the platform device
for the RTC driver will be created by the twl-core after it finished it's
init.

Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi,

As Tomi commented on the first version:
www.spinics.net/lists/linux-omap/msg90064.html
www.spinics.net/lists/linux-omap/msg90066.html

I have separated the actual fix from the module_platform_driver() conversion.

Regards,
Peter

 drivers/rtc/rtc-twl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 8bc6c80..c385e9b 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		goto out1;
 
+	/* Initialize the register map */
+	if (twl_class_is_4030())
+		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
+	else
+		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
+
 	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		goto out1;
@@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
 
 static int __init twl_rtc_init(void)
 {
-	if (twl_class_is_4030())
-		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
-	else
-		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
-
 	return platform_driver_register(&twl4030rtc_driver);
 }
 module_init(twl_rtc_init);
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
@ 2013-04-16  8:30 ` Peter Ujfalusi
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2013-04-16  8:30 UTC (permalink / raw)
  To: Alessandro Zummo, Tony Lindgren
  Cc: rtc-linux, linux-kernel, linux-omap, Christoph Fritz,
	Grygorii Strashko, Tomi Valkeinen

Initialize the rtc_reg_map in platform_driver's probe function instead at
module_init time. This way we can make sure that the twl-core has been already
probed and initialized (twl_priv->twl_id is valid) since the platform device
for the RTC driver will be created by the twl-core after it finished it's
init.

Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi,

As Tomi commented on the first version:
www.spinics.net/lists/linux-omap/msg90064.html
www.spinics.net/lists/linux-omap/msg90066.html

I have separated the actual fix from the module_platform_driver() conversion.

Regards,
Peter

 drivers/rtc/rtc-twl.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 8bc6c80..c385e9b 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
 	if (irq <= 0)
 		goto out1;
 
+	/* Initialize the register map */
+	if (twl_class_is_4030())
+		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
+	else
+		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
+
 	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
 	if (ret < 0)
 		goto out1;
@@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
 
 static int __init twl_rtc_init(void)
 {
-	if (twl_class_is_4030())
-		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
-	else
-		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
-
 	return platform_driver_register(&twl4030rtc_driver);
 }
 module_init(twl_rtc_init);
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] RTC: rtc-twl: Cleanup with module_platform_driver() conversion
  2013-04-16  8:30 ` Peter Ujfalusi
@ 2013-04-16  8:30   ` Peter Ujfalusi
  -1 siblings, 0 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2013-04-16  8:30 UTC (permalink / raw)
  To: Alessandro Zummo, Tony Lindgren
  Cc: rtc-linux, linux-kernel, linux-omap, Christoph Fritz,
	Grygorii Strashko, Tomi Valkeinen

Use module_platform_driver() to register the platform driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/rtc/rtc-twl.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index c385e9b..22b2fd6 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -618,17 +618,7 @@ static struct platform_driver twl4030rtc_driver = {
 	},
 };
 
-static int __init twl_rtc_init(void)
-{
-	return platform_driver_register(&twl4030rtc_driver);
-}
-module_init(twl_rtc_init);
-
-static void __exit twl_rtc_exit(void)
-{
-	platform_driver_unregister(&twl4030rtc_driver);
-}
-module_exit(twl_rtc_exit);
+module_platform_driver(twl4030rtc_driver);
 
 MODULE_AUTHOR("Texas Instruments, MontaVista Software");
 MODULE_LICENSE("GPL");
-- 
1.8.1.5


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2 2/2] RTC: rtc-twl: Cleanup with module_platform_driver() conversion
@ 2013-04-16  8:30   ` Peter Ujfalusi
  0 siblings, 0 replies; 9+ messages in thread
From: Peter Ujfalusi @ 2013-04-16  8:30 UTC (permalink / raw)
  To: Alessandro Zummo, Tony Lindgren
  Cc: rtc-linux, linux-kernel, linux-omap, Christoph Fritz,
	Grygorii Strashko, Tomi Valkeinen

Use module_platform_driver() to register the platform driver.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 drivers/rtc/rtc-twl.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index c385e9b..22b2fd6 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -618,17 +618,7 @@ static struct platform_driver twl4030rtc_driver = {
 	},
 };
 
-static int __init twl_rtc_init(void)
-{
-	return platform_driver_register(&twl4030rtc_driver);
-}
-module_init(twl_rtc_init);
-
-static void __exit twl_rtc_exit(void)
-{
-	platform_driver_unregister(&twl4030rtc_driver);
-}
-module_exit(twl_rtc_exit);
+module_platform_driver(twl4030rtc_driver);
 
 MODULE_AUTHOR("Texas Instruments, MontaVista Software");
 MODULE_LICENSE("GPL");
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
  2013-04-16  8:30 ` Peter Ujfalusi
@ 2013-06-05 11:49   ` Grygorii Strashko
  -1 siblings, 0 replies; 9+ messages in thread
From: Grygorii Strashko @ 2013-06-05 11:49 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
	linux-omap, Christoph Fritz, Tomi Valkeinen

Hi Peter,

Tested on OMAP4460 SDP - see no issues during boot.

-grygorii

On 04/16/2013 11:30 AM, Peter Ujfalusi wrote:
> Initialize the rtc_reg_map in platform_driver's probe function instead at
> module_init time. This way we can make sure that the twl-core has been already
> probed and initialized (twl_priv->twl_id is valid) since the platform device
> for the RTC driver will be created by the twl-core after it finished it's
> init.
>
> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> Hi,
>
> As Tomi commented on the first version:
> www.spinics.net/lists/linux-omap/msg90064.html
> www.spinics.net/lists/linux-omap/msg90066.html
>
> I have separated the actual fix from the module_platform_driver() conversion.
>
> Regards,
> Peter
>
>   drivers/rtc/rtc-twl.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 8bc6c80..c385e9b 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
>   	if (irq <= 0)
>   		goto out1;
>   
> +	/* Initialize the register map */
> +	if (twl_class_is_4030())
> +		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
> +	else
> +		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
> +
>   	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
>   	if (ret < 0)
>   		goto out1;
> @@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
>   
>   static int __init twl_rtc_init(void)
>   {
> -	if (twl_class_is_4030())
> -		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
> -	else
> -		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
> -
>   	return platform_driver_register(&twl4030rtc_driver);
>   }
>   module_init(twl_rtc_init);


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
@ 2013-06-05 11:49   ` Grygorii Strashko
  0 siblings, 0 replies; 9+ messages in thread
From: Grygorii Strashko @ 2013-06-05 11:49 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
	linux-omap, Christoph Fritz, Tomi Valkeinen

Hi Peter,

Tested on OMAP4460 SDP - see no issues during boot.

-grygorii

On 04/16/2013 11:30 AM, Peter Ujfalusi wrote:
> Initialize the rtc_reg_map in platform_driver's probe function instead at
> module_init time. This way we can make sure that the twl-core has been already
> probed and initialized (twl_priv->twl_id is valid) since the platform device
> for the RTC driver will be created by the twl-core after it finished it's
> init.
>
> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> ---
> Hi,
>
> As Tomi commented on the first version:
> www.spinics.net/lists/linux-omap/msg90064.html
> www.spinics.net/lists/linux-omap/msg90066.html
>
> I have separated the actual fix from the module_platform_driver() conversion.
>
> Regards,
> Peter
>
>   drivers/rtc/rtc-twl.c | 11 ++++++-----
>   1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 8bc6c80..c385e9b 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
>   	if (irq <= 0)
>   		goto out1;
>   
> +	/* Initialize the register map */
> +	if (twl_class_is_4030())
> +		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
> +	else
> +		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
> +
>   	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
>   	if (ret < 0)
>   		goto out1;
> @@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
>   
>   static int __init twl_rtc_init(void)
>   {
> -	if (twl_class_is_4030())
> -		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
> -	else
> -		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
> -
>   	return platform_driver_register(&twl4030rtc_driver);
>   }
>   module_init(twl_rtc_init);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
  2013-04-16  8:30 ` Peter Ujfalusi
@ 2013-06-05 18:03   ` Kevin Hilman
  -1 siblings, 0 replies; 9+ messages in thread
From: Kevin Hilman @ 2013-06-05 18:03 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
	linux-omap, Christoph Fritz, Grygorii Strashko, Tomi Valkeinen

Peter Ujfalusi <peter.ujfalusi@ti.com> writes:

> Initialize the rtc_reg_map in platform_driver's probe function instead at
> module_init time. This way we can make sure that the twl-core has been already
> probed and initialized (twl_priv->twl_id is valid) since the platform device
> for the RTC driver will be created by the twl-core after it finished it's
> init.
>
> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Tested-by: Kevin Hilman <khilman@linaro.org>

Confirmed this fixes some init problems when using DT boot on OMAP3.

Peter, you might want to resend (with acks collected) and be sure that
it's sent to Andrew Morton who is maintaining drivers/rtc currently.

Kevin

> ---
> Hi,
>
> As Tomi commented on the first version:
> www.spinics.net/lists/linux-omap/msg90064.html
> www.spinics.net/lists/linux-omap/msg90066.html
>
> I have separated the actual fix from the module_platform_driver() conversion.
>
> Regards,
> Peter
>
>  drivers/rtc/rtc-twl.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 8bc6c80..c385e9b 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
>  	if (irq <= 0)
>  		goto out1;
>  
> +	/* Initialize the register map */
> +	if (twl_class_is_4030())
> +		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
> +	else
> +		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
> +
>  	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
>  	if (ret < 0)
>  		goto out1;
> @@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
>  
>  static int __init twl_rtc_init(void)
>  {
> -	if (twl_class_is_4030())
> -		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
> -	else
> -		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
> -
>  	return platform_driver_register(&twl4030rtc_driver);
>  }
>  module_init(twl_rtc_init);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization
@ 2013-06-05 18:03   ` Kevin Hilman
  0 siblings, 0 replies; 9+ messages in thread
From: Kevin Hilman @ 2013-06-05 18:03 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
	linux-omap, Christoph Fritz, Grygorii Strashko, Tomi Valkeinen

Peter Ujfalusi <peter.ujfalusi@ti.com> writes:

> Initialize the rtc_reg_map in platform_driver's probe function instead at
> module_init time. This way we can make sure that the twl-core has been already
> probed and initialized (twl_priv->twl_id is valid) since the platform device
> for the RTC driver will be created by the twl-core after it finished it's
> init.
>
> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Tested-by: Kevin Hilman <khilman@linaro.org>

Confirmed this fixes some init problems when using DT boot on OMAP3.

Peter, you might want to resend (with acks collected) and be sure that
it's sent to Andrew Morton who is maintaining drivers/rtc currently.

Kevin

> ---
> Hi,
>
> As Tomi commented on the first version:
> www.spinics.net/lists/linux-omap/msg90064.html
> www.spinics.net/lists/linux-omap/msg90066.html
>
> I have separated the actual fix from the module_platform_driver() conversion.
>
> Regards,
> Peter
>
>  drivers/rtc/rtc-twl.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
> index 8bc6c80..c385e9b 100644
> --- a/drivers/rtc/rtc-twl.c
> +++ b/drivers/rtc/rtc-twl.c
> @@ -469,6 +469,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
>  	if (irq <= 0)
>  		goto out1;
>  
> +	/* Initialize the register map */
> +	if (twl_class_is_4030())
> +		rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
> +	else
> +		rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
> +
>  	ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
>  	if (ret < 0)
>  		goto out1;
> @@ -614,11 +620,6 @@ static struct platform_driver twl4030rtc_driver = {
>  
>  static int __init twl_rtc_init(void)
>  {
> -	if (twl_class_is_4030())
> -		rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
> -	else
> -		rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
> -
>  	return platform_driver_register(&twl4030rtc_driver);
>  }
>  module_init(twl_rtc_init);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2 2/2] RTC: rtc-twl: Cleanup with module_platform_driver() conversion
  2013-04-16  8:30   ` Peter Ujfalusi
  (?)
@ 2013-06-05 18:05   ` Kevin Hilman
  -1 siblings, 0 replies; 9+ messages in thread
From: Kevin Hilman @ 2013-06-05 18:05 UTC (permalink / raw)
  To: Peter Ujfalusi
  Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, LKML, linux-omap,
	Christoph Fritz, Grygorii Strashko, Tomi Valkeinen

On Tue, Apr 16, 2013 at 1:30 AM, Peter Ujfalusi <peter.ujfalusi@ti.com> wrote:
> Use module_platform_driver() to register the platform driver.
>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

Acked-by: Kevin Hilman <khilman@linaro.org>

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-06-05 18:05 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-16  8:30 [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization Peter Ujfalusi
2013-04-16  8:30 ` Peter Ujfalusi
2013-04-16  8:30 ` [PATCH v2 2/2] RTC: rtc-twl: Cleanup with module_platform_driver() conversion Peter Ujfalusi
2013-04-16  8:30   ` Peter Ujfalusi
2013-06-05 18:05   ` Kevin Hilman
2013-06-05 11:49 ` [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization Grygorii Strashko
2013-06-05 11:49   ` Grygorii Strashko
2013-06-05 18:03 ` Kevin Hilman
2013-06-05 18:03   ` Kevin Hilman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.