From patchwork Thu Sep 6 15:55:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590795 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 C220614BD 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 B5D902AE86 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AA4BA2AE90; 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=ham 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 44E7A2AE8B for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730358AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46872 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730389AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155557euoutp0171951b2a94ddc0507eaf3e8f9e7794bf~R2qa-VvLW1529315293euoutp01U; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155557euoutp0171951b2a94ddc0507eaf3e8f9e7794bf~R2qa-VvLW1529315293euoutp01U DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249357; bh=VGEaPtZRW2v0h9vmhjnQR67U2fTUUB34E+GMkkQq6BU=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=WKdy3PXjYJWSWeHQTFqGPTEHZmbNMKcc+mpoLyOjlapFopefqKnqJsIOJJj8HHsh/ qxNabqKPe8iUFpTCqpTXWp3Df7+8kd2aiqjiSYwbeoU8R6Ojt4ELl8yLX2zeO6/xEG iCC/rWxrxa7ewpnNF1byfNE9GRCihIo2NmvnkHwQ= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p13a98fc7af9753a993eb2ffe353aa0b2e~R2qajWQeL1224912249eucas1p19; Thu, 6 Sep 2018 15:55:57 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges3new.samsung.com (EUCPMTA) with SMTP id F4.31.04806.C0E419B5; Thu, 6 Sep 2018 16:55:56 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2~R2qZxpoCk2540625406eucas1p2I; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) X-AuditID: cbfec7f5-34dff700000012c6-98-5b914e0c284a Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 28.DC.04128.C0E419B5; Thu, 6 Sep 2018 16:55:56 +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:56 +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 04/10] clk: samsung: s3c2443: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:26 +0200 Message-id: <20180906155532.4085-5-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+NgFlrAIsWRmVeSWpSXmKPExsWy7djP87o8fhOjDXa0G1lsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DK6Lx5kq3gm3DFk+uPWRoYbwp0MXJwSAiYSDzbp9HFyMUhJLCCUeJk5ycmCOczo8SP 6XeZuxg5wYp+b+5nA7GFBJYxSpw7ww9R1MAk8fXdKSaQBJuAoUTX2y6wIhEBB4nPn14zghQx CzxmlNh68ivYJGGBRImdH2+wg9gsAqoSrdN+sYLYvAI2Ev335zBCbJOXWL3hAFg9p4CtxIy5 nawggyQEvrJK/L5xBOokF4kznUvYIWxhiVfHt0DZMhKXJ3ezQDQ0M0q0z5jFDuH0AJ0xZwcb RJW1xOHjF8FWMwvwSUzaNp0ZEhq8Eh1tQhAlHhITvy1lg/hzAqPE2TUXWCcwSi5gZFjFKJ5a WpybnlpsnJdarlecmFtcmpeul5yfu4kRGG+n/x3/uoNx35+kQ4wCHIxKPLwPjCZGC7EmlhVX 5h5ilOBgVhLhda+eEC3Em5JYWZValB9fVJqTWnyIUZqDRUmcl08rLVpIID2xJDU7NbUgtQgm y8TBKdXAOIF7hw63yz+DD8J111X/XrevfODK/We+Fsfz+ISNjZq/+45s7fQ7m7A1wH7XsqaQ HWddV8w/42QjVesmI3l8forrJ/5o//5158I2/K9kz79t73o9qPhsK9fH2/YfDbb2TXo7aZ3o mntCb09xmLRzSta+2FG54Kd2R+tapetbRaf5err224XZKbEUZyQaajEXFScCAOBlNWWzAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrHJMWRmVeSWpSXmKPExsVy+t/xq7o8fhOjDbYu4rfYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV0XnzJFvBN+GKJ9cfszQw3hToYuTkkBAwkfi9uZ+ti5GLQ0hgCaPEin+rmSGcJiaJ xjsHmECq2AQMJbredrGB2CICDhKfP71mBCliFnjMKHFu8QZWkISwQKLEzo832EFsFgFVidZp v8DivAI2Ev335zBCrJOXWL3hADOIzSlgKzFjbidYjRBQzarGKawTGHkWMDKsYhRJLS3OTc8t NtIrTswtLs1L10vOz93ECAyVbcd+btnB2PUu+BCjAAejEg+vhenEaCHWxLLiytxDjBIczEoi vO7VE6KFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8543qIwSEkhPLEnNTk0tSC2CyTJxcEo1MM5x dzDpWhS/Lr531V2jYOcjlr059SYKHz5Xl+4sPHjmXp2t4s/9H3vO5U/s22fF/zov6aqZv+CT Qg0xX9aKCzdbGHX81s/3PbxUJrVwft2b6h9HVq3d5iv943dEymeWjBWuEpI9b9g38B3nOPVG qrN4mZ3flOe6pUx2N7h4l/mGa6UcbogzVGIpzkg01GIuKk4EAGhW+ZMRAgAA X-CMS-MailID: 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155556eucas1p26cc9f85524938192ea01bde8e1b977e2 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-s3c2443.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c2443.c b/drivers/clk/samsung/clk-s3c2443.c index c46e6d5bc9bc..884067e4f1a1 100644 --- a/drivers/clk/samsung/clk-s3c2443.c +++ b/drivers/clk/samsung/clk-s3c2443.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -43,9 +42,6 @@ enum supported_socs { static void __iomem *reg_base; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c2443_save; - /* * list of controller registers to be saved and restored during a * suspend/resume cycle. @@ -65,42 +61,6 @@ static unsigned long s3c2443_clk_regs[] __initdata = { SCLKCON, }; -static int s3c2443_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c2443_save, - ARRAY_SIZE(s3c2443_clk_regs)); - - return 0; -} - -static void s3c2443_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c2443_save, - ARRAY_SIZE(s3c2443_clk_regs)); -} - -static struct syscore_ops s3c2443_clk_syscore_ops = { - .suspend = s3c2443_clk_suspend, - .resume = s3c2443_clk_resume, -}; - -static void __init s3c2443_clk_sleep_init(void) -{ - s3c2443_save = samsung_clk_alloc_reg_dump(s3c2443_clk_regs, - ARRAY_SIZE(s3c2443_clk_regs)); - if (!s3c2443_save) { - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); - return; - } - - register_syscore_ops(&s3c2443_clk_syscore_ops); - return; -} -#else -static void __init s3c2443_clk_sleep_init(void) {} -#endif - PNAME(epllref_p) = { "mpllref", "mpllref", "xti", "ext" }; PNAME(esysclk_p) = { "epllref", "epll" }; PNAME(mpllref_p) = { "xti", "mdivclk" }; @@ -450,7 +410,8 @@ void __init s3c2443_common_clk_init(struct device_node *np, unsigned long xti_f, break; } - s3c2443_clk_sleep_init(); + samsung_clk_sleep_init(reg_base, s3c2443_clk_regs, + ARRAY_SIZE(s3c2443_clk_regs)); samsung_clk_of_add_provider(np, ctx);