clk: samsung: s3c2412: Use generic helper for handling suspend/resume

Replace common suspend/resume handling code by generic helper.
Almost no functional change, the only difference is in handling
of hypothetical memory allocation failure on boot.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Sylwester Nawrocki <snawrocki@kernel.org>
This commit is contained in:
Marek Szyprowski 2018-09-06 17:55:25 +02:00 committed by Sylwester Nawrocki
parent 6bdac3b4c4
commit 1b3493d755
1 changed files with 2 additions and 41 deletions

View File

@ -11,7 +11,6 @@
#include <linux/clk-provider.h> #include <linux/clk-provider.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/of_address.h> #include <linux/of_address.h>
#include <linux/syscore_ops.h>
#include <linux/reboot.h> #include <linux/reboot.h>
#include <dt-bindings/clock/s3c2412.h> #include <dt-bindings/clock/s3c2412.h>
@ -29,9 +28,6 @@
static void __iomem *reg_base; static void __iomem *reg_base;
#ifdef CONFIG_PM_SLEEP
static struct samsung_clk_reg_dump *s3c2412_save;
/* /*
* list of controller registers to be saved and restored during a * list of controller registers to be saved and restored during a
* suspend/resume cycle. * suspend/resume cycle.
@ -45,42 +41,6 @@ static unsigned long s3c2412_clk_regs[] __initdata = {
CLKSRC, CLKSRC,
}; };
static int s3c2412_clk_suspend(void)
{
samsung_clk_save(reg_base, s3c2412_save,
ARRAY_SIZE(s3c2412_clk_regs));
return 0;
}
static void s3c2412_clk_resume(void)
{
samsung_clk_restore(reg_base, s3c2412_save,
ARRAY_SIZE(s3c2412_clk_regs));
}
static struct syscore_ops s3c2412_clk_syscore_ops = {
.suspend = s3c2412_clk_suspend,
.resume = s3c2412_clk_resume,
};
static void __init s3c2412_clk_sleep_init(void)
{
s3c2412_save = samsung_clk_alloc_reg_dump(s3c2412_clk_regs,
ARRAY_SIZE(s3c2412_clk_regs));
if (!s3c2412_save) {
pr_warn("%s: failed to allocate sleep save data, no sleep support!\n",
__func__);
return;
}
register_syscore_ops(&s3c2412_clk_syscore_ops);
return;
}
#else
static void __init s3c2412_clk_sleep_init(void) {}
#endif
static struct clk_div_table divxti_d[] = { static struct clk_div_table divxti_d[] = {
{ .val = 0, .div = 1 }, { .val = 0, .div = 1 },
{ .val = 1, .div = 2 }, { .val = 1, .div = 2 },
@ -278,7 +238,8 @@ void __init s3c2412_common_clk_init(struct device_node *np, unsigned long xti_f,
samsung_clk_register_alias(ctx, s3c2412_aliases, samsung_clk_register_alias(ctx, s3c2412_aliases,
ARRAY_SIZE(s3c2412_aliases)); ARRAY_SIZE(s3c2412_aliases));
s3c2412_clk_sleep_init(); samsung_clk_sleep_init(reg_base, s3c2412_clk_regs,
ARRAY_SIZE(s3c2412_clk_regs));
samsung_clk_of_add_provider(np, ctx); samsung_clk_of_add_provider(np, ctx);