Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1312003rwb; Tue, 29 Nov 2022 11:44:25 -0800 (PST) X-Google-Smtp-Source: AA0mqf4XflD2EqR5j8OKFinByfWatLdqrHoE9+yYOlugiK9zwyMUsHF8Q8XHuiw/8HLC16GXhVv8 X-Received: by 2002:a17:90a:f481:b0:219:56eb:c228 with SMTP id bx1-20020a17090af48100b0021956ebc228mr3039307pjb.81.1669751064804; Tue, 29 Nov 2022 11:44:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669751064; cv=none; d=google.com; s=arc-20160816; b=D5Kj1w7l+9R7/CLjt/Qk5zLDkLId/SD9wa0a/kQlMw8RrL/rsAkr93x2+4vONpdg64 7KWHwfZdCQ+L9C924DpdeNpodYoTvrF2aXtn0psS1VOnvVcu+dMXIFFi2/efuQVbIVu0 +xH+Lru/JXYAnUhfx9hwNXLVZ7fnQ7i7JR5FAPOLb25lcbSrFtoQ7/Wf/r08FbDG1vgo Hj/S4JjoKxiyajP0G95pRylSAU3oBbY5Ll2Y061uW5kO/6LdbsMcNQ6Q398h1+DXcvBj qFgu1qsKGpx9+0rUo2VEE9R9KLrUhpSN5XM8URBBCSZ64NoPlFA1mlxrU3LxKut90xAJ zgog== 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=byA101qNki62ObkCL8sU230sS3WvAvBk1eSOioaQ+Uo=; b=JjH5zReXsN9TMhb539NATmAWA1CJ8kkJm2fU/NNSU6tv9JvUApP3alDqYC+Ma8nKaC VFz60D+RcQUvctGfeubm3AJgvrPOmGWA/mRbRaPs8xvBzjZyk776Yt3yLRB1VMZIhJNI IX8Behyn9edeorSo05OG5pJadF4fr94LIstttR+d/On69C2ZrHGAFMqxYxoYaN8u1xBa 4dD0ljnmdoWsHKIsmW7C83sl+AodoqgcL+uoApSjpl4Z7/xr9qDt78SBKUFSJHdKk2NQ nRepB1MIIMMq4vQv8Yoe9vYRTjQsgoN+fl/cdOr+EUYnUzHAHylJMb4h4TyBqF5TsPsc gvFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=xqxyzatq; 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 j19-20020a170902759300b001898ee9f703si5155854pll.30.2022.11.29.11.44.14; Tue, 29 Nov 2022 11:44:24 -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=xqxyzatq; 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 S236939AbiK2TX6 (ORCPT + 84 others); Tue, 29 Nov 2022 14:23:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57284 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236942AbiK2TXg (ORCPT ); Tue, 29 Nov 2022 14:23:36 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 651A3720A5 for ; Tue, 29 Nov 2022 11:21:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749648; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=byA101qNki62ObkCL8sU230sS3WvAvBk1eSOioaQ+Uo=; b=xqxyzatqfCp2mjbE69daFfXtIjZ4QvdVLh2PYEeHXgWkb3ZrlKAU17Gcn7E/yncUJGdXTD arvHBFkJyfH25CtDPs+dv84vwOhZ7Cyn8/NhBWVnL+iZj1WgOjaCAw/PzKdYQ0XVxGhwgX 4d5Wok+WXHlhY7ju3rpmaCRY+80POEA= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Jyri Sarha , Jyri Sarha , Tomi Valkeinen Subject: [PATCH v2 21/26] drm: tilcdc: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:37 +0000 Message-Id: <20221129191942.138244-8-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-Type: text/plain; charset=UTF-8 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: Jyri Sarha --- Cc: Jyri Sarha Cc: Tomi Valkeinen --- drivers/gpu/drm/tilcdc/tilcdc_drv.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c index 80615ecdae0b..4ca426007dc8 100644 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c @@ -496,7 +496,6 @@ static const struct drm_driver tilcdc_driver = { * Power management: */ -#ifdef CONFIG_PM_SLEEP static int tilcdc_pm_suspend(struct device *dev) { struct drm_device *ddev = dev_get_drvdata(dev); @@ -518,11 +517,9 @@ static int tilcdc_pm_resume(struct device *dev) pinctrl_pm_select_default_state(dev); return drm_mode_config_helper_resume(ddev); } -#endif -static const struct dev_pm_ops tilcdc_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(tilcdc_pm_suspend, tilcdc_pm_resume) -}; +static DEFINE_SIMPLE_DEV_PM_OPS(tilcdc_pm_ops, + tilcdc_pm_suspend, tilcdc_pm_resume); /* * Platform driver: @@ -597,7 +594,7 @@ static struct platform_driver tilcdc_platform_driver = { .remove = tilcdc_pdev_remove, .driver = { .name = "tilcdc", - .pm = &tilcdc_pm_ops, + .pm = pm_sleep_ptr(&tilcdc_pm_ops), .of_match_table = tilcdc_of_match, }, }; -- 2.35.1