diff options
author | Bengt Jonsson <bengt.g.jonsson@stericsson.com> | 2011-12-06 09:04:10 +0100 |
---|---|---|
committer | Philippe Langlais <philippe.langlais@stericsson.com> | 2012-05-22 10:59:23 +0200 |
commit | ea9fbfb194e2d833436519f4309c4e113c10daa5 (patch) | |
tree | 8b2c0e68335b81a9fb2a5d4e1116d7809b75e73e | |
parent | 7f9b91b56e6d3b0898dcb43247ed9c9a544d3279 (diff) |
regulator: ab8500: Init debug from regulator driver
The purpose of this patch is to guarantee that
debug (regulator/ab8500-debug.c) will record the
regulator registers before they are modified by
the driver (regulator/ab8500.c).
ST-Ericsson ID: 402732
ST-Ericsson Linux next: -
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: Ie4cae023b7ed0f07b70049282b2f2cf9d4c06f15
Signed-off-by: Bengt Jonsson <bengt.g.jonsson@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/42186
Reviewed-by: QABUILD
Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
-rw-r--r-- | drivers/regulator/ab8500-debug.c | 31 | ||||
-rw-r--r-- | drivers/regulator/ab8500.c | 23 |
2 files changed, 25 insertions, 29 deletions
diff --git a/drivers/regulator/ab8500-debug.c b/drivers/regulator/ab8500-debug.c index feda450c53d..16dad8f06dd 100644 --- a/drivers/regulator/ab8500-debug.c +++ b/drivers/regulator/ab8500-debug.c @@ -1687,7 +1687,7 @@ static struct dentry *ab8500_regulator_dump_file; static struct dentry *ab8500_regulator_status_file; static struct dentry *ab8500_regulator_suspend_force_file; -static int __devinit ab8500_regulator_debug_probe(struct platform_device *plf) +int __devinit ab8500_regulator_debug_init(struct platform_device *plf) { void __iomem *boot_info_backupram; int ret; @@ -1761,7 +1761,7 @@ exit_no_debugfs: return -ENOMEM; } -static int __devexit ab8500_regulator_debug_remove(struct platform_device *plf) +int __devexit ab8500_regulator_debug_exit(struct platform_device *plf) { debugfs_remove(ab8500_regulator_suspend_force_file); debugfs_remove(ab8500_regulator_status_file); @@ -1771,33 +1771,6 @@ static int __devexit ab8500_regulator_debug_remove(struct platform_device *plf) return 0; } -static struct platform_driver ab8500_regulator_debug_driver = { - .driver = { - .name = "ab8500-regulator-debug", - .owner = THIS_MODULE, - }, - .probe = ab8500_regulator_debug_probe, - .remove = __devexit_p(ab8500_regulator_debug_remove), -}; - -static int __init ab8500_regulator_debug_init(void) -{ - int ret; - - ret = platform_driver_register(&ab8500_regulator_debug_driver); - if (ret) - pr_err("Failed to register ab8500 regulator: %d\n", ret); - - return ret; -} -subsys_initcall(ab8500_regulator_debug_init); - -static void __exit ab8500_regulator_debug_exit(void) -{ - platform_driver_unregister(&ab8500_regulator_debug_driver); -} -module_exit(ab8500_regulator_debug_exit); - MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Bengt Jonsson <bengt.g.jonsson@stericsson.com"); MODULE_DESCRIPTION("AB8500 Regulator Debug"); diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c index 9d7547cd7f1..24cb3f1030b 100644 --- a/drivers/regulator/ab8500.c +++ b/drivers/regulator/ab8500.c @@ -1063,6 +1063,19 @@ static struct ab8500_reg_init ab8500_reg_init[] = { REG_INIT(AB8500_REGUCTRLDISCH2, 0x04, 0x44, 0x1f), }; +/* Possibility to add debug */ +int __attribute__((weak)) ab8500_regulator_debug_init( + struct platform_device *pdev) +{ + return 0; +} + +int __attribute__((weak)) ab8500_regulator_debug_exit( + struct platform_device *pdev) +{ + return 0; +} + static __devinit int ab8500_regulator_probe(struct platform_device *pdev) { struct ab8500 *ab8500 = dev_get_drvdata(pdev->dev.parent); @@ -1093,6 +1106,11 @@ static __devinit int ab8500_regulator_probe(struct platform_device *pdev) return -EINVAL; } + /* initialize debug (initial state is recorded with this call) */ + err = ab8500_regulator_debug_init(pdev); + if (err) + return err; + /* initialize registers */ for (i = 0; i < pdata->num_reg_init; i++) { int id; @@ -1210,6 +1228,11 @@ static __devexit int ab8500_regulator_remove(struct platform_device *pdev) if (err) return err; + /* remove regulator debug */ + err = ab8500_regulator_debug_exit(pdev); + if (err) + return err; + return 0; } |