Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1348731rwb; Tue, 29 Nov 2022 12:17:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf5sBREQ1hNlnuvXNWZqpqmQ4+aBnXjTxDYzZGhb1mOROGOxplK7JXPVtV0rx652r3P7mXXw X-Received: by 2002:a17:906:a050:b0:78d:47c8:e80f with SMTP id bg16-20020a170906a05000b0078d47c8e80fmr49828732ejb.700.1669753045156; Tue, 29 Nov 2022 12:17:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669753045; cv=none; d=google.com; s=arc-20160816; b=KHluWx9JlWChWgmI+RFWVvVGxZEh/w1BoZY8hdCG6Xuvb/db/nXDBUesMutUnDrh+E HUV2An1CeBYKbHXgeA1qTeQwah3sqGVUkIVxvrq3JsTNw8CkejJEQzAzvdRs0nYtMhB0 Pr8JGhVptwb5qOxcrG5xYazVeRTLyFywMfWEYoEuXfqxBpCPMdRcjepypP3BUP7xIzsx hcbdsPZO9KAZWT9jEe14rlCTtiGmcWRv+ToFlu3uXhNpno6ZMFoWrW3q/Q2ipg9ssThB Mprdo9L5g2i3F3C2CeI0ld44IVuZdZ5dz3PdTKRHgoE/CoID0jk9WnndKIY30futYToN wcwg== 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=93KzSvS5igs3S+cAbvCYD4WLcuFTokGvoynUcK5Icnw=; b=sdX8IjZyR2FPEA0EiZCunmRWjLxWxI7PW4XS0AUvWhCHzM+eKHOheVvYffVNI2OQ9t CMT1hD87s21u1lt8hwr6uzR+oNRM206XU7nJxYhnmHJDsjmM7tpy2mK56SinKja15ql3 bFWP1hsMLH/bQIuE9r5gZNUJqbHbORR0jw5A4RJ111EtCcHGLxpIZQj6ZzJ/Efs11nYB KAdKd+vCTrAMSzaeyN/qwhVuQFlLbkPBab6HY1xexCoF1e51D8yBizyhlO6T1/AnCa0Z JustMn5CNhMQOSdU9hjzlHmFGCa8N/iuglfQob0Gcb800BD3UGP3A/UddIfC5Nbw4D9D deHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=vF6P0PbF; 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 g8-20020a056402090800b0046900e66a54si13861648edz.517.2022.11.29.12.17.04; Tue, 29 Nov 2022 12:17:25 -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=vF6P0PbF; 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 S236897AbiK2TXD (ORCPT + 84 others); Tue, 29 Nov 2022 14:23:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236931AbiK2TWl (ORCPT ); Tue, 29 Nov 2022 14:22:41 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F8D26F82F; Tue, 29 Nov 2022 11:20:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749598; 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=93KzSvS5igs3S+cAbvCYD4WLcuFTokGvoynUcK5Icnw=; b=vF6P0PbFzl3XQTIIeBBWk33b7nBsalJsw5sWVgBOpfAglBFB67FxzQSWsQwUrn2sbPwcof PDY5kynsihQ8MxQeQgm+f5SiDXDvYvV/eVpATZ8/VubDNplHqon2MmXPAUM8vuVxOUCMkq AZkSjDXGGJMWeM8hlCJbk6T5DeNVhzY= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Kieran Bingham , Laurent Pinchart , linux-renesas-soc@vger.kernel.org Subject: [PATCH v2 19/26] drm: shmobile: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:35 +0000 Message-Id: <20221129191942.138244-6-paul@crapouillou.net> In-Reply-To: <20221129191942.138244-1-paul@crapouillou.net> References: <20221129191733.137897-1-paul@crapouillou.net> <20221129191942.138244-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 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), }, }; -- 2.35.1