Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1313191rwb; Tue, 29 Nov 2022 11:45:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf5XpmMd6VjzenGVrAGgKZOF2wKZu+lfIrn79quUy174ugIgM691IcX9dSeJpYc4iydpieN5 X-Received: by 2002:a63:4726:0:b0:478:1c87:7fe3 with SMTP id u38-20020a634726000000b004781c877fe3mr10564693pga.233.1669751135560; Tue, 29 Nov 2022 11:45:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669751135; cv=none; d=google.com; s=arc-20160816; b=B6SyE5uiF8AHeJDv9rRjpRLYx+A75gW6FX2E8g0kHBnzXmDX29Up7IzTISqk5Dy4hk jY2WSx+kxmX1vGr2UMANkfFHsOtkS+6+zSnoKkD5ZohNI4U02/bMgs1gV5q2cCqwguD4 XsL3wL9EAKhC2NCGKtuLTW1xW1b2jN3TRozNBRaK/LayHvhNGkSDuQHkSv4weWmykv5/ ejYricj5BKFUo+X77KXsEo4Sbr4fofnABZF+C6iNN8QyK18iN832ieJFAI1nqxx7/Gao nZL8NA3Tj6OFJJ309o/9lh4jT3W8ioselxRM/DxM1PF0lf54DVXPYg9zYxykRLl9jB0h 74aA== 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=VTAcbDsSnpHtQLYEYbOOugt9xH+f+oTO9ezz+BdhRZw=; b=QOyCFHu11dwR+rxVXltCxea8h9JIxbi4pQEXflN7QMA9cRyb9Qwp+de91H4SwLxUv+ 9VV/ytmSRPu0yMQXB2xwqwYivS1wN9QX1LEsxMIHPwkj5HqB/oqOiIy/HS9kKjn2pcgS ztqL6V7cVHuHpLTFajIJ35LFoHbTMNroM9iGu9K5iVjHIp64qgwpzq6dLmzdEmAc7p56 hjSAScblECsldcvWW0TWQdmHg6xcMCXhhOl/dVpVEA79l6dB5AOortJzRMfDKMHYt7j0 HU1JXkfKlIzDHGaCqjH4/PoAOGNztKYu+1/QiKozL3QffGj8fVZ/6cSMEI2jcs0I12c4 cikA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=eSSEN8Jv; 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.45.25; Tue, 29 Nov 2022 11:45:35 -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=eSSEN8Jv; 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 S236878AbiK2TZT (ORCPT + 84 others); Tue, 29 Nov 2022 14:25:19 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236872AbiK2TYv (ORCPT ); Tue, 29 Nov 2022 14:24:51 -0500 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 79B136E56D for ; Tue, 29 Nov 2022 11:22:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1669749651; 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=VTAcbDsSnpHtQLYEYbOOugt9xH+f+oTO9ezz+BdhRZw=; b=eSSEN8JvJtkcQpLhZiF7dYIrv23KzHI1PDfUftUkizJw6CJpc2fz6gg2JpHVYM25b1bdp1 6gEv/7b4uA9vcjfqGCpzFU53cZr8tNN0DDt2Thm7n/45lYH/vjl0kMe6GbUHzjuFsbbSFU afDtSsIWNkd3bhotmWt5AsyjSsC4JHI= From: Paul Cercueil To: David Airlie , Daniel Vetter Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Paul Cercueil , Hans de Goede Subject: [PATCH v2 24/26] drm: gm12u320: Remove #ifdef guards for PM related functions Date: Tue, 29 Nov 2022 19:19:40 +0000 Message-Id: <20221129191942.138244-11-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 pm_ptr() macro to handle the .suspend / .resume / .reset_resume callbacks. This macro allows the suspend and resume functions to be automatically dropped by the compiler when CONFIG_PM 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. It also allows to drop the __maybe_unused tags. Signed-off-by: Paul Cercueil Reviewed-by: Hans de Goede --- Cc: Hans de Goede --- drivers/gpu/drm/tiny/gm12u320.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c index 130fd07a967d..c5bb683e440c 100644 --- a/drivers/gpu/drm/tiny/gm12u320.c +++ b/drivers/gpu/drm/tiny/gm12u320.c @@ -4,6 +4,7 @@ */ #include +#include #include #include @@ -718,15 +719,15 @@ static void gm12u320_usb_disconnect(struct usb_interface *interface) drm_atomic_helper_shutdown(dev); } -static __maybe_unused int gm12u320_suspend(struct usb_interface *interface, - pm_message_t message) +static int gm12u320_suspend(struct usb_interface *interface, + pm_message_t message) { struct drm_device *dev = usb_get_intfdata(interface); return drm_mode_config_helper_suspend(dev); } -static __maybe_unused int gm12u320_resume(struct usb_interface *interface) +static int gm12u320_resume(struct usb_interface *interface) { struct drm_device *dev = usb_get_intfdata(interface); struct gm12u320_device *gm12u320 = to_gm12u320(dev); @@ -747,11 +748,9 @@ static struct usb_driver gm12u320_usb_driver = { .probe = gm12u320_usb_probe, .disconnect = gm12u320_usb_disconnect, .id_table = id_table, -#ifdef CONFIG_PM - .suspend = gm12u320_suspend, - .resume = gm12u320_resume, - .reset_resume = gm12u320_resume, -#endif + .suspend = pm_ptr(gm12u320_suspend), + .resume = pm_ptr(gm12u320_resume), + .reset_resume = pm_ptr(gm12u320_resume), }; module_usb_driver(gm12u320_usb_driver); -- 2.35.1