Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp5053490rwb; Mon, 8 Aug 2022 11:16:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR6+uDd9otS0UtYEzYwlb9jk8le/ipQY1RKT1aJGWo8hToSCQ2MMIciOO9lgnKGeyu+CsiJS X-Received: by 2002:a17:907:6eaa:b0:730:9fb6:41a5 with SMTP id sh42-20020a1709076eaa00b007309fb641a5mr14365501ejc.675.1659982611057; Mon, 08 Aug 2022 11:16:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659982611; cv=none; d=google.com; s=arc-20160816; b=q6eB5bwa42HEno5KGSZ/KjA7oc7ORULhSvmk5SvQMrttEO4iIZ1UpbWwbkVXoHyQXb 1+OOzaVc34dCG2RmHzmEpSciMMvUFFowcoVYrMLyx4dKESu+L+B1F+t2X1ydHC6rKtlz D0jtKCMgU197SvhnEr1GRhmvYsNsN/McxxOMlO06OfVeYaQI2OeJNxPQbnWx52L9wEot rC3V503cpPOoFxtFQB40Pa5ZE0TItFlfrO4VyvAJKliQIjderEBO7yBaPSa09hnl/Nmk nqgnamNol5PHhBwmeTMPX/ZRJlsVFZ2dfA1+2L8Y3WF23albMyff5rsRYL0trCYPJZcs LGyQ== 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=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=mgQe6LxmesM5AXm2TrzxeBMl5zcvB28xsBxE9gd7mEEqBBzDtiKGlDPnI1b/BpYfHL J9o9Mym9Fsb/UaITk/xc9Akt0VSeByiEGDoF2cUMW0lBtaVU9GNv5CpZSWi5kkpNAAKx lbTn55bPlwldT2pcE3fTgOBvpf2Ea5AjTy0nO1Px4+uHaJU3f7BsTePstA5X2rnWINm7 yVAuWg6WwM7icHU59yD3Xs17FJiOG1BxboOpGHhaNm38eGgv0SAwZirRQ4pvyKvYN4Z1 MSJjsNeEGl9GY/ATULfApZclMraLcjf0zfx7BbHLiSBHSdjvC7p+hjksvHwR3GVQjLzV 2EBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=VdTOuxe0; 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 sb34-20020a1709076da200b0072a6d845d91si303045ejc.159.2022.08.08.11.16.24; Mon, 08 Aug 2022 11:16:51 -0700 (PDT) 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=VdTOuxe0; 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 S244262AbiHHRmO (ORCPT + 99 others); Mon, 8 Aug 2022 13:42:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244256AbiHHRlw (ORCPT ); Mon, 8 Aug 2022 13:41:52 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9291E242 for ; Mon, 8 Aug 2022 10:41:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659980496; 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=DrQfVq26IcEBKrFEtoBOOzSjXtsyVbn1/l3uB8Ev+4g=; b=VdTOuxe0og2OIj9Xu6F+oBZdblZC7WCpFX7/vTcR1IOigKhKm15Yy31mWBN6xDLfbFNJvd P5ZDY25RMAoP+7MX7U7ID6sh8wk6Dj7As/bWBBjksS1OlYIvfwGUOXgPhRti/SOJtcNc2e RCtKYZXYxvNF41mMG0lnv+jxc/iui7Q= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH v2 02/30] mfd: 88pm80x: Remove #ifdef guards for PM related functions Date: Mon, 8 Aug 2022 19:40:39 +0200 Message-Id: <20220808174107.38676-3-paul@crapouillou.net> In-Reply-To: <20220808174107.38676-1-paul@crapouillou.net> References: <20220808174107.38676-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, T_SCC_BODY_TEXT_LINE 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 new EXPORT_GPL_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 --- drivers/mfd/88pm800.c | 2 +- drivers/mfd/88pm805.c | 2 +- drivers/mfd/88pm80x.c | 5 +---- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/mfd/88pm800.c b/drivers/mfd/88pm800.c index eaf9845633b4..409f0996ae1d 100644 --- a/drivers/mfd/88pm800.c +++ b/drivers/mfd/88pm800.c @@ -599,7 +599,7 @@ static int pm800_remove(struct i2c_client *client) static struct i2c_driver pm800_driver = { .driver = { .name = "88PM800", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm800_probe, .remove = pm800_remove, diff --git a/drivers/mfd/88pm805.c b/drivers/mfd/88pm805.c index ada6c513302b..724ac4947e6f 100644 --- a/drivers/mfd/88pm805.c +++ b/drivers/mfd/88pm805.c @@ -254,7 +254,7 @@ static int pm805_remove(struct i2c_client *client) static struct i2c_driver pm805_driver = { .driver = { .name = "88PM805", - .pm = &pm80x_pm_ops, + .pm = pm_sleep_ptr(&pm80x_pm_ops), }, .probe = pm805_probe, .remove = pm805_remove, diff --git a/drivers/mfd/88pm80x.c b/drivers/mfd/88pm80x.c index be036e7e787b..ac4f08565f29 100644 --- a/drivers/mfd/88pm80x.c +++ b/drivers/mfd/88pm80x.c @@ -129,7 +129,6 @@ int pm80x_deinit(void) } EXPORT_SYMBOL_GPL(pm80x_deinit); -#ifdef CONFIG_PM_SLEEP static int pm80x_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -153,10 +152,8 @@ static int pm80x_resume(struct device *dev) return 0; } -#endif -SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); -EXPORT_SYMBOL_GPL(pm80x_pm_ops); +EXPORT_GPL_SIMPLE_DEV_PM_OPS(pm80x_pm_ops, pm80x_suspend, pm80x_resume); MODULE_DESCRIPTION("I2C Driver for Marvell 88PM80x"); MODULE_AUTHOR("Qiao Zhou "); -- 2.35.1