Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2201717rwb; Mon, 7 Nov 2022 10:19:29 -0800 (PST) X-Google-Smtp-Source: AMsMyM4Y8FLqdeB17NLTdXEiOH15VeX5LPQd0xZIETb81hrdYg6lCWmqq/iVx1+I2CEp0wmqlfwf X-Received: by 2002:a17:907:9688:b0:7a5:74eb:d12b with SMTP id hd8-20020a170907968800b007a574ebd12bmr49916658ejc.60.1667845169560; Mon, 07 Nov 2022 10:19:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667845169; cv=none; d=google.com; s=arc-20160816; b=B5CMKfSdsYXU4+pKrFVlM9QDpw5cCo4qgkxQLrS651a7XuDRxs5fPOGoSrrxhWXnB/ VwwnkhILWdmyecl9Q8ArDnbqH9eVXN1AgQV57eqbTXf3e2nJzSI/3EBu7mFA2oQnfdEX +gWwnA4J+5XDzKvBvhHe/Xaj0eTTYQ2avdVbFaHCti9/o/GXZMiaHzYyO8Id+2wRcAGP ZKXyATN3/D7qjvSA3hUiFTpJPYEtz2fuWJ15DwURCRGINhbDGbICudZeUujQDeAAR+hD xaBf7r4OO5iQT3sNYitkROXsXMB3KUKeVD2zZ/bkxGevPHFKuG2vRZn0nEjXnGjP4FfP ohMQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ew5-20020a056402538500b00460ba005641si8891231edb.171.2022.11.07.10.19.07; Mon, 07 Nov 2022 10:19:29 -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 + 93 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 Content-Transfer-Encoding: 8bit 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 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 --- 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), }, }; -- 2.35.1