Received: by 2002:a05:6358:e9c4:b0:b2:91dc:71ab with SMTP id hc4csp3843199rwb; Sun, 7 Aug 2022 08:31:01 -0700 (PDT) X-Google-Smtp-Source: AA6agR7UZ673kmMumyg/gsKaHRff0TzBSJ0CTqdk2D55UPN8y5Ye0etpJU0tVPzv59f/Lt09xobe X-Received: by 2002:a05:6402:d45:b0:43c:b9f5:9ed1 with SMTP id ec5-20020a0564020d4500b0043cb9f59ed1mr15044068edb.309.1659886260748; Sun, 07 Aug 2022 08:31:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1659886260; cv=none; d=google.com; s=arc-20160816; b=iOUPmtuw/iOo+YultNySUXzQHaaTVGZa7XqK+2tkcqiUUhUf8tj0I5h9p0XKdBTBq/ 52ir2Niy3xxFutZLzY27QAJpvhq8d/AVRlQD41zk685eM+/qUDAYV5izT6PR2pBRx/sz MhyJzTYyxbwHZ71CcAAeS0ejrsaDKiEg0xi8Tllf1QYjAeYlzz7Q9SE6Y9X/Lx6axsKZ Nhe6ZacPN3GTXpwiNe6iBp4tUB38unssBsoeV6HIZLYEm14Ryja5bcIoJ6X9pxpWpmcp g3pEWFuyjB6RotOTSaFjxNeszIc7L90f2fhtAl28oVDV88gLzKhAfxRSHlph4v/c3K+w wddg== 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=jeDp4mkUztMMW1RvCNc9votvIoNVltLlfIbqBqy6Kj4=; b=EvR/xG3rs6t5ye70GzCJorrCHq1LjghOPS4dgxbcViPpA9DqUhAOionRfedWiRa+0S LC+sK9NvkVYGsQwyU+O7O0PHusEGq2eBFgsyHVWCk7UkzUrQkpyHDK7a30ZuRWWq5kP2 DVgF4js26rT9oIHXwUtgPrVVYaenNPj+W+0g/int7ylSAkOLqRX1qUfUFil0sq91Y9cq Z15Xg5KVeIih6B36QuCblPgx1GbKxtDVgOwYz5YKZ6Bs8PwztBmQUPG24zu2tgCqXLMa P2b5u+XhIHxFOxS0mu+LWxjIkIse07pFULeHIKjfcZScRP8xw7cV1PJ1TqEMsLEyKw8h REWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@crapouillou.net header.s=mail header.b=RBAPFh9H; 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 hq22-20020a1709073f1600b00730d36cd60bsi9457935ejc.959.2022.08.07.08.30.35; Sun, 07 Aug 2022 08:31:00 -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=RBAPFh9H; 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 S233968AbiHGOxY (ORCPT + 99 others); Sun, 7 Aug 2022 10:53:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234291AbiHGOxW (ORCPT ); Sun, 7 Aug 2022 10:53:22 -0400 Received: from aposti.net (aposti.net [89.234.176.197]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E60FA195 for ; Sun, 7 Aug 2022 07:53:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=crapouillou.net; s=mail; t=1659883981; 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=jeDp4mkUztMMW1RvCNc9votvIoNVltLlfIbqBqy6Kj4=; b=RBAPFh9HvvXfNJe6C6hZdpNhVlhe3iAP4MZ+Pi3Q+gDHUQeapWyQGsC2Dmc4qiPMHNkRgN 3LrjKiKk/usE2szw15tYNV+qY4+3hdtNDQAvQxPCHuD/KrEjBmlTKtnGMzNGNps4crJOj7 Nb+DZXJmWR+xVjG61nBYkhl2IuY+OBg= From: Paul Cercueil To: Lee Jones Cc: linux-kernel@vger.kernel.org, Paul Cercueil Subject: [PATCH 02/28] mfd: aat2870: Remove #ifdef guards for PM related functions Date: Sun, 7 Aug 2022 16:52:21 +0200 Message-Id: <20220807145247.46107-3-paul@crapouillou.net> In-Reply-To: <20220807145247.46107-1-paul@crapouillou.net> References: <20220807145247.46107-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 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. The advantage is then that these functions are now always compiled independently of any Kconfig option, and thanks to that bugs and regressions are easier to catch. Signed-off-by: Paul Cercueil --- drivers/mfd/aat2870-core.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mfd/aat2870-core.c b/drivers/mfd/aat2870-core.c index a17cf759739d..8a3967c3f026 100644 --- a/drivers/mfd/aat2870-core.c +++ b/drivers/mfd/aat2870-core.c @@ -409,7 +409,6 @@ static int aat2870_i2c_probe(struct i2c_client *client, return ret; } -#ifdef CONFIG_PM_SLEEP static int aat2870_i2c_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); @@ -438,10 +437,9 @@ static int aat2870_i2c_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, - aat2870_i2c_resume); +static DEFINE_SIMPLE_DEV_PM_OPS(aat2870_pm_ops, aat2870_i2c_suspend, + aat2870_i2c_resume); static const struct i2c_device_id aat2870_i2c_id_table[] = { { "aat2870", 0 }, @@ -451,7 +449,7 @@ static const struct i2c_device_id aat2870_i2c_id_table[] = { static struct i2c_driver aat2870_i2c_driver = { .driver = { .name = "aat2870", - .pm = &aat2870_pm_ops, + .pm = pm_sleep_ptr(&aat2870_pm_ops), .suppress_bind_attrs = true, }, .probe = aat2870_i2c_probe, -- 2.35.1