Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1303838rwb; Tue, 29 Nov 2022 11:36:28 -0800 (PST) X-Google-Smtp-Source: AA0mqf5kOwJmaubB59Ajy/5av2i6G8Vz0uB+M2LwhRNtjEhiRz4F2cjIJ74jDDAVS+cmlojlu0Q1 X-Received: by 2002:a17:906:17da:b0:7bb:d55e:417f with SMTP id u26-20020a17090617da00b007bbd55e417fmr23283052eje.13.1669750588543; Tue, 29 Nov 2022 11:36:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669750588; cv=none; d=google.com; s=arc-20160816; b=mYS9lNAMLMZlCoV0zOax5X9hyZ69hY6x2gNctUJ5Je+2sT/IGI4+P7JR3Yw8jVnmxk jBy/8GhSO2NT31qMctUNe2O5lRc970HyLkP7tZv/eCchS8IjHzlhKEoz29PzdwgETjH+ ZeLevmEAgpKCG+msofOTTuag4AUfXe8tAOMF8dU6uR47QhsplEf6rf9KY1YFYFfx7PqP EzWn2o0FP+VFiPjvZwsCAwcQSOYtMn8fSVBlSR9xBQ9oQhwT4TgRtVZuRwFC5UhsX8nL jbOdkJScd+2HUNDWfZiQbzBkOa0O59VHFVUAZIMYNoVEYDNlTzVnHHwo6iR7u9/VNhcS /GxQ== 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=3h4oSdyi2DbsUWXKmZBEiADc1xXo8dUgCVeZJAcvkys=; b=V3PTAND/aNz00TGG5hadhiZ7e3bMeTKGEPPkIud2zA6d/DlT3vwjxsPWpjyB956fTR wSLOJHVD3bS1o3/Z/FNAqaA+JKrZomXsQKxzbButmQEsHgB2vB248D3RHDnuxwMTFGiW rUdpfv6EFxP7mHZ+zCdEIRXphNv+0e1xvpdKyC9SJsQVlVhXvdxGDtYCPBizmflSTyqS 22Neth2wM1kDZeluBGh1fGTD3VxJQf+/mXax3ftHicJUtbjlBTo/Lk4om26SB+q0iVA5 Hs0MYfrHdj1JGgG1v0z3XyxAQ0rz/TtUwmimzrboOmyeL2eMNYIWYFP5q6k43gN7ZfiC REcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=VNXKY6qe; 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 hw19-20020a170907a0d300b0078e1d213812si10698103ejc.184.2022.11.29.11.36.07; Tue, 29 Nov 2022 11:36:28 -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=VNXKY6qe; 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 S236795AbiK2TUJ (ORCPT + 85 others); Tue, 29 Nov 2022 14:20:09 -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 S236785AbiK2TTY (ORCPT ); Tue, 29 Nov 2022 14:19:24 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC38D4B74B for ; Tue, 29 Nov 2022 11:19:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749481; 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=3h4oSdyi2DbsUWXKmZBEiADc1xXo8dUgCVeZJAcvkys=; b=VNXKY6qe3tntRfAt+sR5Q0jbeSupt1Y3NW7iQLe04Xwlsz03KUFJWn8P60YT6puBDyVvKn zaKoNBgxF/j6K+ZIlDVyCvz2S0F7dSIllvVoXg2Z6O1qSM0hc4HPVnxBszMSvc0sQxFti5 q+7kNakiF4k3ZXbDN3yEIVpxOJHxwfg= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Sam Ravnborg , Claudiu Beznea , Boris Brezillon , Nicolas Ferre , Alexandre Belloni , linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 08/26] drm: atmel-hlcdc: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:17:15 +0000 Message-Id: <20221129191733.137897-9-paul@crapouillou.net> In-Reply-To: <20221129191733.137897-1-paul@crapouillou.net> References: <20221129191733.137897-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 Acked-by: Sam Ravnborg Reviewed-by: Claudiu Beznea --- Cc: Sam Ravnborg Cc: Boris Brezillon Cc: Nicolas Ferre Cc: Alexandre Belloni Cc: Claudiu Beznea Cc: linux-arm-kernel@lists.infradead.org --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c index a2bb5b916235..4e806b06d35d 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c @@ -784,7 +784,6 @@ static int atmel_hlcdc_dc_drm_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP static int atmel_hlcdc_dc_drm_suspend(struct device *dev) { struct drm_device *drm_dev = dev_get_drvdata(dev); @@ -815,10 +814,10 @@ static int atmel_hlcdc_dc_drm_resume(struct device *dev) return drm_atomic_helper_resume(drm_dev, dc->suspend.state); } -#endif -static SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, - atmel_hlcdc_dc_drm_suspend, atmel_hlcdc_dc_drm_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_dc_drm_pm_ops, + atmel_hlcdc_dc_drm_suspend, + atmel_hlcdc_dc_drm_resume); static const struct of_device_id atmel_hlcdc_dc_of_match[] = { { .compatible = "atmel,hlcdc-display-controller" }, @@ -830,7 +829,7 @@ static struct platform_driver atmel_hlcdc_dc_platform_driver = { .remove = atmel_hlcdc_dc_drm_remove, .driver = { .name = "atmel-hlcdc-display-controller", - .pm = &atmel_hlcdc_dc_drm_pm_ops, + .pm = pm_sleep_ptr(&atmel_hlcdc_dc_drm_pm_ops), .of_match_table = atmel_hlcdc_dc_of_match, }, }; -- 2.35.1