From patchwork Thu Sep 6 15:55:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590787 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6D83B1669 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 62E6F287D2 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 575962AEA5; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 35D20287D2 for ; Thu, 6 Sep 2018 15:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730351AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:59519 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730304AbeIFUcG (ORCPT ); Thu, 6 Sep 2018 16:32:06 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155557euoutp0273b9071db898d02014252665a9da0965~R2qa-BCB63136531365euoutp028; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180906155557euoutp0273b9071db898d02014252665a9da0965~R2qa-BCB63136531365euoutp028 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249357; bh=+a8K72v2pIeHACaCg/9dKVqnSWhHUiL1oB4K2zKw2Ik=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=UKziCdkGDp9tpykSayfPtOYCrhIWduOIVnQ8i+JbQ3uyJoI6FxBa/EbozeOE8XuaG urbo304U9uTUszPLEEk6rUbK0ZTFT6GMbUlZOuH1egFNSEywa7Q7/IMOHy5cyzE6fQ AQ0TLo/9y/pa6cXgv3fPz60giElepIJpcjE/kFMM= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p2ab0604012b5873a2a99e732259c2b994~R2qaXRGEe2541725417eucas1p2J; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id A8.85.04441.C0E419B5; Thu, 6 Sep 2018 16:55:56 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55~R2qZZ_Q7k0610806108eucas1p2h; Thu, 6 Sep 2018 15:55:55 +0000 (GMT) X-AuditID: cbfec7f2-5e3ff70000001159-0d-5b914e0c04f5 Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 97.CE.04284.B0E419B5; Thu, 6 Sep 2018 16:55:55 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync3.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PEN009IJ5L4PE10@eusync3.samsung.com>; Thu, 06 Sep 2018 16:55:55 +0100 (BST) From: Marek Szyprowski To: linux-clk@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Sylwester Nawrocki , Chanwoo Choi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH v2 03/10] clk: samsung: s3c2412: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:25 +0200 Message-id: <20180906155532.4085-4-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180906155532.4085-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEIsWRmVeSWpSXmKPExsWy7djPc7o8fhOjDfrXqVhsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DKuH1iBXvBT+GKmb+mMDYwXhXoYuTkkBAwkfj37ABzFyMXh5DACkaJE91X2SGcz4wS H6euYoGp+vvnJ1RiGaPE0V232SCcBiaJmf+vsYFUsQkYSnS97QKzRQQcJD5/es0IUsQs8JhR YuvJr8wgCWGBRIn+nUvBbBYBVYnPTWvYQWxeARuJ6cc+s0Gsk5dYveEAWA2ngK3EjLmdrCCD JAR+skr0LfjFClHkItH57waULSzx6vgWdghbRqKz4yATREMzo0T7jFnsEE4P0BlzdkCtsJY4 fPwiWDezAJ/EpG3TgdZxAMV5JTrahCBKPCRmtLVBg2YCo8Sji/+YJzBKLmBkWMUonlpanJue WmyYl1quV5yYW1yal66XnJ+7iREYc6f/Hf+0g/HrpaRDjAIcjEo8vA+MJkYLsSaWFVfmHmKU 4GBWEuF1r54QLcSbklhZlVqUH19UmpNafIhRmoNFSZyXTystWkggPbEkNTs1tSC1CCbLxMEp 1cBYl5SuumRC1FTmDwvbz2/u3frmvbON2fy9vBa2016e3cm/+uKfRSXcH/YHn12lf/W+qg+P ej6/p6xy3sMZO9K6ezYtNTnfsOGhhtfkSu/gcymimosOdab1rPKoYTW6ef1v1Lnm+Xd/qWxt Eb19kXvHlvdHVeOO/5w2+cFSjnlOQa2BwbJsLjXnlViKMxINtZiLihMBnUredrUCAAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t/xq7rcfhOjDdZ8NbPYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CVcfvECvaCn8IVM39NYWxgvCrQxcjJISFgIvH3z092EFtIYAmjxLfXwV2MXEB2E5NE y8LZTCAJNgFDia63XWwgtoiAg8TnT68ZQYqYBR4zSpxbvIEVJCEskCjRv3MpM4jNIqAq8blp DdhUXgEbienHPrNBbJOXWL3hAFgNp4CtxIy5nawQm20kVjVOYZ3AyLOAkWEVo0hqaXFuem6x oV5xYm5xaV66XnJ+7iZGYKBsO/Zz8w7GSxuDDzEKcDAq8fBamE6MFmJNLCuuzD3EKMHBrCTC 6149IVqINyWxsiq1KD++qDQntfgQozQHi5I473mDyighgfTEktTs1NSC1CKYLBMHp1QDo+P0 RQsverV+mLp1YWn2yYMHDok/1Vsfmr1B1+CjXdhyzh2iVjbtl/+efvHIwm7/vq+983KkMwRW HTi0WfJRU1jx6bUTGKR92dax3lx2qPv633RjizOrEx/1m/DNjDyk3sH19JnB2uRa5oe9kQ47 ehnv31RN7bx6SG310XXcYdLLdpUIeGc2NCqxFGckGmoxFxUnAgBdHpL/EAIAAA== X-CMS-MailID: 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155555eucas1p209b1988a1a1bf42298f1f1e483f47b55 References: <20180906155532.4085-1-m.szyprowski@samsung.com> Sender: linux-clk-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Acked-by: Chanwoo Choi Reviewed-by: Krzysztof Kozlowski --- drivers/clk/samsung/clk-s3c2412.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2412.c b/drivers/clk/samsung/clk-s3c2412.c index 6bc94d3aff78..dd1159050a5a 100644 --- a/drivers/clk/samsung/clk-s3c2412.c +++ b/drivers/clk/samsung/clk-s3c2412.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -29,9 +28,6 @@ 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 * suspend/resume cycle. @@ -45,42 +41,6 @@ static unsigned long s3c2412_clk_regs[] __initdata = { 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[] = { { .val = 0, .div = 1 }, { .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, 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);