From patchwork Mon Nov 7 17:52:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 16618 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2202017wru; Mon, 7 Nov 2022 09:57:02 -0800 (PST) X-Google-Smtp-Source: AMsMyM4kMFjKsZPiDVN5gtPpRmOTD/mZ2ZxTVKkLXGu83eRulOyDagNGjUM4DdS8vyPw8YjivQK/ X-Received: by 2002:a63:6bc5:0:b0:460:bd9a:64b8 with SMTP id g188-20020a636bc5000000b00460bd9a64b8mr45198096pgc.257.1667843822504; Mon, 07 Nov 2022 09:57:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843822; cv=none; d=google.com; s=arc-20160816; b=JezzAjWFDK1Uc+T8Z1++xUkZIffmXyG2LzuXWXaNdpRNQ+0Y9vI/BZGWJ9pMvx6eMU CI9hvWjcrTkwW7mJai9m4/QUn2Vs8Q8yBozaBPK1CPBTkZNRYLvXLh2CT8nAyYfu+cTx IwSyGL0BKbnO+Sn+TmtMVQzdB1e8uLe7O2m4/O1/ysGOyKOhYPCHpLkzHXcMiTXXyCZ4 2irq+axUvvX8+DCDY1IAn69Uz9UeyXhSWTRKXtBgMTMmoy8JlcXeV7xkslwupZ/o8D2I uSBXn/svYi68qBRrRgXvfCQywS4RtUUnie2EInPXy+r0MDJ9QvH3cb4vXofiVIEv1j5u 6xLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=xCJ8ZGsBKBthoKA4jzLPBZ2ybOb/+gNvRRdW1QwBz4Y=; b=IbxQRigdcCPpkGiaR0arFsnvg9c4L/2yA+0e8ra3PCHUL+92xPdf6VYysFP3S71aj9 dlErsQyN169DDk+dv+TcP7bHcFQOHhkib6+pUOynXpDzScO3YUwt3g8/oN2VdKKDoMmZ 8NBFAOrDvKCMVrEHIrrC3S4NPovgRrcAW0mClJnRZPEWD4kjnB+wqnfehk8g+fjGCXxf e1WP8E+4BWzTCMgdKtWm1xwhTfuW6/wCTFD9QjeAM/FBtELxCIP8vWcg9mzQbkltkbNj mpBU64jKW2VNV1hgKGa8Pu9qJQtQQwn0J/L7ieEVRBf8mVfiu79hOoEc0auluQo3OQxW NL/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="x/cHs9n2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y9-20020a170902700900b001870edc9b10si10316488plk.380.2022.11.07.09.56.48; Mon, 07 Nov 2022 09:57:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="x/cHs9n2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=crapouillou.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232985AbiKGR4G (ORCPT + 99 others); Mon, 7 Nov 2022 12:56:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232745AbiKGRyl (ORCPT ); Mon, 7 Nov 2022 12:54:41 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9852724964; Mon, 7 Nov 2022 09:54:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843593; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xCJ8ZGsBKBthoKA4jzLPBZ2ybOb/+gNvRRdW1QwBz4Y=; b=x/cHs9n23E7v0YHvlDCnlvm5lAxyTNY8LuZdAnJgsMnlHn7GFX3CrEwVo8nVDfdzrpwSlO yyJsTchR+f58Ymg5S70kxHNP28/T3Sey+nowqoSYIloJpjPz63x99ppQTGwrXXl2HKtRzZ KrksU6FRmue0BZFvuTDnrdil5MimVUM= From: Paul Cercueil To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Laurent Pinchart , Kieran Bingham , linux-renesas-soc@vger.kernel.org Subject: [PATCH 19/26] drm: shmobile: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:52:49 +0000 Message-Id: <20221107175256.360839-9-paul@crapouillou.net> In-Reply-To: <20221107175256.360839-1-paul@crapouillou.net> References: <20221107175106.360578-1-paul@crapouillou.net> <20221107175256.360839-1-paul@crapouillou.net> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748861003596395201?= X-GMAIL-MSGID: =?utf-8?q?1748861003596395201?= Use the DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros to handle the .suspend/.resume callbacks. These macros allow the suspend and resume functions to be automatically dropped by the compiler when CONFIG_SUSPEND is disabled, without having to use #ifdef guards. This has the advantage of always compiling these functions in, independently of any Kconfig option. Thanks to that, bugs and other regressions are subsequently easier to catch. Signed-off-by: Paul Cercueil Reviewed-by: Kieran Bingham --- Cc: Laurent Pinchart Cc: Kieran Bingham Cc: linux-renesas-soc@vger.kernel.org --- drivers/gpu/drm/shmobile/shmob_drm_drv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c index 3d511fa38913..337040fa6438 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c @@ -143,7 +143,6 @@ static const struct drm_driver shmob_drm_driver = { * Power management */ -#ifdef CONFIG_PM_SLEEP static int shmob_drm_pm_suspend(struct device *dev) { struct shmob_drm_device *sdev = dev_get_drvdata(dev); @@ -165,11 +164,9 @@ static int shmob_drm_pm_resume(struct device *dev) drm_kms_helper_poll_enable(sdev->ddev); return 0; } -#endif -static const struct dev_pm_ops shmob_drm_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(shmob_drm_pm_suspend, shmob_drm_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(shmob_drm_pm_ops, + shmob_drm_pm_suspend, shmob_drm_pm_resume); /* ----------------------------------------------------------------------------- * Platform driver @@ -292,7 +289,7 @@ static struct platform_driver shmob_drm_platform_driver = { .remove = shmob_drm_remove, .driver = { .name = "shmob-drm", - .pm = &shmob_drm_pm_ops, + .pm = pm_sleep_ptr(&shmob_drm_pm_ops), }, };