* [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init
@ 2013-04-16 7:44 Peter Ujfalusi
2013-04-16 8:10 ` Tomi Valkeinen
0 siblings, 1 reply; 3+ messages in thread
From: Peter Ujfalusi @ 2013-04-16 7:44 UTC (permalink / raw)
To: Alessandro Zummo, Tony Lindgren
Cc: rtc-linux, linux-kernel, linux-omap, Christoph Fritz,
Grygorii Strashko
Convert the driver to use module_platform_driver() to register the platform
driver and relocate the rtc_reg_map initialization to platform driver's
probe function.
In this way we can make sure that the twl-core has been already probed since
the core driver will create the device at the end of it's probe function.
Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
Hi Tony, Alessandro, Christoph,
I think this patch is the correct solution for the issue Christoph reported:
http://www.spinics.net/lists/linux-omap/msg89980.html
We can make sure that the twl-core has been already probed and initialized when
the RTC driver tries to pick the correct register map.
Regards,
Peter
drivers/rtc/rtc-twl.c | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 8bc6c80..22b2fd6 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;
@@ -612,22 +618,7 @@ 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);
-
-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] 3+ messages in thread
* Re: [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init
2013-04-16 7:44 [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init Peter Ujfalusi
@ 2013-04-16 8:10 ` Tomi Valkeinen
2013-04-16 8:16 ` Peter Ujfalusi
0 siblings, 1 reply; 3+ messages in thread
From: Tomi Valkeinen @ 2013-04-16 8:10 UTC (permalink / raw)
To: Peter Ujfalusi
Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
linux-omap, Christoph Fritz, Grygorii Strashko
Hi,
On 2013-04-16 10:44, Peter Ujfalusi wrote:
> Convert the driver to use module_platform_driver() to register the platform
> driver and relocate the rtc_reg_map initialization to platform driver's
> probe function.
> In this way we can make sure that the twl-core has been already probed since
> the core driver will create the device at the end of it's probe function.
>
> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
I think there are two distinct things here. The actual fix for the
regmap, and a module_platform_driver cleanup. I would suggest having
them in separate patches.
And even if these are combined, I think the patch subject and
description should talk about fixing the regmap bug. Now it's rather
unclear that an actual bug is being fixed.
Tomi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init
2013-04-16 8:10 ` Tomi Valkeinen
@ 2013-04-16 8:16 ` Peter Ujfalusi
0 siblings, 0 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2013-04-16 8:16 UTC (permalink / raw)
To: Tomi Valkeinen
Cc: Alessandro Zummo, Tony Lindgren, rtc-linux, linux-kernel,
linux-omap, Christoph Fritz, Grygorii Strashko
Hi Tomi,
On 04/16/2013 10:10 AM, Tomi Valkeinen wrote:
> Hi,
>
> On 2013-04-16 10:44, Peter Ujfalusi wrote:
>> Convert the driver to use module_platform_driver() to register the platform
>> driver and relocate the rtc_reg_map initialization to platform driver's
>> probe function.
>> In this way we can make sure that the twl-core has been already probed since
>> the core driver will create the device at the end of it's probe function.
>>
>> Reported-by: Christoph Fritz <chf.fritz@googlemail.com>
>> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
>
> I think there are two distinct things here. The actual fix for the
> regmap, and a module_platform_driver cleanup. I would suggest having
> them in separate patches.
>
> And even if these are combined, I think the patch subject and
> description should talk about fixing the regmap bug. Now it's rather
> unclear that an actual bug is being fixed.
Good point. My thinking was that when I convert the driver to
module_platform_driver() the reg map init must be moved to platform_driver's
probe anyways.
I'll separate the patch and write a bit better commit message for the first.
--
Péter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-04-16 8:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-16 7:44 [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init Peter Ujfalusi
2013-04-16 8:10 ` Tomi Valkeinen
2013-04-16 8:16 ` Peter Ujfalusi
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).