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: 146103 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp38456ljw; Thu, 6 Sep 2018 08:56:01 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZSCzAxuFOKEfG6rrC3/S/ZpyBzytMPAdJhPk3NQ+juBYDauaapafO3wNQ3M7T+S7RHLriV X-Received: by 2002:a63:4d21:: with SMTP id a33-v6mr3458412pgb.408.1536249360990; Thu, 06 Sep 2018 08:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536249360; cv=none; d=google.com; s=arc-20160816; b=KwpoIXHuTdcBW6dI5+NNo1MAhGPd+IzafMXLCdadIK9UMsiarADOZCZKU9/e8pE+wQ 4OsdB2OljddHBXbLurJp04xPCRKSTZhDAA1ibOh8JXT+91wdGn3iTwk4vYOBvpRZ25Ah 8zMWYgfrEWBj8i7Mo63wbCTKyCb+9nZMly8zELY7XEDQl9576kFDCsOztOO3JPEzsUgJ q9J3okKRLHbc6ecB+C9QQmjBVD7S5IKx1DtnS3xTOG0mOkgSY7wROATeN6TYf2fB/tDi VJMHtJ/uPTOsd5H/QfwJzupK1SJnqzONfNB5Cy957bf7lxKXfv6N8+0VQnGops7cMP47 rz9g== 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=+a8K72v2pIeHACaCg/9dKVqnSWhHUiL1oB4K2zKw2Ik=; b=wC/8UhUlFoohmzFExMQC+1qPVFwJflDPYE7mmCEdtgpUIewrVpgmcFPnTYeNWU39mu mRgq1L4cBe/EvgIhZhF0Iq8pmItUFaXg8UmKmoH6etf1dEKqBDfg1u++bTWcBdNtijrO mPaBWDEAc9ZPgqDb5Iby+ZSEmU2jg0zQ2tcbDcqOkey5NySYkcC3lIaIf1zklmPKB/aY /53U+QTC44tRtrC23mD287CttMT9XzCzfLoyGDNEUsvsBo8qjE1w4Qg3iJv35xSsXhIZ sT+uA7MMNviCYDbo5jCjXGq7MofOWomRZZ5GEJGWQtZEpYsHJ3lGeC8G1X4aNngwjE78 sXOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=UKziCdkG; 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.00; Thu, 06 Sep 2018 08:56:00 -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=UKziCdkG; 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 S1730426AbeIFUcH (ORCPT + 3 others); 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-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-s3c2412.c | 43 ++----------------------------- 1 file changed, 2 insertions(+), 41 deletions(-) -- 2.17.1 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);