From patchwork Tue Nov 23 21:10:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635421 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A274C433F5 for ; Tue, 23 Nov 2021 21:07:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240259AbhKWVKV (ORCPT ); Tue, 23 Nov 2021 16:10:21 -0500 Received: from mail.kernel.org ([198.145.29.99]:40342 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239697AbhKWVKL (ORCPT ); Tue, 23 Nov 2021 16:10:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E81BE60FD8; Tue, 23 Nov 2021 21:07:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701622; bh=8BjqzG3s6UGxSA/9rRtzhwtLf+eeayN7bA7C4l0zmJk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QBFwdePV+8Q+IrUvPipBq1H+qtX1HEVkBXHS1EcsBN4lyL7FXwtGD8+crDsUiWKh2 LeS0WNesxZRDHKWexj0xyiK9nMTZXEJ/94FlfegYUnx/hZYzBRGXYgreC8UbhRf22N f7A6beGGVb37uH4yABvcvcRSRH1sRh7QfCBDP5NWoyuLjhkXry8kbL1vjFB+BRPtBy X/V02gu3hiuXnmC1yM5Scb7LGi91Go+7p28aM8hfaqWufad3xyG4hnKOoxrzez3mTu i3rtCDyUidy8ocTf+BjU8OFshZkG/G4ylHF9/L0S71PntoEkYtF7w+iO+jw5FU/WYH 6IKRpGZa7amdA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Matt Ranostay , Jonathan Albrieux , Linus Walleij Subject: [PATCH 36/49] iio:magn:ak8975: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:06 +0000 Message-Id: <20211123211019.2271440-37-jic23@kernel.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20211123211019.2271440-1-jic23@kernel.org> References: <20211123211019.2271440-1-jic23@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org From: Jonathan Cameron Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards. Removing instances of this approach from IIO also stops them being copied into new drivers. Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Cc: Jonathan Albrieux Cc: Linus Walleij Acked-by: Matt Ranostay --- drivers/iio/magnetometer/ak8975.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/magnetometer/ak8975.c b/drivers/iio/magnetometer/ak8975.c index 6e82dc54a417..ced3e674eb5f 100644 --- a/drivers/iio/magnetometer/ak8975.c +++ b/drivers/iio/magnetometer/ak8975.c @@ -1033,8 +1033,7 @@ static int ak8975_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM -static int ak8975_runtime_suspend(struct device *dev) +static __maybe_unused int ak8975_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -1053,7 +1052,7 @@ static int ak8975_runtime_suspend(struct device *dev) return 0; } -static int ak8975_runtime_resume(struct device *dev) +static __maybe_unused int ak8975_runtime_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -1074,9 +1073,8 @@ static int ak8975_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops ak8975_dev_pm_ops = { +static __maybe_unused const struct dev_pm_ops ak8975_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(ak8975_runtime_suspend, @@ -1113,7 +1111,7 @@ MODULE_DEVICE_TABLE(of, ak8975_of_match); static struct i2c_driver ak8975_driver = { .driver = { .name = "ak8975", - .pm = &ak8975_dev_pm_ops, + .pm = pm_ptr(&ak8975_dev_pm_ops), .of_match_table = ak8975_of_match, .acpi_match_table = ak_acpi_match, },