From patchwork Thu Sep 6 15:55:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 10590785 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 4EFD5112B 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 451B82AEA5 for ; Thu, 6 Sep 2018 15:56:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 395CA2AEAA; 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 A455A2AE8B for ; Thu, 6 Sep 2018 15:56:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730427AbeIFUcI (ORCPT ); Thu, 6 Sep 2018 16:32:08 -0400 Received: from mailout1.w1.samsung.com ([210.118.77.11]:46877 "EHLO mailout1.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730394AbeIFUcH (ORCPT ); Thu, 6 Sep 2018 16:32:07 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout1.w1.samsung.com (KnoxPortal) with ESMTP id 20180906155558euoutp01de6c9929698f823532c6a88910e076b7~R2qbfUg1V1529515295euoutp01O; Thu, 6 Sep 2018 15:55:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.w1.samsung.com 20180906155558euoutp01de6c9929698f823532c6a88910e076b7~R2qbfUg1V1529515295euoutp01O DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1536249358; bh=kQIeyNC3ZImMir+NRNDhB5TnQKrBTAjvLPc3H6mRdGI=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=RiDNoaf1LK0419oqN8aUTVe/eIJdgmhJaMEDtA/6JPvmK6jTBVa3NB91UZTz2WxJb t3JdAZubPB/dg1LXkNVx+wF2CvX3lCt38NrN8aR1t4n/MWyCM36juWZ9aZR9sDydqA OkJYN+1z3y6wPBCsOKvWtDeZxbbCDwjftK+yjsIs= Received: from eusmges3new.samsung.com (unknown [203.254.199.245]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180906155557eucas1p16e685f158a3451d60df577337d3b6922~R2qbBLhX21224512245eucas1p16; 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 75.31.04806.D0E419B5; Thu, 6 Sep 2018 16:55:57 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a~R2qaDrcLd0455004550eucas1p2V; Thu, 6 Sep 2018 15:55:56 +0000 (GMT) X-AuditID: cbfec7f5-367ff700000012c6-99-5b914e0de17d Received: from eusync3.samsung.com ( [203.254.199.213]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 68.CE.04284.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 05/10] clk: samsung: s3c64xx: Use generic helper for handling suspend/resume Date: Thu, 06 Sep 2018 17:55:27 +0200 Message-id: <20180906155532.4085-6-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+NgFlrIIsWRmVeSWpSXmKPExsWy7djP87q8fhOjDSb8FrTYOGM9q8X1L89Z Lc6f38Bu8bHnHqvFjPP7mCzWHrnLbtH+9CWzA7vHplWdbB59W1YxenzeJBfAHMVlk5Kak1mW WqRvl8CV8X1JP3tBh1TFlNnfWBsYv4h2MXJySAiYSEyYtoy9i5GLQ0hgBaPEqUlP2SCcz4wS Pfe62GCq3sw9wAqRWMYosW7CZiYIp4FJ4uu7U0wgVWwChhJdbyE6RAQcJD5/es0IUsQs8JhR YuvJr8wgCWGBRIk1H3eyg9gsAqoSX7+vZ+li5ODgFbCRuLy1EGKbvMTqDQfAyjkFbCVmzO0E 2ywh8JNV4t6vb6wQRS4SzxZdhTpPWOLV8S3sELaMRGfHQSaIhmZGifYZs9ghnB6gK+bsgOqw ljh8/CLYJGYBPolJ26Yzg1whIcAr0dEmBFHiIfHxy2WonycAA+P0FtYJjJILGBlWMYqnlhbn pqcWG+ellusVJ+YWl+al6yXn525iBEbc6X/Hv+5g3Pcn6RCjAAejEg/vA6OJ0UKsiWXFlbmH GCU4mJVEeN2rJ0QL8aYkVlalFuXHF5XmpBYfYpTmYFES5+XTSosWEkhPLEnNTk0tSC2CyTJx cEo1MGZsrDh08lvm4eYt++N71PoPRz6Nbi33sf9jk9m4jL9kp5kej8TBJNf0zGamRPGbqysT HGd/Sv29TsWjXaCBy+pC1/z77+sWdz3Xk+Db28Wnrfvjj0u/T3S5l3RHSsIp5WS/y6G2D89H qM76kaWpw3Xt4vv7jwuPck3ZtqNMc+Kh77w79+zZpMRSnJFoqMVcVJwIALn+VgO0AgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t/xq7o8fhOjDVrPq1hsnLGe1eL6l+es FufPb2C3+Nhzj9Vixvl9TBZrj9xlt2h/+pLZgd1j06pONo++LasYPT5vkgtgjuKySUnNySxL LdK3S+DK+L6kn72gQ6piyuxvrA2MX0S7GDk5JARMJN7MPcDaxcjFISSwhFHiZutmKKeJSaLx zgEmkCo2AUOJrrddbCC2iICDxOdPrxlBipgFHjNKnFu8gRUkISyQKLHm4052EJtFQFXi6/f1 LF2MHBy8AjYSl7cWQmyTl1i94QAziM0pYCsxY24nWKsQUMmqximsExh5FjAyrGIUSS0tzk3P LTbUK07MLS7NS9dLzs/dxAgMlG3Hfm7ewXhpY/AhRgEORiUeXgvTidFCrIllxZW5hxglOJiV RHjdqydEC/GmJFZWpRblxxeV5qQWH2KU5mBREuc9b1AZJSSQnliSmp2aWpBaBJNl4uCUamBU 9JRtuba8h/e5TLltPePzawucmC8vqVn/LHLpldq6Ha+NN/18V/qaec6RF5Oj9hbNnckj++nR xospzx7zuIZkH1AX2Xjg7hzBJQeTM78cLT3aGbSoSkhDL/Hlk1Lm0sBDB0r8g6Y6WB/denf5 +u1OF2Zs0ujPO75vIc/beRYfXm3Zfvds5b7Nu5RYijMSDbWYi4oTAQ2Lg9QQAgAA X-CMS-MailID: 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180906155556eucas1p2546c6d2fa7d42bad8ea021aea249752a 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-s3c64xx.c | 66 +++---------------------------- 1 file changed, 6 insertions(+), 60 deletions(-) diff --git a/drivers/clk/samsung/clk-s3c64xx.c b/drivers/clk/samsung/clk-s3c64xx.c index 6db01cf5ab83..329a449f78c3 100644 --- a/drivers/clk/samsung/clk-s3c64xx.c +++ b/drivers/clk/samsung/clk-s3c64xx.c @@ -12,7 +12,6 @@ #include #include #include -#include #include @@ -59,10 +58,6 @@ static void __iomem *reg_base; static bool is_s3c6400; -#ifdef CONFIG_PM_SLEEP -static struct samsung_clk_reg_dump *s3c64xx_save_common; -static struct samsung_clk_reg_dump *s3c64xx_save_soc; - /* * List of controller registers to be saved and restored during * a suspend/resume cycle. @@ -89,60 +84,6 @@ static unsigned long s3c6410_clk_regs[] __initdata = { MEM0_GATE, }; -static int s3c64xx_clk_suspend(void) -{ - samsung_clk_save(reg_base, s3c64xx_save_common, - ARRAY_SIZE(s3c64xx_clk_regs)); - - if (!is_s3c6400) - samsung_clk_save(reg_base, s3c64xx_save_soc, - ARRAY_SIZE(s3c6410_clk_regs)); - - return 0; -} - -static void s3c64xx_clk_resume(void) -{ - samsung_clk_restore(reg_base, s3c64xx_save_common, - ARRAY_SIZE(s3c64xx_clk_regs)); - - if (!is_s3c6400) - samsung_clk_restore(reg_base, s3c64xx_save_soc, - ARRAY_SIZE(s3c6410_clk_regs)); -} - -static struct syscore_ops s3c64xx_clk_syscore_ops = { - .suspend = s3c64xx_clk_suspend, - .resume = s3c64xx_clk_resume, -}; - -static void __init s3c64xx_clk_sleep_init(void) -{ - s3c64xx_save_common = samsung_clk_alloc_reg_dump(s3c64xx_clk_regs, - ARRAY_SIZE(s3c64xx_clk_regs)); - if (!s3c64xx_save_common) - goto err_warn; - - if (!is_s3c6400) { - s3c64xx_save_soc = samsung_clk_alloc_reg_dump(s3c6410_clk_regs, - ARRAY_SIZE(s3c6410_clk_regs)); - if (!s3c64xx_save_soc) - goto err_soc; - } - - register_syscore_ops(&s3c64xx_clk_syscore_ops); - return; - -err_soc: - kfree(s3c64xx_save_common); -err_warn: - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", - __func__); -} -#else -static void __init s3c64xx_clk_sleep_init(void) {} -#endif - /* List of parent clocks common for all S3C64xx SoCs. */ PNAME(spi_mmc_p) = { "mout_epll", "dout_mpll", "fin_pll", "clk27m" }; PNAME(uart_p) = { "mout_epll", "dout_mpll" }; @@ -508,7 +449,12 @@ void __init s3c64xx_clk_init(struct device_node *np, unsigned long xtal_f, samsung_clk_register_alias(ctx, s3c64xx_clock_aliases, ARRAY_SIZE(s3c64xx_clock_aliases)); - s3c64xx_clk_sleep_init(); + + samsung_clk_sleep_init(reg_base, s3c64xx_clk_regs, + ARRAY_SIZE(s3c64xx_clk_regs)); + if (!is_s3c6400) + samsung_clk_sleep_init(reg_base, s3c6410_clk_regs, + ARRAY_SIZE(s3c6410_clk_regs)); samsung_clk_of_add_provider(np, ctx);