From patchwork Mon Nov 7 17:50:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Cercueil X-Patchwork-Id: 16599 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2201001wru; Mon, 7 Nov 2022 09:54:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4sjZ04rVYvURNHlDgRgwKd/1ZJEVcgfkBD7xgjcTYfKUtbAbN2S6ki8MhNSioG60EgqZpc X-Received: by 2002:a05:6a00:8cd:b0:56e:fd68:6c6d with SMTP id s13-20020a056a0008cd00b0056efd686c6dmr8281006pfu.81.1667843691339; Mon, 07 Nov 2022 09:54:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667843691; cv=none; d=google.com; s=arc-20160816; b=wOk2j8K4BESdOVqhpeYvZ6asM1OEoVVyEt8fl3npi/5nzaNk1g6lphYCuzkIIRDVMV ub7wNjCuwyNDxTvNAWewVHBPc88Bv9c0vL61yGTyzSLvFcJqGepACyzcpIvZIRoD1Wz6 kxmVMgWQTtLoEi4EkdNnsK9xSGFTvHSElq6LotpQLAJrSBQyoL495+ECXWojisYRO8VS FAUaIHwZLJo7owS1KSZJiouUs+3ZZzlyFjCSt6DPFo8NPySa30bRoJ/3qj51JkZ7BU1F kTbkuj8s8wwcv6MuH98BRiJdOAK9vKaWvZxaH6mVwHYOir6cN0f+0/VF2iXee/I504qq sFpw== 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=J6lrUUQrnG1hoBLHHonfLfMerCAB94qKyHJkeyV1GEE=; b=v93u7w26Kea1EZSDo052Z/MkSXQ2wEC+h2xREUTOvtBbuUb2yupt9zKPx9PToVkB6+ Sgq4kokGSICVgm4Uj1qQ7cwskU3Lsr3+TU5K3lIf9oUh1iV95llEOfVKpqnah1iNBhyA 0U9HBn8sp2NZ3B+kt2/xzQgExFjgVD56YTkd7YRsD9sTi3/VjPpMzl1C817hd6XLfzSy skY0hu6k3ghKxkLE7/Ny0EpSPD+zpYFW0xZ7Mbkrt3QP2urUTjYjJEuaQhQYrLUyFUF0 OPAwTyV1F79L9JB/wolE6DC+r+FzXJcEh5633dUmAmiC+o0Q216+OG88Io/zzs1aAMUE a9vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b="mOQsq/Yg"; 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 e190-20020a621ec7000000b00541c0da3083si10155332pfe.302.2022.11.07.09.54.38; Mon, 07 Nov 2022 09:54:51 -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="mOQsq/Yg"; 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 S232537AbiKGRxN (ORCPT + 99 others); Mon, 7 Nov 2022 12:53:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58320 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232544AbiKGRwr (ORCPT ); Mon, 7 Nov 2022 12:52:47 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D517D25E91 for ; Mon, 7 Nov 2022 09:52:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1667843480; 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=J6lrUUQrnG1hoBLHHonfLfMerCAB94qKyHJkeyV1GEE=; b=mOQsq/YgbgLowrcMuJ9PYfkUUJGVmSR0UC2N+mrw4pWcTL7x7t3PurcnDE9N741lXgI7xO Npdvj5CpH+prx/VHOjCE6UJ5J1y/Udi7n1P3AJ5AkbNLowSYbB+zInJeirWWJGxzKo1/xE c/X7buNkJ9fOXZGRBxb8e/gUfvI0qgM= 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 , Sam Ravnborg , Boris Brezillon , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , linux-arm-kernel@lists.infradead.org Subject: [PATCH 08/26] drm: atmel-hlcdc: Remove #ifdef guards for PM related functions Date: Mon, 7 Nov 2022 17:50:48 +0000 Message-Id: <20221107175106.360578-9-paul@crapouillou.net> In-Reply-To: <20221107175106.360578-1-paul@crapouillou.net> References: <20221107175106.360578-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?1748860866275776425?= X-GMAIL-MSGID: =?utf-8?q?1748860866275776425?= 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 f7e7f4e919c7..05146936cc70 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, }, };