From patchwork Tue Nov 29 19:17:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 27427 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp524148wrr; Tue, 29 Nov 2022 11:21:07 -0800 (PST) X-Google-Smtp-Source: AA0mqf7CJ86acrILUrxFY/SMYppUzoxZGpvw6Leay9qbxoa1E571PtVmng2BpQDZLZEYZsEI7Fr+ X-Received: by 2002:a17:906:fcac:b0:7ba:a9cb:8643 with SMTP id qw12-20020a170906fcac00b007baa9cb8643mr25186228ejb.298.1669749667706; Tue, 29 Nov 2022 11:21:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669749667; cv=none; d=google.com; s=arc-20160816; b=PEqilfl8CCJzO2EfCXNn2BLih9r28uM+mXcnVw89j6RoE6B0+iib+1lN+5vxrG1n6z UQ3j5l5O+c3toSVk/17OtU12iFrAjLyzyf6elxsvcAw+0Su3ND1L+TXpRPC8BPcsqM/T wwa6XDNPBco0ZPP5iPwA0EK6li2UpArh21g4pJo9fULgM79clBdCW79pZSP5MYBjtD+s sCMsSa7sO3kCm8616K8DmnFR31Surjwc4ltFQgnSK+azKxkUv1giYfMI/1yOaGD4RtR4 /Wq0FeRmIQmh6cfQNP0GZ2N025pcKQJDVkmK0g7vFK5IfR58D88RgkIQLfm8rTfuWQMw yqXQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hp42-20020a1709073e2a00b007878144285csi13233864ejc.314.2022.11.29.11.20.44; Tue, 29 Nov 2022 11:21:07 -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 + 99 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 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?1750859427267508621?= X-GMAIL-MSGID: =?utf-8?q?1750859427267508621?= 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, }, };