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: 146105 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp38471ljw; Thu, 6 Sep 2018 08:56:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZs4nq3UJVlKkwZH/4jWXQ73EYUuxCOz34B3ByfmYJExXPpH1zS2dXa5PmCMcnGohNWT+QT X-Received: by 2002:a63:c347:: with SMTP id e7-v6mr3520442pgd.240.1536249362272; Thu, 06 Sep 2018 08:56:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536249362; cv=none; d=google.com; s=arc-20160816; b=sGFGodoh92PeSMM5GN37ZkKp1v+3TPxZLtJBvjuqIcvo4NtIwYbsRiS0Qrw2EVprGY ND2Rb8AErvrCB8aJ7W5fwKScCMXEJvaWzr6RyX4hL9rNK5YnTFaYVnKvrnS1aCljC7lu ynSRrx77TriOEfL9xqhj/7ovZEi9BPWgnikGTKdKrxPiPoLNc12FacxwmJE7ltBsXfX1 cIe5fcruiuDMNTOyP2ulcwGtRnh1/O5WSqthKpvsQnGPp8L2K48S4cd1o/4+Pk06qR2k e0kb0Q1lypsBFX9tfmktZkXYxicuTOMRvvpXiRQMa4qs8C+i2Hq9n+6Op7aZfk2tNbC3 RNWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=kQIeyNC3ZImMir+NRNDhB5TnQKrBTAjvLPc3H6mRdGI=; b=S7zlwmwEXG5K87maljAoKLSEoEKJwDob0EsJrBbXNatmpSQyto9Lkqk2WxynWxwHnq yRuS5T1noSdlkq7AYE8OSJVaa4RtTjcGmUW9k0d6EwJsVbIVcZrtYdoBSyzPxkpsky6d NPgANmBCXxcZZwm/Qume0ZluHqo/q33u0Qt/iJsjPjFAryYkRUt8vzHWF20wLWJquv8+ zFIRbx4mLQVg3txm/I2C+25ArYNQK3H3PJBpf/CgTbkB0cNgSHeVoFWKukL3ASC4hMwo FuiG4q3ATBgOwnOCOtB6Rwl7nf2ILuHAbbdROlFHY0hmC4+d/SuGOaA6mj+LJPbyEitC OllA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RiDNoaf1; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k18-v6si5180597pff.91.2018.09.06.08.56.02; Thu, 06 Sep 2018 08:56:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=RiDNoaf1; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730443AbeIFUcI (ORCPT + 3 others); 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-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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(-) -- 2.17.1 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);