From patchwork Tue Nov 23 21:09:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635353 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 7BA7AC433FE for ; Tue, 23 Nov 2021 21:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234244AbhKWVJF (ORCPT ); Tue, 23 Nov 2021 16:09:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:39824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbhKWVJC (ORCPT ); Tue, 23 Nov 2021 16:09:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2EC6760FC3; Tue, 23 Nov 2021 21:05:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701553; bh=R43Tfs1kPPYp4Fze8UGKrx3HgzcdvmqB9L9VxHJ4aEg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oVWyndx6wzrwZT3DPVCwJsEADXrueX67L6iXdSrhI/SGbIq2GVTPKkxBvjOlHJEOo rKZO2M7R4kPYWTAPG+QNLNUUDwSt4pQiO+/6/Beel/DQ7kfqx3Xd0eiExxt1xqtwRU aubl6YiM+W3Sn8VybFjDejnSMzYt/wu162PWFx7+HLZ/OLSOEG8hF2otu2k5JVtbi0 jPMtCwc92GPlveEREnxMQ/nKcGLHYn9U6MtWW45aVMvv/7IK+201218IihwxuMkCOE yH2J7+P7WD6uofX1MmPPqHCZ8nUrBwoYpbeq5m5byEFVHGbxjiXZO/SHk+qODqcwjh VkEpiQSsXqbWg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 01/49] iio:accel:da311: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:31 +0000 Message-Id: <20211123211019.2271440-2-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/da311.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/accel/da311.c b/drivers/iio/accel/da311.c index 04e13487e706..b65f47dc4945 100644 --- a/drivers/iio/accel/da311.c +++ b/drivers/iio/accel/da311.c @@ -256,17 +256,15 @@ static int da311_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int da311_suspend(struct device *dev) +static __maybe_unused int da311_suspend(struct device *dev) { return da311_enable(to_i2c_client(dev), false); } -static int da311_resume(struct device *dev) +static __maybe_unused int da311_resume(struct device *dev) { return da311_enable(to_i2c_client(dev), true); } -#endif static SIMPLE_DEV_PM_OPS(da311_pm_ops, da311_suspend, da311_resume); @@ -279,7 +277,7 @@ MODULE_DEVICE_TABLE(i2c, da311_i2c_id); static struct i2c_driver da311_driver = { .driver = { .name = "da311", - .pm = &da311_pm_ops, + .pm = pm_ptr(&da311_pm_ops), }, .probe = da311_probe, .id_table = da311_i2c_id, From patchwork Tue Nov 23 21:09:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635351 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 9F3EDC43217 for ; Tue, 23 Nov 2021 21:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234024AbhKWVJF (ORCPT ); Tue, 23 Nov 2021 16:09:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:39834 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234240AbhKWVJE (ORCPT ); Tue, 23 Nov 2021 16:09:04 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4612760FC1; Tue, 23 Nov 2021 21:05:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701555; bh=pTulFIQj2QTy//8it93U4MTzZbwk7N6xAurBVbdoAjc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pgq8Bpp4yh5+7q9f8JmU8QOfRWspRNNwphteHTQ/hP+zKV5ICl3vh1cc2n7YF3NTD 9b/w9AgpSye4g+diFJ6jWWnD6QesH87fb5KK2xfxlcE+9zhq+g6VEe2Fydk1qVWSH2 ghc6ovou97Wd6pgtZ1Llnbz2U4ojEaDX4hbFJRjTUBEQHzrz1g7FKsGp64xcdKBWh7 Em5dKScRJIz8DCcqLWw0syXrPtZ0HQO1BhZ7otffNdY8aQrAvxFqI1PTklnkYEAQx/ 2Bk5vCCpGRW7ighQl6WOnlLEE7Ls3Z0bZyZLoSCdD5Thu0FyWAvjJ/n4DcA/l91qcK 96biqZxiwyb9g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 02/49] iio:accel:da280: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:32 +0000 Message-Id: <20211123211019.2271440-3-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/da280.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/da280.c b/drivers/iio/accel/da280.c index 9633bdae5fd4..91ac478891ce 100644 --- a/drivers/iio/accel/da280.c +++ b/drivers/iio/accel/da280.c @@ -153,17 +153,15 @@ static int da280_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int da280_suspend(struct device *dev) +static __maybe_unused int da280_suspend(struct device *dev) { return da280_enable(to_i2c_client(dev), false); } -static int da280_resume(struct device *dev) +static __maybe_unused int da280_resume(struct device *dev) { return da280_enable(to_i2c_client(dev), true); } -#endif static SIMPLE_DEV_PM_OPS(da280_pm_ops, da280_suspend, da280_resume); From patchwork Tue Nov 23 21:09:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635355 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 D8247C433EF for ; Tue, 23 Nov 2021 21:06:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234304AbhKWVJL (ORCPT ); Tue, 23 Nov 2021 16:09:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:39850 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbhKWVJF (ORCPT ); Tue, 23 Nov 2021 16:09:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 06C1360FD8; Tue, 23 Nov 2021 21:05:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701557; bh=JRDU7ooOViv/ExO2/8kLivBk8M6t33akhx3+LubKhzQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pwKv4LTYfXLmtTXTkhI0YUOxOUwvDnHkNhknDMqBhXO0e6Ac9Zb9T4KwLBNpMzI2o QlwAfOGxzhqip7C1UYAdIeG9sDwStchQ+g20fA4bfftSb55afgWcGjNY5LbCR/MLsQ 8BVL6V569dPjV1c1rtfM6oGhNynpITTMHQRRSpUYhzi7KXAUfH4IiCYuM3s5J5O/3p KsUjcvSSpQC5/YAyilojoHCa41rLo4IwVnQTX7jkeGi7Fz3VL0KGJoV1avCTcwmLGd +RIDQO8+D34GD/00nQqIn1e69vW2caN28BGf74IvpXwaqv053isCjPt7A6uND86+HB xkuHj1XqavnOg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 03/49] iio:accel:dmard06: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:33 +0000 Message-Id: <20211123211019.2271440-4-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/dmard06.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/accel/dmard06.c b/drivers/iio/accel/dmard06.c index de2868c28d95..a0e8d0ab700b 100644 --- a/drivers/iio/accel/dmard06.c +++ b/drivers/iio/accel/dmard06.c @@ -7,6 +7,7 @@ #include #include +#include #include #include @@ -170,8 +171,7 @@ static int dmard06_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int dmard06_suspend(struct device *dev) +static __maybe_unused int dmard06_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct dmard06_data *dmard06 = iio_priv(indio_dev); @@ -185,7 +185,7 @@ static int dmard06_suspend(struct device *dev) return 0; } -static int dmard06_resume(struct device *dev) +static __maybe_unused int dmard06_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct dmard06_data *dmard06 = iio_priv(indio_dev); @@ -200,10 +200,6 @@ static int dmard06_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(dmard06_pm_ops, dmard06_suspend, dmard06_resume); -#define DMARD06_PM_OPS (&dmard06_pm_ops) -#else -#define DMARD06_PM_OPS NULL -#endif static const struct i2c_device_id dmard06_id[] = { { "dmard05", 0 }, @@ -227,7 +223,7 @@ static struct i2c_driver dmard06_driver = { .driver = { .name = DMARD06_DRV_NAME, .of_match_table = dmard06_of_match, - .pm = DMARD06_PM_OPS, + .pm = pm_ptr(&dmard06_pm_ops), }, }; module_i2c_driver(dmard06_driver); From patchwork Tue Nov 23 21:09:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635359 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 BFD79C433EF for ; Tue, 23 Nov 2021 21:06:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234479AbhKWVJO (ORCPT ); Tue, 23 Nov 2021 16:09:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:39858 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234224AbhKWVJN (ORCPT ); Tue, 23 Nov 2021 16:09:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B8F7960FE7; Tue, 23 Nov 2021 21:05:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701559; bh=RSxD7ze8IHMOivP6+ayHwy3BM/4xcKG6WgXXUtNaKXk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rBdI0ImF6bD14HtlInllz8+w+4+rlQrex7bNWruDRJu4Aejb5YWoH4rqyhoquoDB5 VVIxrFsctYdvakIliAcNg9Z13gpi+G/OzsIKd4UjFIldUkF3TxzWjkPFyfoy5DTCfN 9MuWp4dG8wt529c88lEReSux+DegRKqtTFBRVI0cdCVQ1q7So956FS5r/5EHZ95zfm OCBvsK/QQhddd6r2X0y+w/NYUUXBQPhAf1NqsuOGTlJF1vgOoFnVTYau2MaMMzv8Gl f6hqN8pFNWvuegz9MV219kU4UWu+fiHrqzoVZh/HjcLGaVbDzQiYAzefeJeHnWYc3N LNLHqWMK1J6EQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 04/49] iio:accel:dmard10: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:34 +0000 Message-Id: <20211123211019.2271440-5-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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/dmard10.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/iio/accel/dmard10.c b/drivers/iio/accel/dmard10.c index f9f173eec202..7ad3349ad60f 100644 --- a/drivers/iio/accel/dmard10.c +++ b/drivers/iio/accel/dmard10.c @@ -7,6 +7,7 @@ */ #include +#include #include #include #include @@ -218,17 +219,15 @@ static int dmard10_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int dmard10_suspend(struct device *dev) +static int __maybe_unused dmard10_suspend(struct device *dev) { return dmard10_shutdown(to_i2c_client(dev)); } -static int dmard10_resume(struct device *dev) +static int __maybe_unused dmard10_resume(struct device *dev) { return dmard10_reset(to_i2c_client(dev)); } -#endif static SIMPLE_DEV_PM_OPS(dmard10_pm_ops, dmard10_suspend, dmard10_resume); @@ -241,7 +240,7 @@ MODULE_DEVICE_TABLE(i2c, dmard10_i2c_id); static struct i2c_driver dmard10_driver = { .driver = { .name = "dmard10", - .pm = &dmard10_pm_ops, + .pm = pm_ptr(&dmard10_pm_ops), }, .probe = dmard10_probe, .id_table = dmard10_i2c_id, From patchwork Tue Nov 23 21:09:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635357 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 3641EC433FE for ; Tue, 23 Nov 2021 21:06:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234240AbhKWVJO (ORCPT ); Tue, 23 Nov 2021 16:09:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:39880 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234479AbhKWVJN (ORCPT ); Tue, 23 Nov 2021 16:09:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7C00C60FE6; Tue, 23 Nov 2021 21:05:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701561; bh=rVzJEu9HkUXc7z2nTxYwPLNrr5h2cWKkNv8peMwL1pU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I4XezPKU3QAEO2M4hwxelaIlizHaBhDUaZkw5IuTvmuaxOA14o8gqsJusPS+Brlhz u/8mZF+pa9q8IWNwKySrfIdvLC27qk3Prlm6csw9X6xrUUU4olBi0uwdepfVqE6jTy 9GyB0p/Kyv780+m7VMoiIt5g2Yb/FcRfC5HVZaVlS1aZudqOnkahUJg/iC5RZ0/+rt DJ3pBRJT/9TqptL5ZXqiBW1nsFvaqWTKEZ59DVICE1rAAefqbbJh0n/V4j1qTPtnQL yfsz5ZfENqIuTHDG8mOWUwmPIChkO6A3ltfXzvPdWKunTq6UA9+1Z4rDrdVM7R9Lu8 Faa+6R6cpLC5g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Hans de Goede Subject: [PATCH 05/49] iio:accel:mc3230: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:35 +0000 Message-Id: <20211123211019.2271440-6-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Hans de Goede Reviewed-by: Hans de Goede --- drivers/iio/accel/mc3230.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/accel/mc3230.c b/drivers/iio/accel/mc3230.c index 735002b716f3..139c7f6839df 100644 --- a/drivers/iio/accel/mc3230.c +++ b/drivers/iio/accel/mc3230.c @@ -160,8 +160,7 @@ static int mc3230_remove(struct i2c_client *client) return mc3230_set_opcon(iio_priv(indio_dev), MC3230_MODE_OPCON_STANDBY); } -#ifdef CONFIG_PM_SLEEP -static int mc3230_suspend(struct device *dev) +static __maybe_unused int mc3230_suspend(struct device *dev) { struct mc3230_data *data; @@ -170,7 +169,7 @@ static int mc3230_suspend(struct device *dev) return mc3230_set_opcon(data, MC3230_MODE_OPCON_STANDBY); } -static int mc3230_resume(struct device *dev) +static __maybe_unused int mc3230_resume(struct device *dev) { struct mc3230_data *data; @@ -178,7 +177,6 @@ static int mc3230_resume(struct device *dev) return mc3230_set_opcon(data, MC3230_MODE_OPCON_WAKE); } -#endif static SIMPLE_DEV_PM_OPS(mc3230_pm_ops, mc3230_suspend, mc3230_resume); @@ -191,7 +189,7 @@ MODULE_DEVICE_TABLE(i2c, mc3230_i2c_id); static struct i2c_driver mc3230_driver = { .driver = { .name = "mc3230", - .pm = &mc3230_pm_ops, + .pm = pm_ptr(&mc3230_pm_ops), }, .probe = mc3230_probe, .remove = mc3230_remove, From patchwork Tue Nov 23 21:09:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635361 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 459F2C433FE for ; Tue, 23 Nov 2021 21:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234224AbhKWVJO (ORCPT ); Tue, 23 Nov 2021 16:09:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:39892 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234849AbhKWVJN (ORCPT ); Tue, 23 Nov 2021 16:09:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id BB08F60FE8; Tue, 23 Nov 2021 21:06:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701562; bh=zjTDKYtu7+xOmlLzT29F3c1xP32583MjmftScP85638=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=clc+6V/eR5Je7ci/0bD1TgQ964w/cA7TXaVUSUaCmQbrEF5kGBeK5eO2RDS7IG5cv aOUsmvl5sC+uN0N3GLyyJqjvdvuPZOygh8H6NcR7SJ2wL45OoUhf0Jmuj0rZdKS5K2 HdjD9kjwLPflMKAuCPRrIPt9WUllh5qal3M7f63w4OnivHjXx0L5JyaUmn3VZo5bES RqhN3XWqz3rboULcdVFr1b/YzLVgHawjEUemjwkUZbFSKzOKoMASFOQ8oSPXCSPtbh UkSRypTt9UBi2CK0rA0BcP/MDqLlmsu84SXP0uAKNDImVyM+YGipd/boi32kLQ0H8o kaMXm7NV56ixw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 06/49] iio:accel:mma7660: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:36 +0000 Message-Id: <20211123211019.2271440-7-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/mma7660.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/iio/accel/mma7660.c b/drivers/iio/accel/mma7660.c index 24b83ccdb950..e90463b88b91 100644 --- a/drivers/iio/accel/mma7660.c +++ b/drivers/iio/accel/mma7660.c @@ -222,8 +222,7 @@ static int mma7660_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int mma7660_suspend(struct device *dev) +static __maybe_unused int mma7660_suspend(struct device *dev) { struct mma7660_data *data; @@ -232,7 +231,7 @@ static int mma7660_suspend(struct device *dev) return mma7660_set_mode(data, MMA7660_MODE_STANDBY); } -static int mma7660_resume(struct device *dev) +static __maybe_unused int mma7660_resume(struct device *dev) { struct mma7660_data *data; @@ -243,11 +242,6 @@ static int mma7660_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(mma7660_pm_ops, mma7660_suspend, mma7660_resume); -#define MMA7660_PM_OPS (&mma7660_pm_ops) -#else -#define MMA7660_PM_OPS NULL -#endif - static const struct i2c_device_id mma7660_i2c_id[] = { {"mma7660", 0}, {} @@ -270,7 +264,7 @@ MODULE_DEVICE_TABLE(acpi, mma7660_acpi_id); static struct i2c_driver mma7660_driver = { .driver = { .name = "mma7660", - .pm = MMA7660_PM_OPS, + .pm = pm_ptr(&mma7660_pm_ops), .of_match_table = mma7660_of_match, .acpi_match_table = ACPI_PTR(mma7660_acpi_id), }, From patchwork Tue Nov 23 21:09:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635363 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 8BCB9C4332F for ; Tue, 23 Nov 2021 21:06:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234849AbhKWVJQ (ORCPT ); Tue, 23 Nov 2021 16:09:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:39898 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234379AbhKWVJN (ORCPT ); Tue, 23 Nov 2021 16:09:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 61BFE60FF2; Tue, 23 Nov 2021 21:06:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701564; bh=Gbt4voC8hgHwcweps9671ptb+T5/TG70en/Xs8lCE3M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ipxQOlTU9elwTAgzIEP6gzmdILKc0QzLqrMdET56aXE4SlvMBfbi6H4zLHz1ir9WL plGnPwaeHjDS4G8M4mDRuja3smrVj/38f85bY88H+EmgbILNzUMiW1peeASQPjQS09 +/PIMM+30KDeRKCfRKYAbAYoNkQiRapEDEKntx4dhRh4L/meXfGwumi52uHWVVyzEQ 0X/sTLSIpMWKl15q1vIwM+IIyqVb0FFA7vYernkCFHVpa1BfxKtQX7ZXQu8A6ZV6Z2 1XyBhRiBYObjhDcFYoWl1F1mdjlVXrDcQJpCTSwxBz+Nb2YbyvkubTDT2kFZqU7gCi zARhZIIfv9U6g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 07/49] iio:accel:mma9551: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:37 +0000 Message-Id: <20211123211019.2271440-8-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 --- drivers/iio/accel/mma9551.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/accel/mma9551.c b/drivers/iio/accel/mma9551.c index 4c359fb05480..67fdd53b811f 100644 --- a/drivers/iio/accel/mma9551.c +++ b/drivers/iio/accel/mma9551.c @@ -523,8 +523,7 @@ static int mma9551_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM -static int mma9551_runtime_suspend(struct device *dev) +static __maybe_unused int mma9551_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9551_data *data = iio_priv(indio_dev); @@ -541,7 +540,7 @@ static int mma9551_runtime_suspend(struct device *dev) return 0; } -static int mma9551_runtime_resume(struct device *dev) +static __maybe_unused int mma9551_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9551_data *data = iio_priv(indio_dev); @@ -555,10 +554,8 @@ static int mma9551_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP -static int mma9551_suspend(struct device *dev) +static __maybe_unused int mma9551_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9551_data *data = iio_priv(indio_dev); @@ -571,7 +568,7 @@ static int mma9551_suspend(struct device *dev) return ret; } -static int mma9551_resume(struct device *dev) +static __maybe_unused int mma9551_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9551_data *data = iio_priv(indio_dev); @@ -583,9 +580,8 @@ static int mma9551_resume(struct device *dev) return ret; } -#endif -static const struct dev_pm_ops mma9551_pm_ops = { +static __maybe_unused const struct dev_pm_ops mma9551_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(mma9551_suspend, mma9551_resume) SET_RUNTIME_PM_OPS(mma9551_runtime_suspend, mma9551_runtime_resume, NULL) @@ -609,7 +605,7 @@ static struct i2c_driver mma9551_driver = { .driver = { .name = MMA9551_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9551_acpi_match), - .pm = &mma9551_pm_ops, + .pm = pm_ptr(&mma9551_pm_ops), }, .probe = mma9551_probe, .remove = mma9551_remove, From patchwork Tue Nov 23 21:09:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635365 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 AFDE7C433EF for ; Tue, 23 Nov 2021 21:06:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234891AbhKWVJQ (ORCPT ); Tue, 23 Nov 2021 16:09:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:39912 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234556AbhKWVJP (ORCPT ); Tue, 23 Nov 2021 16:09:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2233C60FED; Tue, 23 Nov 2021 21:06:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701566; bh=3ahxVLAlJQ7dfLJzOpy8TSR9LAm9dh4QI7Mr148JFgA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IcG0C6rJydxb4tH5tMJWwaGIb/bHp75AoDZ8G5SIXb/lgX3N5MU6GAc5kFJn0rg20 ya5/R+rCat0sCUwzfOR9BYHFSgMixgO+kXR58/bi4ENJBIBTfswiQ+XSgC9peGOkqf nT/rHY6Bv8Uetn2EPKiLxwVE5HYNxKRoUsaQWZ9X8v9nDrqzVLG+QBcFw9NdOFYi9X HG6arFSxJiBwPygji0QUAFIt/MmQO8oVci6EhUiD6OYu+ZNLMaFLYQQg2dPj5qkUVc cCIpsPyndDpOLN9s8bTQc3zuZ12orSCX+ypTwtBZ9lb5+R5lKP4zizFM9xK/wBGdLT ZCljWa+I9BJHw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 08/49] iio:accel:mma9553: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:38 +0000 Message-Id: <20211123211019.2271440-9-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 --- drivers/iio/accel/mma9553.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/iio/accel/mma9553.c b/drivers/iio/accel/mma9553.c index ba3ecb3b57dc..1597806229f4 100644 --- a/drivers/iio/accel/mma9553.c +++ b/drivers/iio/accel/mma9553.c @@ -1162,8 +1162,7 @@ static int mma9553_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM -static int mma9553_runtime_suspend(struct device *dev) +static __maybe_unused int mma9553_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9553_data *data = iio_priv(indio_dev); @@ -1180,7 +1179,7 @@ static int mma9553_runtime_suspend(struct device *dev) return 0; } -static int mma9553_runtime_resume(struct device *dev) +static __maybe_unused int mma9553_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9553_data *data = iio_priv(indio_dev); @@ -1194,10 +1193,8 @@ static int mma9553_runtime_resume(struct device *dev) return 0; } -#endif -#ifdef CONFIG_PM_SLEEP -static int mma9553_suspend(struct device *dev) +static __maybe_unused int mma9553_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9553_data *data = iio_priv(indio_dev); @@ -1210,7 +1207,7 @@ static int mma9553_suspend(struct device *dev) return ret; } -static int mma9553_resume(struct device *dev) +static __maybe_unused int mma9553_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mma9553_data *data = iio_priv(indio_dev); @@ -1222,9 +1219,8 @@ static int mma9553_resume(struct device *dev) return ret; } -#endif -static const struct dev_pm_ops mma9553_pm_ops = { +static __maybe_unused const struct dev_pm_ops mma9553_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(mma9553_suspend, mma9553_resume) SET_RUNTIME_PM_OPS(mma9553_runtime_suspend, mma9553_runtime_resume, NULL) @@ -1248,7 +1244,7 @@ static struct i2c_driver mma9553_driver = { .driver = { .name = MMA9553_DRV_NAME, .acpi_match_table = ACPI_PTR(mma9553_acpi_match), - .pm = &mma9553_pm_ops, + .pm = pm_ptr(&mma9553_pm_ops), }, .probe = mma9553_probe, .remove = mma9553_remove, From patchwork Tue Nov 23 21:09:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635367 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 27683C433F5 for ; Tue, 23 Nov 2021 21:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234556AbhKWVJS (ORCPT ); Tue, 23 Nov 2021 16:09:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:39918 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234379AbhKWVJQ (ORCPT ); Tue, 23 Nov 2021 16:09:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D940060FE3; Tue, 23 Nov 2021 21:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701568; bh=pF36MvC4kT2tIIwg6PxC4mZfFP7pT8Uy4mU6tq2moEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NvSg3xVq7WkZrVkS9s9L+mFbrDLDHvChqLc36VUR3o7s9fSC8y83penxZHIgY5pxV BVydFq+wUbzIDcOfQTwQfe+b2Xv9QJzYwh6HIEGJKSPu7bmohszRJlYKhLBgkwD/pL dXsOruJhEd3RifEWFsppgAb2ePa+woIIRbddKXbLPnj8pyVamAUkn9SCfQp18oG7VV 6r9VyaryhAAex1ffDzGpoxpM2L0nIEg0WgpabBnP67voQJ2NxjaYQ1gLb1F+CdkYH9 BBM2t6woNGEFmhah6+g2tYlEhaIWpgeeVk7vn/9nfEnP3AWM7X8kb03StDFcCUfRyr 0MPFfL58SNfMA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 09/49] iio:accel:stk8ba50: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:39 +0000 Message-Id: <20211123211019.2271440-10-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/accel/stk8ba50.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/iio/accel/stk8ba50.c b/drivers/iio/accel/stk8ba50.c index 517c57ed9e94..88506a5e9402 100644 --- a/drivers/iio/accel/stk8ba50.c +++ b/drivers/iio/accel/stk8ba50.c @@ -504,8 +504,7 @@ static int stk8ba50_remove(struct i2c_client *client) return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); } -#ifdef CONFIG_PM_SLEEP -static int stk8ba50_suspend(struct device *dev) +static __maybe_unused int stk8ba50_suspend(struct device *dev) { struct stk8ba50_data *data; @@ -514,7 +513,7 @@ static int stk8ba50_suspend(struct device *dev) return stk8ba50_set_power(data, STK8BA50_MODE_SUSPEND); } -static int stk8ba50_resume(struct device *dev) +static __maybe_unused int stk8ba50_resume(struct device *dev) { struct stk8ba50_data *data; @@ -525,11 +524,6 @@ static int stk8ba50_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(stk8ba50_pm_ops, stk8ba50_suspend, stk8ba50_resume); -#define STK8BA50_PM_OPS (&stk8ba50_pm_ops) -#else -#define STK8BA50_PM_OPS NULL -#endif - static const struct i2c_device_id stk8ba50_i2c_id[] = { {"stk8ba50", 0}, {} @@ -546,7 +540,7 @@ MODULE_DEVICE_TABLE(acpi, stk8ba50_acpi_id); static struct i2c_driver stk8ba50_driver = { .driver = { .name = "stk8ba50", - .pm = STK8BA50_PM_OPS, + .pm = pm_ptr(&stk8ba50_pm_ops), .acpi_match_table = ACPI_PTR(stk8ba50_acpi_id), }, .probe = stk8ba50_probe, From patchwork Tue Nov 23 21:09:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635369 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 B5E54C433FE for ; Tue, 23 Nov 2021 21:06:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234379AbhKWVJS (ORCPT ); Tue, 23 Nov 2021 16:09:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:39932 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbhKWVJS (ORCPT ); Tue, 23 Nov 2021 16:09:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 80DBB6023D; Tue, 23 Nov 2021 21:06:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701569; bh=YSAF/cR1QrA94lzb39v6u1KPLGp6BBtsaNFmQiq2Dfo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grV3/ghxjnujyqIagWH+N0DJiBfw1EQg/WpuFpb1aCnjAzB4oM40ar+Vsyd1QaNh4 2aA46b9410GmHrGyJRGnpOWekxWs410ZwM8d2GNhy1yjzo3tbr5Wl8wuzSVbxaFLha fsveaMDGkqD0Qp86ifN/X5bVXDTI24Hfjc6PklhVG0WBoWoTyZGM4R/HdACuL9pizy LKU9sJgm9Dlpe3INdKs6TC7g2jD784hqbqOjo6NFsHRMoY78xkltdWqAmmiUPEHGjT sPn+v8a5hlVk7efGiKMqfZLlLv+CmGrrplnGy53TLtPRQpB/HUV7kXQcBqIm1n0E4l j+qN4z2qTFlRw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 10/49] iio:accel:kxsd9: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:40 +0000 Message-Id: <20211123211019.2271440-11-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 --- drivers/iio/accel/kxsd9-i2c.c | 2 +- drivers/iio/accel/kxsd9-spi.c | 2 +- drivers/iio/accel/kxsd9.c | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/iio/accel/kxsd9-i2c.c b/drivers/iio/accel/kxsd9-i2c.c index 274b41a6e603..ffe8066b4025 100644 --- a/drivers/iio/accel/kxsd9-i2c.c +++ b/drivers/iio/accel/kxsd9-i2c.c @@ -55,7 +55,7 @@ static struct i2c_driver kxsd9_i2c_driver = { .driver = { .name = "kxsd9", .of_match_table = kxsd9_of_match, - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), }, .probe = kxsd9_i2c_probe, .remove = kxsd9_i2c_remove, diff --git a/drivers/iio/accel/kxsd9-spi.c b/drivers/iio/accel/kxsd9-spi.c index 441e6b764281..44edf39fc5ff 100644 --- a/drivers/iio/accel/kxsd9-spi.c +++ b/drivers/iio/accel/kxsd9-spi.c @@ -54,7 +54,7 @@ MODULE_DEVICE_TABLE(of, kxsd9_of_match); static struct spi_driver kxsd9_spi_driver = { .driver = { .name = "kxsd9", - .pm = &kxsd9_dev_pm_ops, + .pm = pm_ptr(&kxsd9_dev_pm_ops), .of_match_table = kxsd9_of_match, }, .probe = kxsd9_spi_probe, diff --git a/drivers/iio/accel/kxsd9.c b/drivers/iio/accel/kxsd9.c index 2faf85ca996e..f9954288914b 100644 --- a/drivers/iio/accel/kxsd9.c +++ b/drivers/iio/accel/kxsd9.c @@ -492,8 +492,7 @@ void kxsd9_common_remove(struct device *dev) } EXPORT_SYMBOL(kxsd9_common_remove); -#ifdef CONFIG_PM -static int kxsd9_runtime_suspend(struct device *dev) +static __maybe_unused int kxsd9_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct kxsd9_state *st = iio_priv(indio_dev); @@ -501,16 +500,15 @@ static int kxsd9_runtime_suspend(struct device *dev) return kxsd9_power_down(st); } -static int kxsd9_runtime_resume(struct device *dev) +static __maybe_unused int kxsd9_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct kxsd9_state *st = iio_priv(indio_dev); return kxsd9_power_up(st); } -#endif /* CONFIG_PM */ -const struct dev_pm_ops kxsd9_dev_pm_ops = { +const __maybe_unused struct dev_pm_ops kxsd9_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(kxsd9_runtime_suspend, From patchwork Tue Nov 23 21:09:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635371 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 B793EC433EF for ; Tue, 23 Nov 2021 21:06:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235026AbhKWVJU (ORCPT ); Tue, 23 Nov 2021 16:09:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:39948 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbhKWVJU (ORCPT ); Tue, 23 Nov 2021 16:09:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 587D161002; Tue, 23 Nov 2021 21:06:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701571; bh=zmcemhX4xrSn50Y56+iehhczcDkGUI+jtEy/bGqjrdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJSpS7jzNYZADA/DY0/uh4mMLqoAFFIpXzKO7gyqhAmuIwiKYQ5h7PhqWuxeZ98tg m7lwbGwGnfQA1qRNbEToDW2A+1jSZISXe/+g34Uvki6azTtb38negAzUabUGNEPDdg 7LbpkEbqrD6PeT/j9nK+NJK8H+2IocHwPPz7Uq/RKrn6YaepVMJRqTNhclSEi3XdST kwv6cxmcai7O7jdR8bZeITn6kTLta9GA3vG8TYHyeoNBhgr7ggnUMrL56E5SIPZ0EU NCGkbLaUmIdXIYZNBmEVKtpuw4yWUH7AzSxShNeDeAhT2zZhhc/71Qsum7xMBAi0n0 4I2fVt33vVlPA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Linus Walleij Subject: [PATCH 11/49] iio:adc:ab8500: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:41 +0000 Message-Id: <20211123211019.2271440-12-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: Linus Walleij Reviewed-by: Linus Walleij --- drivers/iio/adc/ab8500-gpadc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c index 4c46a201d4ef..3905213e1bfa 100644 --- a/drivers/iio/adc/ab8500-gpadc.c +++ b/drivers/iio/adc/ab8500-gpadc.c @@ -942,8 +942,7 @@ static const struct iio_info ab8500_gpadc_info = { .read_raw = ab8500_gpadc_read_raw, }; -#ifdef CONFIG_PM -static int ab8500_gpadc_runtime_suspend(struct device *dev) +static __maybe_unused int ab8500_gpadc_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ab8500_gpadc *gpadc = iio_priv(indio_dev); @@ -953,7 +952,7 @@ static int ab8500_gpadc_runtime_suspend(struct device *dev) return 0; } -static int ab8500_gpadc_runtime_resume(struct device *dev) +static __maybe_unused int ab8500_gpadc_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ab8500_gpadc *gpadc = iio_priv(indio_dev); @@ -965,7 +964,6 @@ static int ab8500_gpadc_runtime_resume(struct device *dev) return ret; } -#endif /** * ab8500_gpadc_parse_channel() - process devicetree channel configuration @@ -1199,7 +1197,7 @@ static int ab8500_gpadc_remove(struct platform_device *pdev) return 0; } -static const struct dev_pm_ops ab8500_gpadc_pm_ops = { +static __maybe_unused const struct dev_pm_ops ab8500_gpadc_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(ab8500_gpadc_runtime_suspend, @@ -1212,7 +1210,7 @@ static struct platform_driver ab8500_gpadc_driver = { .remove = ab8500_gpadc_remove, .driver = { .name = "ab8500-gpadc", - .pm = &ab8500_gpadc_pm_ops, + .pm = pm_ptr(&ab8500_gpadc_pm_ops), }, }; builtin_platform_driver(ab8500_gpadc_driver); From patchwork Tue Nov 23 21:09:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635373 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 AED1EC433EF for ; Tue, 23 Nov 2021 21:06:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235056AbhKWVJW (ORCPT ); Tue, 23 Nov 2021 16:09:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:39972 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234770AbhKWVJW (ORCPT ); Tue, 23 Nov 2021 16:09:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7EA2E60FD8; Tue, 23 Nov 2021 21:06:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701573; bh=jhEvIBqlIJt6sfaGuXhurm2bthJCKDNTF1l/blf1JgQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EjcAxptoGWNzEePfL/1NVcSd7DYDN3p+Jm/DxI5gUEzGu0VZT5IR3/s5d6U1M6m48 RjVWBmpq92H/V0g78Do1RbF7NQ3MBsFqr25XbHuNdCL6NJBoh75SSOsMmd9IKXlLs4 JvS26skrqmIh5dV8zjo5pOGsNLOTPS/R3XJWWvBfa3rwOt1ydywfWLP1hLXUuMhlBI y9+Ge/AhNgnB39aDE9bE0WUJ6hiC0pLd1GCqNxjTA5206ZFrjEzLuDmhzlSF/8Q6kA ImsTe33e78xlPgvQcrnNE8qtpBcOf66482J+cLpIO8DeO1tSWZiKDHwmQXijQ+QoFN giEJC5glbVZPw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 12/49] iio:adc:ad7606: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:42 +0000 Message-Id: <20211123211019.2271440-13-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/ad7606.c | 8 ++------ drivers/iio/adc/ad7606.h | 5 ----- drivers/iio/adc/ad7606_par.c | 2 +- drivers/iio/adc/ad7606_spi.c | 2 +- 4 files changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c index 0a60ecc69d38..16a013aad20f 100644 --- a/drivers/iio/adc/ad7606.c +++ b/drivers/iio/adc/ad7606.c @@ -695,9 +695,7 @@ int ad7606_probe(struct device *dev, int irq, void __iomem *base_address, } EXPORT_SYMBOL_GPL(ad7606_probe); -#ifdef CONFIG_PM_SLEEP - -static int ad7606_suspend(struct device *dev) +static __maybe_unused int ad7606_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ad7606_state *st = iio_priv(indio_dev); @@ -710,7 +708,7 @@ static int ad7606_suspend(struct device *dev) return 0; } -static int ad7606_resume(struct device *dev) +static __maybe_unused int ad7606_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct ad7606_state *st = iio_priv(indio_dev); @@ -727,8 +725,6 @@ static int ad7606_resume(struct device *dev) SIMPLE_DEV_PM_OPS(ad7606_pm_ops, ad7606_suspend, ad7606_resume); EXPORT_SYMBOL_GPL(ad7606_pm_ops); -#endif - MODULE_AUTHOR("Michael Hennerich "); MODULE_DESCRIPTION("Analog Devices AD7606 ADC"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h index 9350ef1f63b5..fd545836790e 100644 --- a/drivers/iio/adc/ad7606.h +++ b/drivers/iio/adc/ad7606.h @@ -162,11 +162,6 @@ enum ad7606_supported_device_ids { ID_AD7616, }; -#ifdef CONFIG_PM_SLEEP extern const struct dev_pm_ops ad7606_pm_ops; -#define AD7606_PM_OPS (&ad7606_pm_ops) -#else -#define AD7606_PM_OPS NULL -#endif #endif /* IIO_ADC_AD7606_H_ */ diff --git a/drivers/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c index f732b3ac7878..60be3fb4ae39 100644 --- a/drivers/iio/adc/ad7606_par.c +++ b/drivers/iio/adc/ad7606_par.c @@ -92,7 +92,7 @@ static struct platform_driver ad7606_driver = { .id_table = ad7606_driver_ids, .driver = { .name = "ad7606", - .pm = AD7606_PM_OPS, + .pm = pm_ptr(&ad7606_pm_ops), .of_match_table = ad7606_of_match, }, }; diff --git a/drivers/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c index 29945ad07dca..8cc525b4b960 100644 --- a/drivers/iio/adc/ad7606_spi.c +++ b/drivers/iio/adc/ad7606_spi.c @@ -352,7 +352,7 @@ static struct spi_driver ad7606_driver = { .driver = { .name = "ad7606", .of_match_table = ad7606_of_match, - .pm = AD7606_PM_OPS, + .pm = pm_ptr(&ad7606_pm_ops), }, .probe = ad7606_spi_probe, .id_table = ad7606_id_table, From patchwork Tue Nov 23 21:09:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635375 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 D9655C433EF for ; Tue, 23 Nov 2021 21:06:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234770AbhKWVJY (ORCPT ); Tue, 23 Nov 2021 16:09:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:39988 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235362AbhKWVJY (ORCPT ); Tue, 23 Nov 2021 16:09:24 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3E31B60FC3; Tue, 23 Nov 2021 21:06:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701575; bh=KK0hcC9cvY2znW2Ml62+mkMlhp+owYdBi4z6EJY9WoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AL5j4lvPRotQQIjyIPWootkCLyBRhf8yRZ9TE3ycr5UAc8AsycQDpcp2ncXCwOEjB GcXU8kq77ukng7JWDBycetvr/wWwDEcVShWIag80RXXLcTZhXeG8AsBnFPHG5SQvF9 jvCA4QLgc25hHDQIrdqy3A3CPWl2wBp6LG6RL8+DS27fOv+oEwhgT699hdwf2u/lbz XeBSIAzjXC1c/apbAHWFXbz9II/rrm7d8Vh99Qis4LHw1KZkrJCb+K6fcFeucsb+el j9gOpGrrNW27Qy8Bm4TzySe314JO/dNbA0XPtDB5ZqlfUvZ2lKX4d2bJVuyUafiC34 kh9W7ar9+WDnQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Alexandre Belloni , Ludovic Desroches Subject: [PATCH 13/49] iio:adc:at91-adc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:43 +0000 Message-Id: <20211123211019.2271440-14-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Alexandre Belloni Cc: Ludovic Desroches Reviewed-by: Alexandre Belloni --- drivers/iio/adc/at91_adc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c index 5a7d3a3a5fa8..14a4735d72b5 100644 --- a/drivers/iio/adc/at91_adc.c +++ b/drivers/iio/adc/at91_adc.c @@ -1234,8 +1234,7 @@ static int at91_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int at91_adc_suspend(struct device *dev) +static __maybe_unused int at91_adc_suspend(struct device *dev) { struct iio_dev *idev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(idev); @@ -1246,7 +1245,7 @@ static int at91_adc_suspend(struct device *dev) return 0; } -static int at91_adc_resume(struct device *dev) +static __maybe_unused int at91_adc_resume(struct device *dev) { struct iio_dev *idev = dev_get_drvdata(dev); struct at91_adc_state *st = iio_priv(idev); @@ -1256,7 +1255,6 @@ static int at91_adc_resume(struct device *dev) return 0; } -#endif static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); @@ -1386,7 +1384,7 @@ static struct platform_driver at91_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = at91_adc_dt_ids, - .pm = &at91_adc_pm_ops, + .pm = pm_ptr(&at91_adc_pm_ops), }, }; From patchwork Tue Nov 23 21:09:44 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635377 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 02281C433EF for ; Tue, 23 Nov 2021 21:06:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235506AbhKWVJ0 (ORCPT ); Tue, 23 Nov 2021 16:09:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:39998 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234973AbhKWVJ0 (ORCPT ); Tue, 23 Nov 2021 16:09:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7BE9460FE7; Tue, 23 Nov 2021 21:06:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701578; bh=GJVBgA70mX58usfy/Ia5w9bcNgzV/TmHXttWscaRBuA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F7EqVKuvZItcOhz9A5hU6i+/MRwCknbjEpMA7YOeK9Hut1HLoM6akdVQuGnrZslq/ R68PXI7tFFt/dWKk/eoAGkJ2iFlyylFWiI6uCIPhYpoMrglq+UCJXHHyyTnS3yIWZs jan9pr/FU424lTMfOOEA+5uItvOCz9NU2fUGTegIJPylUPxsx/Sw64rVvDV31e/ydb N1xUlKPyFjR4ZcLOqPR5VOnSrNnGjVBzBJ6BFW9ZH/GoDlBPTdVfSr2MM/PDsuKvPP QWqqlfFIiDvpuYWHg2UdqNL83twC48PbSn/IlWi9gXMzSz6ys4MChrVKKeujQT5wgn YvDpttSDFdGkw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Krzysztof Kozlowski Subject: [PATCH 14/49] iio:adc:exynos_adc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:44 +0000 Message-Id: <20211123211019.2271440-15-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Krzysztof Kozlowski Reviewed-by: Krzysztof Kozlowski --- drivers/iio/adc/exynos_adc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c index 3b3868aa2533..01a801d325a9 100644 --- a/drivers/iio/adc/exynos_adc.c +++ b/drivers/iio/adc/exynos_adc.c @@ -968,8 +968,7 @@ static int exynos_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int exynos_adc_suspend(struct device *dev) +static __maybe_unused int exynos_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct exynos_adc *info = iio_priv(indio_dev); @@ -982,7 +981,7 @@ static int exynos_adc_suspend(struct device *dev) return 0; } -static int exynos_adc_resume(struct device *dev) +static __maybe_unused int exynos_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct exynos_adc *info = iio_priv(indio_dev); @@ -1001,7 +1000,6 @@ static int exynos_adc_resume(struct device *dev) return 0; } -#endif static SIMPLE_DEV_PM_OPS(exynos_adc_pm_ops, exynos_adc_suspend, @@ -1013,7 +1011,7 @@ static struct platform_driver exynos_adc_driver = { .driver = { .name = "exynos-adc", .of_match_table = exynos_adc_match, - .pm = &exynos_adc_pm_ops, + .pm = pm_ptr(&exynos_adc_pm_ops), }, }; From patchwork Tue Nov 23 21:09:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635379 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 E0026C433EF for ; Tue, 23 Nov 2021 21:06:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235362AbhKWVJ2 (ORCPT ); Tue, 23 Nov 2021 16:09:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234973AbhKWVJ2 (ORCPT ); Tue, 23 Nov 2021 16:09:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6EAFE60FE8; Tue, 23 Nov 2021 21:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701579; bh=3zznP9KZoQH/pszZBJE+ZtaVR5de8ceJnZFvR9i0Igs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZEAyU8RTd5PoNSDzl4P+0cTr2AlsGeZ4vlhQwUkvTgoLRzDUSrVOo7KoOwbeRBIXb Joy38bKFNRuUY0EHCAiBW2TmgBA9RbY3va5W3YyA5wnAQAHGt8GeXowM+PmJzfE2xJ SNSYQpwOj7SLyl3nZSrx46HpW4dttOM93ZJO+6nIaZDr1GXEmsv2BoYdvhvz66sGcK E2flt1vPvo5luT0PCXKjf/XzLYf6wPTHY9BEeQ0iSnpk4mx95RUnv0HKOiiQToaIA0 ePjWsc8/GFA3Vqzm4/F5W2YjmYWDNYZg8yQpRIw6wEA2zYF8a04W7SEgG8kUxT940+ 9yULw6cmJnrpA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 15/49] iio:adc:palmas_gpadc: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:45 +0000 Message-Id: <20211123211019.2271440-16-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/palmas_gpadc.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/iio/adc/palmas_gpadc.c b/drivers/iio/adc/palmas_gpadc.c index f9c8385c72d3..98d7764e0662 100644 --- a/drivers/iio/adc/palmas_gpadc.c +++ b/drivers/iio/adc/palmas_gpadc.c @@ -653,8 +653,7 @@ static int palmas_gpadc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) +static __maybe_unused int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) { int adc_period, conv; int i; @@ -759,7 +758,7 @@ static int palmas_adc_wakeup_configure(struct palmas_gpadc *adc) return ret; } -static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) +static __maybe_unused int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) { int ret; @@ -777,7 +776,7 @@ static int palmas_adc_wakeup_reset(struct palmas_gpadc *adc) return ret; } -static int palmas_gpadc_suspend(struct device *dev) +static __maybe_unused int palmas_gpadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); @@ -800,7 +799,7 @@ static int palmas_gpadc_suspend(struct device *dev) return 0; } -static int palmas_gpadc_resume(struct device *dev) +static __maybe_unused int palmas_gpadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct palmas_gpadc *adc = iio_priv(indio_dev); @@ -822,9 +821,8 @@ static int palmas_gpadc_resume(struct device *dev) return 0; }; -#endif -static const struct dev_pm_ops palmas_pm_ops = { +static __maybe_unused const struct dev_pm_ops palmas_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(palmas_gpadc_suspend, palmas_gpadc_resume) }; @@ -840,7 +838,7 @@ static struct platform_driver palmas_gpadc_driver = { .remove = palmas_gpadc_remove, .driver = { .name = MOD_NAME, - .pm = &palmas_pm_ops, + .pm = pm_ptr(&palmas_pm_ops), .of_match_table = of_palmas_gpadc_match_tbl, }, }; From patchwork Tue Nov 23 21:09:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635381 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 D1280C433F5 for ; Tue, 23 Nov 2021 21:06:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234973AbhKWVJc (ORCPT ); Tue, 23 Nov 2021 16:09:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:40030 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236778AbhKWVJa (ORCPT ); Tue, 23 Nov 2021 16:09:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2307160FE6; Tue, 23 Nov 2021 21:06:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701581; bh=ArkD3l/qqqfcXZBHJ8wO7zQ2ZQbmZXSfmDPLjf7Ns4Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JfILvphqePmP7DTJJNcgXXlGIv85ClsGmsiLZdcyX/OT81+9cSv0+i0yDKy2SJ1/r /D+RQhLjFNJOyyz79j0RRpsXPxt7/VqCag6WcnfUQsfJiW/dVOvUzQZZTN3CUGy+kE ai2CachLTjUa1ORYzoRqQeiJxxwG7+lqmURsSmwFmOIDAIUSQD7Jlj3/2jj+6lNXRe kkkNMgcLljyf/yZ/ZTuwqRNOYnN+b9L10G8jVUbWBqt76dfDpeLdWCfyCwd9lo62Sk wZJH8/ionqrKvraySl1VS7r16Tr2RV73lA10wrwTjAtrl5AqHvszlb/V6kRsvyyxhf 9eQu0061aY0cw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Fabrice Gasnier , Olivier Moysan Subject: [PATCH 16/49] iio:adc:stm32:Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:46 +0000 Message-Id: <20211123211019.2271440-17-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: Fabrice Gasnier Cc: Olivier Moysan Reviewed-by: Fabrice Gasnier --- drivers/iio/adc/stm32-adc-core.c | 12 +++++------- drivers/iio/adc/stm32-adc.c | 16 ++++++---------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c index b6e18eb101f7..316ae84ab961 100644 --- a/drivers/iio/adc/stm32-adc-core.c +++ b/drivers/iio/adc/stm32-adc-core.c @@ -763,28 +763,26 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM) -static int stm32_adc_core_runtime_suspend(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_suspend(struct device *dev) { stm32_adc_core_hw_stop(dev); return 0; } -static int stm32_adc_core_runtime_resume(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_resume(struct device *dev) { return stm32_adc_core_hw_start(dev); } -static int stm32_adc_core_runtime_idle(struct device *dev) +static __maybe_unused int stm32_adc_core_runtime_idle(struct device *dev) { pm_runtime_mark_last_busy(dev); return 0; } -#endif -static const struct dev_pm_ops stm32_adc_core_pm_ops = { +static __maybe_unused const struct dev_pm_ops stm32_adc_core_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(stm32_adc_core_runtime_suspend, @@ -836,7 +834,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc-core", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_core_pm_ops, + .pm = pm_ptr(&stm32_adc_core_pm_ops), }, }; module_platform_driver(stm32_adc_driver); diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c index 7f1fb36c747c..2d94de6de848 100644 --- a/drivers/iio/adc/stm32-adc.c +++ b/drivers/iio/adc/stm32-adc.c @@ -2351,8 +2351,7 @@ static int stm32_adc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM_SLEEP) -static int stm32_adc_suspend(struct device *dev) +static __maybe_unused int stm32_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); @@ -2362,7 +2361,7 @@ static int stm32_adc_suspend(struct device *dev) return pm_runtime_force_suspend(dev); } -static int stm32_adc_resume(struct device *dev) +static __maybe_unused int stm32_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); int ret; @@ -2381,21 +2380,18 @@ static int stm32_adc_resume(struct device *dev) return stm32_adc_buffer_postenable(indio_dev); } -#endif -#if defined(CONFIG_PM) -static int stm32_adc_runtime_suspend(struct device *dev) +static __maybe_unused int stm32_adc_runtime_suspend(struct device *dev) { return stm32_adc_hw_stop(dev); } -static int stm32_adc_runtime_resume(struct device *dev) +static __maybe_unused int stm32_adc_runtime_resume(struct device *dev) { return stm32_adc_hw_start(dev); } -#endif -static const struct dev_pm_ops stm32_adc_pm_ops = { +static __maybe_unused const struct dev_pm_ops stm32_adc_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(stm32_adc_suspend, stm32_adc_resume) SET_RUNTIME_PM_OPS(stm32_adc_runtime_suspend, stm32_adc_runtime_resume, NULL) @@ -2452,7 +2448,7 @@ static struct platform_driver stm32_adc_driver = { .driver = { .name = "stm32-adc", .of_match_table = stm32_adc_of_match, - .pm = &stm32_adc_pm_ops, + .pm = pm_ptr(&stm32_adc_pm_ops), }, }; module_platform_driver(stm32_adc_driver); From patchwork Tue Nov 23 21:09:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635383 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 43819C433FE for ; Tue, 23 Nov 2021 21:06:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239058AbhKWVJd (ORCPT ); Tue, 23 Nov 2021 16:09:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:40048 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238022AbhKWVJb (ORCPT ); Tue, 23 Nov 2021 16:09:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 420AD60FED; Tue, 23 Nov 2021 21:06:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701583; bh=VLoubZjlIS5eHX4fjOA/NQuRCd8tIeG8I8+uigcgBkM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M3huh4nLqwzuFHuFd9axJlLxJfp3rrpSxoVtgYcAXFQWgI+9nSH6UqXWTmEiq5YLc 29T1vhT9KmtSSFW5XUwI97szM7Uux/LQxzxbIa6YSvBchALzzuFrwT5y3xyPMGbBvf Yd/Sa0xy1JbMSjRIqPcUIzlj9LcYQAcbCcPgoDCFkU5E7H6hl+C7YAqQw1FH7Ulg8M MdM0jCloMYfqWRFC7J6w3IBijuRUyFUifMki0NuM2U9O/MU9Y8fFHG18/jLQR1puR5 XYOT88XN6nUGAwsl2B4McValtNpCyjyWzckKVRFwwRJ6tli/ap67yL3hRoP7PKPzmQ 42QfOlJe/UbbA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 17/49] iio:adc:rcar: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:47 +0000 Message-Id: <20211123211019.2271440-18-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 --- drivers/iio/adc/rcar-gyroadc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c index a48895046408..947d72457066 100644 --- a/drivers/iio/adc/rcar-gyroadc.c +++ b/drivers/iio/adc/rcar-gyroadc.c @@ -578,8 +578,7 @@ static int rcar_gyroadc_remove(struct platform_device *pdev) return 0; } -#if defined(CONFIG_PM) -static int rcar_gyroadc_suspend(struct device *dev) +static __maybe_unused int rcar_gyroadc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rcar_gyroadc *priv = iio_priv(indio_dev); @@ -589,7 +588,7 @@ static int rcar_gyroadc_suspend(struct device *dev) return 0; } -static int rcar_gyroadc_resume(struct device *dev) +static __maybe_unused int rcar_gyroadc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rcar_gyroadc *priv = iio_priv(indio_dev); @@ -598,9 +597,8 @@ static int rcar_gyroadc_resume(struct device *dev) return 0; } -#endif -static const struct dev_pm_ops rcar_gyroadc_pm_ops = { +static __maybe_unused const struct dev_pm_ops rcar_gyroadc_pm_ops = { SET_RUNTIME_PM_OPS(rcar_gyroadc_suspend, rcar_gyroadc_resume, NULL) }; @@ -610,7 +608,7 @@ static struct platform_driver rcar_gyroadc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = rcar_gyroadc_match, - .pm = &rcar_gyroadc_pm_ops, + .pm = pm_ptr(&rcar_gyroadc_pm_ops), }, }; From patchwork Tue Nov 23 21:09:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635387 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 2CCCCC4332F for ; Tue, 23 Nov 2021 21:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239430AbhKWVJh (ORCPT ); Tue, 23 Nov 2021 16:09:37 -0500 Received: from mail.kernel.org ([198.145.29.99]:40054 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237964AbhKWVJe (ORCPT ); Tue, 23 Nov 2021 16:09:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EFFC16023D; Tue, 23 Nov 2021 21:06:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701585; bh=5jWEHRBmoLS7XJAh5YmBDGscoU22UHiZj6sFthn0gTI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=I5X1H/iS3RIh2zFrb4qfSZihj8NNPIxlUW8SP0kku0GvUNWBQolEBwQQE7dFqtZ7A gqV6U8+21UrhwT+eOz00hShlpS1dt6KIgYMEPP2rp4Bch3I1NNNssFo9I2BXl8lwNz zpKl+8WW9iAVpwMTI3irnExguAJa7lhHJPzB75KJPshPgHmWlKVJSo3FwMeT+tqMEB eFK3VWSzNsgrgEIpwbwriccAo3gTXPg2b4FuvrCLoUIHPd6Qa+ld5crWwC7OG9yRvX ibxbXI26QuUotmt2tOW4vqQdiPUHf0frP8HAoPRvHcqeSlGAg01crbQL5jKx5/LMJZ uefkB1zMr+uUw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Heiko Stuebner Subject: [PATCH 18/49] iio:adc:rockchip: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:48 +0000 Message-Id: <20211123211019.2271440-19-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Heiko Stuebner --- drivers/iio/adc/rockchip_saradc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c index 14b8df4ca9c8..fb3b59d76a97 100644 --- a/drivers/iio/adc/rockchip_saradc.c +++ b/drivers/iio/adc/rockchip_saradc.c @@ -481,8 +481,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev) return devm_iio_device_register(&pdev->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int rockchip_saradc_suspend(struct device *dev) +static __maybe_unused int rockchip_saradc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rockchip_saradc *info = iio_priv(indio_dev); @@ -494,7 +493,7 @@ static int rockchip_saradc_suspend(struct device *dev) return 0; } -static int rockchip_saradc_resume(struct device *dev) +static __maybe_unused int rockchip_saradc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct rockchip_saradc *info = iio_priv(indio_dev); @@ -514,7 +513,6 @@ static int rockchip_saradc_resume(struct device *dev) return ret; } -#endif static SIMPLE_DEV_PM_OPS(rockchip_saradc_pm_ops, rockchip_saradc_suspend, rockchip_saradc_resume); @@ -524,7 +522,7 @@ static struct platform_driver rockchip_saradc_driver = { .driver = { .name = "rockchip-saradc", .of_match_table = rockchip_saradc_match, - .pm = &rockchip_saradc_pm_ops, + .pm = pm_ptr(&rockchip_saradc_pm_ops), }, }; From patchwork Tue Nov 23 21:09:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635385 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 48869C433FE for ; Tue, 23 Nov 2021 21:06:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233020AbhKWVJi (ORCPT ); Tue, 23 Nov 2021 16:09:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:40074 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239354AbhKWVJg (ORCPT ); Tue, 23 Nov 2021 16:09:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0953E60FD8; Tue, 23 Nov 2021 21:06:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701587; bh=cWgAewwcG7AwiJvlgOKZku80b7MUw4/ViBFgjtFT0Zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pOk66eL568ywg0xpuD83hm+DTlMr5/BqTk17MGYbAet0oceCkZSBAp0zPC85QzmIJ DYr8omtVCwEPOK5NPtvxapk/ULs/V3SBj1Tsj9MibSfA0g4T6S/b784SouNWW3kAAQ VDx7UrP8rwWS2e98rfVeeLSqXZkj7Vug2Nhhg35MdWYlJWwX8SzdMVe/9IuP9hdLAi s52xdx/hKfbs5jkpVEgoBUEZOA1nI1S6EWpEIL0LuuWA92RRvz9nnQrV1peWZI0ay3 dKai7VdItumm4Wpk4eR71fyuGPHBjeRepqOAyWgtOSIXhMxrHUwYdJJaUVHWm++z3z tYieiLHhFybEQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 19/49] iio:adc:twl6030: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:49 +0000 Message-Id: <20211123211019.2271440-20-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/adc/twl6030-gpadc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/twl6030-gpadc.c b/drivers/iio/adc/twl6030-gpadc.c index afdb59e0b526..cf8e4ed749d1 100644 --- a/drivers/iio/adc/twl6030-gpadc.c +++ b/drivers/iio/adc/twl6030-gpadc.c @@ -944,8 +944,7 @@ static int twl6030_gpadc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int twl6030_gpadc_suspend(struct device *pdev) +static __maybe_unused int twl6030_gpadc_suspend(struct device *pdev) { int ret; @@ -957,7 +956,7 @@ static int twl6030_gpadc_suspend(struct device *pdev) return 0; }; -static int twl6030_gpadc_resume(struct device *pdev) +static __maybe_unused int twl6030_gpadc_resume(struct device *pdev) { int ret; @@ -968,7 +967,6 @@ static int twl6030_gpadc_resume(struct device *pdev) return 0; }; -#endif static SIMPLE_DEV_PM_OPS(twl6030_gpadc_pm_ops, twl6030_gpadc_suspend, twl6030_gpadc_resume); @@ -978,7 +976,7 @@ static struct platform_driver twl6030_gpadc_driver = { .remove = twl6030_gpadc_remove, .driver = { .name = DRIVER_NAME, - .pm = &twl6030_gpadc_pm_ops, + .pm = pm_ptr(&twl6030_gpadc_pm_ops), .of_match_table = of_twl6030_match_tbl, }, }; From patchwork Tue Nov 23 21:09:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635389 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 0DB00C433F5 for ; Tue, 23 Nov 2021 21:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237964AbhKWVJk (ORCPT ); Tue, 23 Nov 2021 16:09:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:40082 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239459AbhKWVJi (ORCPT ); Tue, 23 Nov 2021 16:09:38 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE90B60FC1; Tue, 23 Nov 2021 21:06:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701589; bh=u6JR+BkVUxeRvzfyD0nWG6ApnIKahflv2F64KvoJvtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c2F5z6UHeFpZKvHHIfuRhV8N2SCTeHzESq2qftglooV4QYg5WUabdldw9qdi1wuby LjtaoA54Q5qmEsX4ia8zC6D8fCOh414eJP2jQUMFqtVgybPYGGGEcFR+1C/axVBexA Rrf5zOcVwo09p0bLegND/6cJTxCdaCl/7yTXW12dkVO+3Q5+m4bizz2TFWFitmLgPw WnznMTuO5sKWL6BMlGw4z9tGYjB5Xc1YNftVyEnQRBiPLsSLO6DmOy+DJ92hNxCjs4 V2vSG9NnyQrg75rjgRaeNvRiHzlGgY7FNFTQQTbl2zLQz2cfQrqZhhklL+QEVpaErV zqxOLrd1LB2ZQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Stefan-Gabriel Mirea Subject: [PATCH 20/49] iio:adc:vf610: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:50 +0000 Message-Id: <20211123211019.2271440-21-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Stefan-Gabriel Mirea --- drivers/iio/adc/vf610_adc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/adc/vf610_adc.c b/drivers/iio/adc/vf610_adc.c index fd57fc43e8e5..c05ef6d85093 100644 --- a/drivers/iio/adc/vf610_adc.c +++ b/drivers/iio/adc/vf610_adc.c @@ -912,8 +912,7 @@ static int vf610_adc_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int vf610_adc_suspend(struct device *dev) +static __maybe_unused int vf610_adc_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct vf610_adc *info = iio_priv(indio_dev); @@ -930,7 +929,7 @@ static int vf610_adc_suspend(struct device *dev) return 0; } -static int vf610_adc_resume(struct device *dev) +static __maybe_unused int vf610_adc_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct vf610_adc *info = iio_priv(indio_dev); @@ -952,7 +951,6 @@ static int vf610_adc_resume(struct device *dev) regulator_disable(info->vref); return ret; } -#endif static SIMPLE_DEV_PM_OPS(vf610_adc_pm_ops, vf610_adc_suspend, vf610_adc_resume); @@ -962,7 +960,7 @@ static struct platform_driver vf610_adc_driver = { .driver = { .name = DRIVER_NAME, .of_match_table = vf610_adc_match, - .pm = &vf610_adc_pm_ops, + .pm = pm_ptr(&vf610_adc_pm_ops), }, }; From patchwork Tue Nov 23 21:09:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635391 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 2E40CC433EF for ; Tue, 23 Nov 2021 21:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239264AbhKWVJk (ORCPT ); Tue, 23 Nov 2021 16:09:40 -0500 Received: from mail.kernel.org ([198.145.29.99]:40090 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJj (ORCPT ); Tue, 23 Nov 2021 16:09:39 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 05DF460FC3; Tue, 23 Nov 2021 21:06:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701591; bh=5c/9u/nyytxFRVfPIp2yMmTIUe35YDHVWTow3ymK0JY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XE6UFSGgmU854Haih6gHd3Icwuo06KgVvIP8bxz3kki/Bh8gZEih9d76Hs3E+daMU SBzA8NUF2jftlT13UmI54/LK4vi0OSMLvm8kc1/YTwBauN8YO88iWbjZ7ku2i8unfH XZ8rskI7uZF/btsjN3dJDOE5xvBFsuvfma43wBNPaNsh2QRDLupirM4ZihGG3SW6dd PORFthf5zyyL9hLN+p5oDtqe0ESNNFzRkjuRCa2CnDVLTSXbePD9Sx2qhU89olSJYc 84hcldH1YUj6AN9xv1mnCt5QrisdRuBOdfC4Xo8fKpxqxy0+hanA4yDUNB2Ji+7ncx O72zCq2LAFsLw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 21/49] iio:common:ssp: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:51 +0000 Message-Id: <20211123211019.2271440-22-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_SLEEP support is simpler and less error prone than the use of ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than open coding the structure. Removing instances of this approach from IIO also stops them being copied into new drivers. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/common/ssp_sensors/ssp_dev.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c index 1aee87100038..b5d2c69b5cc9 100644 --- a/drivers/iio/common/ssp_sensors/ssp_dev.c +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c @@ -612,8 +612,7 @@ static int ssp_remove(struct spi_device *spi) return 0; } -#ifdef CONFIG_PM_SLEEP -static int ssp_suspend(struct device *dev) +static __maybe_unused int ssp_suspend(struct device *dev) { int ret; struct ssp_data *data = spi_get_drvdata(to_spi_device(dev)); @@ -638,7 +637,7 @@ static int ssp_suspend(struct device *dev) return 0; } -static int ssp_resume(struct device *dev) +static __maybe_unused int ssp_resume(struct device *dev) { int ret; struct ssp_data *data = spi_get_drvdata(to_spi_device(dev)); @@ -661,17 +660,14 @@ static int ssp_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops ssp_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(ssp_suspend, ssp_resume) -}; +static SIMPLE_DEV_PM_OPS(ssp_pm_ops, ssp_suspend, ssp_resume); static struct spi_driver ssp_driver = { .probe = ssp_probe, .remove = ssp_remove, .driver = { - .pm = &ssp_pm_ops, + .pm = pm_ptr(&ssp_pm_ops), .of_match_table = of_match_ptr(ssp_of_match), .name = "sensorhub" }, From patchwork Tue Nov 23 21:09:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635393 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 C4AA7C4332F for ; Tue, 23 Nov 2021 21:06:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239376AbhKWVJm (ORCPT ); Tue, 23 Nov 2021 16:09:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:40100 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239569AbhKWVJl (ORCPT ); Tue, 23 Nov 2021 16:09:41 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D393660FE7; Tue, 23 Nov 2021 21:06:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701593; bh=6QM/i4nkv5NQYTsBGGF+1XgambBgPZHGFMGofgxK1lI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SKRfjub/s0avOcrX1sZU5ACiE34g86K38nsdQE1QxREBlJSLVHsd+rGwcODdX/xXf vzAnleSUKiVDh+pT/1s8TVoALyp2Wh+1LI0VLHvT79lNIkrKUYj/i3fkTO70vFvEhH IbeaiKAOF/oT/OfFrgdqU4qKwJrPmr9VsKyLyzrH+G88ua+ku4fQGmiNg3WGooZGrw TSzGlgELFZhSN7PeS3WHO758F12kYb8hKa5ekcpgAIckweCXi+jvPxbzIqgAZtkrzL WCQo/MeVQECAIZaFAOkXkfLEtTUc8EZnDuoFJcxXMSrQDMisGfQVeSqUHohW1SyCYy HTuN62x+thHKw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 22/49] iio:dac:vf610: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:52 +0000 Message-Id: <20211123211019.2271440-23-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/dac/vf610_dac.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/dac/vf610_dac.c b/drivers/iio/dac/vf610_dac.c index 636b4009f763..44b290da078d 100644 --- a/drivers/iio/dac/vf610_dac.c +++ b/drivers/iio/dac/vf610_dac.c @@ -242,8 +242,7 @@ static int vf610_dac_remove(struct platform_device *pdev) return 0; } -#ifdef CONFIG_PM_SLEEP -static int vf610_dac_suspend(struct device *dev) +static __maybe_unused int vf610_dac_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct vf610_dac *info = iio_priv(indio_dev); @@ -254,7 +253,7 @@ static int vf610_dac_suspend(struct device *dev) return 0; } -static int vf610_dac_resume(struct device *dev) +static __maybe_unused int vf610_dac_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct vf610_dac *info = iio_priv(indio_dev); @@ -268,7 +267,6 @@ static int vf610_dac_resume(struct device *dev) return 0; } -#endif static SIMPLE_DEV_PM_OPS(vf610_dac_pm_ops, vf610_dac_suspend, vf610_dac_resume); @@ -278,7 +276,7 @@ static struct platform_driver vf610_dac_driver = { .driver = { .name = "vf610-dac", .of_match_table = vf610_dac_match, - .pm = &vf610_dac_pm_ops, + .pm = pm_ptr(&vf610_dac_pm_ops), }, }; module_platform_driver(vf610_dac_driver); From patchwork Tue Nov 23 21:09:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635395 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 09784C433F5 for ; Tue, 23 Nov 2021 21:06:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239354AbhKWVJo (ORCPT ); Tue, 23 Nov 2021 16:09:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:40106 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239516AbhKWVJn (ORCPT ); Tue, 23 Nov 2021 16:09:43 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF6A360FED; Tue, 23 Nov 2021 21:06:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701595; bh=u0MtymLFV3NgSDPa2ZVX2jGe0TufuKjzvYOYOsYsiCQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YtHfuhtoFenKegy4D9BQ+319Amdc/HfOowiEze8L0OGsUws5mNpEZnDVWTCgwVT0/ YrURCFD7/yWeA0qBdVOJQjATStxpD1a/fthsMVFBbT0PKwebFIk273IJzdDIG9DzTB 1DPu3M7u3Ue8zAqZZjDByvTwN8q2K1keaY2s+ykWaPnfZBFsICCAzg1v+0Bd7lOKb8 ubD0Lv1T0xTn8nOTA7hBviV2beC/cJSPS3tlDrzF3n56sIRkvo28whfgim3FnD+gnC DFC8NUVFD4iIB1z5LvWyG9B9Gkvnqjp28VeWwNbMAniamEc7E2adYRlUTHjEh8ozXs k42O3Z1/oi1Rg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 23/49] iio:light:apds9300: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:53 +0000 Message-Id: <20211123211019.2271440-24-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/apds9300.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/apds9300.c b/drivers/iio/light/apds9300.c index baaf202dce05..56dcd255a649 100644 --- a/drivers/iio/light/apds9300.c +++ b/drivers/iio/light/apds9300.c @@ -466,8 +466,7 @@ static int apds9300_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int apds9300_suspend(struct device *dev) +static __maybe_unused int apds9300_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct apds9300_data *data = iio_priv(indio_dev); @@ -480,7 +479,7 @@ static int apds9300_suspend(struct device *dev) return ret; } -static int apds9300_resume(struct device *dev) +static __maybe_unused int apds9300_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct apds9300_data *data = iio_priv(indio_dev); @@ -494,10 +493,6 @@ static int apds9300_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(apds9300_pm_ops, apds9300_suspend, apds9300_resume); -#define APDS9300_PM_OPS (&apds9300_pm_ops) -#else -#define APDS9300_PM_OPS NULL -#endif static const struct i2c_device_id apds9300_id[] = { { APDS9300_DRV_NAME, 0 }, @@ -509,7 +504,7 @@ MODULE_DEVICE_TABLE(i2c, apds9300_id); static struct i2c_driver apds9300_driver = { .driver = { .name = APDS9300_DRV_NAME, - .pm = APDS9300_PM_OPS, + .pm = pm_ptr(&apds9300_pm_ops), }, .probe = apds9300_probe, .remove = apds9300_remove, From patchwork Tue Nov 23 21:09:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635397 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 295D3C433F5 for ; Tue, 23 Nov 2021 21:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239516AbhKWVJq (ORCPT ); Tue, 23 Nov 2021 16:09:46 -0500 Received: from mail.kernel.org ([198.145.29.99]:40196 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJq (ORCPT ); Tue, 23 Nov 2021 16:09:46 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D22A060FE3; Tue, 23 Nov 2021 21:06:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701597; bh=7G0a8YPoOWSZImMW7Kwgif5EC2GNEuuyiOI7Jf6bGBQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ASp2aPDqAe6SWpVkMKAs086elM03GaPGZaQ83adq0fDJPeT39VJ7HFaT4Sbm8KwLH 5kwIUuAXHUNIovG7pqH9na50Dy9v6B98eE8cyKQh4TrPdvmLgnjKjH/S6ObqH2VBgI +Wl55PJbsUDK5Alnx4ryhQLw0Ytbltv8tzXpC9znOtIR+CazvudmQ09/E08z2gTCAO kjiUHa7fgLp2u1qVvM+eEB6iYVQUa7WOf4VNXqOudBYjgWZbWB1JmE4aTH62Q4rfcR o8VWbMsMJiI/U8dtNQzqGYoTmIAXAn3cVrCa4MFuPaVXPKhBrkRT0hDTMBnG6yoxt8 lyfDlmpLRjWaw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Linus Walleij Subject: [PATCH 24/49] iio:light:bh1780: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:54 +0000 Message-Id: <20211123211019.2271440-25-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: Linus Walleij Reviewed-by: Linus Walleij --- drivers/iio/light/bh1780.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/bh1780.c b/drivers/iio/light/bh1780.c index abbf2e662e7d..d72dd825368a 100644 --- a/drivers/iio/light/bh1780.c +++ b/drivers/iio/light/bh1780.c @@ -221,8 +221,7 @@ static int bh1780_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM -static int bh1780_runtime_suspend(struct device *dev) +static __maybe_unused int bh1780_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -238,7 +237,7 @@ static int bh1780_runtime_suspend(struct device *dev) return 0; } -static int bh1780_runtime_resume(struct device *dev) +static __maybe_unused int bh1780_runtime_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct iio_dev *indio_dev = i2c_get_clientdata(client); @@ -256,9 +255,8 @@ static int bh1780_runtime_resume(struct device *dev) return 0; } -#endif /* CONFIG_PM */ -static const struct dev_pm_ops bh1780_dev_pm_ops = { +static __maybe_unused const struct dev_pm_ops bh1780_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(bh1780_runtime_suspend, @@ -284,7 +282,7 @@ static struct i2c_driver bh1780_driver = { .id_table = bh1780_id, .driver = { .name = "bh1780", - .pm = &bh1780_dev_pm_ops, + .pm = pm_ptr(&bh1780_dev_pm_ops), .of_match_table = of_bh1780_match, }, }; From patchwork Tue Nov 23 21:09:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635399 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 A4D64C433EF for ; Tue, 23 Nov 2021 21:06:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239254AbhKWVJs (ORCPT ); Tue, 23 Nov 2021 16:09:48 -0500 Received: from mail.kernel.org ([198.145.29.99]:40212 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJs (ORCPT ); Tue, 23 Nov 2021 16:09:48 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E77E6023D; Tue, 23 Nov 2021 21:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701599; bh=hdzghaUgu3uQBrZh2Cb1l7A2SL5hUsybDvMwvcUh7jU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mdki1Alg69TTfBm8VieT2JWStMGqchtk5S1x6+iXhf25kSRE4ZnexU8u3MHqPYybB qjvu10X1pEeOL1rR8hX4n6dqtjK9QwyiescNhoVYx1sA3LLV2aBMsR0MVeYEFhXKIH a4O50HUX6MSXFUlg/GYdDYbapLcUwQzsj2QuFYzREZis6Mqi5TSRS4ApBmE87+sYjg u4cTiVVZO/3EKlqyrhHF39B4vumVSATNba02Zr3Y8ixhOrsUZNinFQSeI9NoTvC+Fj jKnQnq5AJZy6s8VKSN4gI+LL3VbPVC8EhykU6Up+Ttbnxm0lFIgwVhqp7qo5+sV5+y hsMGIe3rSXSSg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 25/49] iio:light:cm3232: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:55 +0000 Message-Id: <20211123211019.2271440-26-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_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also switch to SIMPLE_DEV_PM_OPS rather than opencoding the same. Removing instances of this approach from IIO also stops them being copied into new drivers. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/cm3232.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/cm3232.c b/drivers/iio/light/cm3232.c index 18a410340dc5..660f3204dc18 100644 --- a/drivers/iio/light/cm3232.c +++ b/drivers/iio/light/cm3232.c @@ -374,8 +374,7 @@ static const struct i2c_device_id cm3232_id[] = { {} }; -#ifdef CONFIG_PM_SLEEP -static int cm3232_suspend(struct device *dev) +static __maybe_unused int cm3232_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct cm3232_chip *chip = iio_priv(indio_dev); @@ -389,7 +388,7 @@ static int cm3232_suspend(struct device *dev) return ret; } -static int cm3232_resume(struct device *dev) +static __maybe_unused int cm3232_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct cm3232_chip *chip = iio_priv(indio_dev); @@ -403,9 +402,7 @@ static int cm3232_resume(struct device *dev) return ret; } -static const struct dev_pm_ops cm3232_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(cm3232_suspend, cm3232_resume)}; -#endif +static SIMPLE_DEV_PM_OPS(cm3232_pm_ops, cm3232_suspend, cm3232_resume); MODULE_DEVICE_TABLE(i2c, cm3232_id); @@ -419,9 +416,7 @@ static struct i2c_driver cm3232_driver = { .driver = { .name = "cm3232", .of_match_table = cm3232_of_match, -#ifdef CONFIG_PM_SLEEP - .pm = &cm3232_pm_ops, -#endif + .pm = pm_ptr(&cm3232_pm_ops), }, .id_table = cm3232_id, .probe = cm3232_probe, From patchwork Tue Nov 23 21:09:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635401 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 C17DEC433EF for ; Tue, 23 Nov 2021 21:06:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239375AbhKWVJu (ORCPT ); Tue, 23 Nov 2021 16:09:50 -0500 Received: from mail.kernel.org ([198.145.29.99]:40222 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJu (ORCPT ); Tue, 23 Nov 2021 16:09:50 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0EC9760FD8; Tue, 23 Nov 2021 21:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701601; bh=+kapT8P3GFioNL9o3AIdbCoPNFvmZuVlJvgQMZnwYVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V/d5q4H+7rKNteZ26yQO09yN4PJafNTSoKlG+LKughIy1Qq9lPnzHfFZ0MIOVVN2p kdSOixJ+U4zq6M5pppKdVrTxfc2HvZyuQvfsOX+sHLGvHF2By2zWK7u/BeBpOMbL8L fQv6JSPL8E3M8NkXNtqkaqtRDTS//eoevdWYOHMsSmul1rENzrW0a6qXrbqbLKkNPc +/QLZ2YuNDv8lmad3wFlbuc5FGeTeVahj+3t6TB7zAdhQ5PHg6ufmq24fOPEBVPHWD BzkZv/KdG8p6ixjbR66CMLDzo6ktA8+UEnhjqE1zSovF0QDE2x+2O0TRPhO4+lR9gB mEY7zs3nQd40g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Anson Huang , Brian Masney Subject: [PATCH 26/49] iio:light:isl29018: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:56 +0000 Message-Id: <20211123211019.2271440-27-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Anson Huang Cc: Brian Masney --- drivers/iio/light/isl29018.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c index 2689867467a8..608bb357b9f6 100644 --- a/drivers/iio/light/isl29018.c +++ b/drivers/iio/light/isl29018.c @@ -784,8 +784,7 @@ static int isl29018_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int isl29018_suspend(struct device *dev) +static __maybe_unused int isl29018_suspend(struct device *dev) { struct isl29018_chip *chip = iio_priv(dev_get_drvdata(dev)); int ret; @@ -807,7 +806,7 @@ static int isl29018_suspend(struct device *dev) return ret; } -static int isl29018_resume(struct device *dev) +static __maybe_unused int isl29018_resume(struct device *dev) { struct isl29018_chip *chip = iio_priv(dev_get_drvdata(dev)); int err; @@ -831,10 +830,6 @@ static int isl29018_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(isl29018_pm_ops, isl29018_suspend, isl29018_resume); -#define ISL29018_PM_OPS (&isl29018_pm_ops) -#else -#define ISL29018_PM_OPS NULL -#endif #ifdef CONFIG_ACPI static const struct acpi_device_id isl29018_acpi_match[] = { @@ -866,7 +861,7 @@ static struct i2c_driver isl29018_driver = { .driver = { .name = "isl29018", .acpi_match_table = ACPI_PTR(isl29018_acpi_match), - .pm = ISL29018_PM_OPS, + .pm = pm_ptr(&isl29018_pm_ops), .of_match_table = isl29018_of_match, }, .probe = isl29018_probe, From patchwork Tue Nov 23 21:09:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635403 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 7E195C433F5 for ; Tue, 23 Nov 2021 21:06:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239432AbhKWVJw (ORCPT ); Tue, 23 Nov 2021 16:09:52 -0500 Received: from mail.kernel.org ([198.145.29.99]:40234 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJw (ORCPT ); Tue, 23 Nov 2021 16:09:52 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6556D60FC3; Tue, 23 Nov 2021 21:06:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701603; bh=ymDI8wRdV9Eja860ZewgU0/u4hcE+TNXgg7UHb+sfFw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FMiqBsSLW8PaiyOA+NPF/G/xepTYADTXLqyJXLNRAEy7TgQ2LbrCmzthik6pk8Vyo Q4RJqG0hiWpZBk+oL70ontV5rDPmzy3elilDzpeKJZThWCu4uFGQrWUWJ1vDEFsBps gMr9xCVWrjD+jtbfO+X6jQAhc7egmQ9IVtY/H+7TZWHGol+W7QuZlKKsUWB8HviqgN gmBXd2gHLbf+RIh31RMCNDn5KKr1MeToyBkd9SOTvL5HggCdzZdIcDa3wEPecGvVq2 XkjDTQe2Eoh9NJwiQBHVK7BLu50dOogP/f7hgf7HUfZe4gbMnzEtQBp/E2yFoXQw8m gfZ5gBu0SN8/g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 27/49] iio:light:isl29125: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:57 +0000 Message-Id: <20211123211019.2271440-28-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/isl29125.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/isl29125.c b/drivers/iio/light/isl29125.c index ba53b50d711a..334267595199 100644 --- a/drivers/iio/light/isl29125.c +++ b/drivers/iio/light/isl29125.c @@ -311,22 +311,20 @@ static int isl29125_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int isl29125_suspend(struct device *dev) +static __maybe_unused int isl29125_suspend(struct device *dev) { struct isl29125_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return isl29125_powerdown(data); } -static int isl29125_resume(struct device *dev) +static __maybe_unused int isl29125_resume(struct device *dev) { struct isl29125_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return i2c_smbus_write_byte_data(data->client, ISL29125_CONF1, data->conf1); } -#endif static SIMPLE_DEV_PM_OPS(isl29125_pm_ops, isl29125_suspend, isl29125_resume); @@ -339,7 +337,7 @@ MODULE_DEVICE_TABLE(i2c, isl29125_id); static struct i2c_driver isl29125_driver = { .driver = { .name = ISL29125_DRV_NAME, - .pm = &isl29125_pm_ops, + .pm = pm_ptr(&isl29125_pm_ops), }, .probe = isl29125_probe, .remove = isl29125_remove, From patchwork Tue Nov 23 21:09:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635405 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 6215EC433F5 for ; Tue, 23 Nov 2021 21:06:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239527AbhKWVJy (ORCPT ); Tue, 23 Nov 2021 16:09:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:40238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239320AbhKWVJx (ORCPT ); Tue, 23 Nov 2021 16:09:53 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0CF3360FE6; Tue, 23 Nov 2021 21:06:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701605; bh=uZeKK14C/d9jNKkJ30OHM7Xw7jyH54xEnkRwSmjuHLo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pNZIW4Sgt+RS0Vv07mws1XlSGQbAPaIzxXe7nWHGmqoJer8zDn+KIZRF2JEqYPR5Q S95gabwHBQb2TszxpeBwbs0GY246BPa7t9FrZ0zUfvw9K6S3Ppqjqw7B5QglXYzR85 dy02EFQvr6rIXbS56E+7506pXMpGhlv5F91ulrSgyQ8/8MmvlotnHLDUKWpNbHe4Bf v0p7HMFWKVJA4oVxHEnJ3YWEZIloSV1h62Bgr/Tn9YJ87qYLJNMwN350aaAAfQXItP yFBIUmj4E99cdFyDn6gqnocwhh8PYVKGMqcmVT7B+cYxFyv0OfshE82GJxhYx/HxFB 3xEQwNyCyjwRQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 28/49] iio:light:jsa1212: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:58 +0000 Message-Id: <20211123211019.2271440-29-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/jsa1212.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/jsa1212.c b/drivers/iio/light/jsa1212.c index 724a0ec9f35c..218b61595436 100644 --- a/drivers/iio/light/jsa1212.c +++ b/drivers/iio/light/jsa1212.c @@ -383,8 +383,7 @@ static int jsa1212_remove(struct i2c_client *client) return jsa1212_power_off(data); } -#ifdef CONFIG_PM_SLEEP -static int jsa1212_suspend(struct device *dev) +static __maybe_unused int jsa1212_suspend(struct device *dev) { struct jsa1212_data *data; @@ -393,7 +392,7 @@ static int jsa1212_suspend(struct device *dev) return jsa1212_power_off(data); } -static int jsa1212_resume(struct device *dev) +static __maybe_unused int jsa1212_resume(struct device *dev) { int ret = 0; struct jsa1212_data *data; @@ -423,11 +422,6 @@ static int jsa1212_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(jsa1212_pm_ops, jsa1212_suspend, jsa1212_resume); -#define JSA1212_PM_OPS (&jsa1212_pm_ops) -#else -#define JSA1212_PM_OPS NULL -#endif - static const struct acpi_device_id jsa1212_acpi_match[] = { {"JSA1212", 0}, { }, @@ -443,7 +437,7 @@ MODULE_DEVICE_TABLE(i2c, jsa1212_id); static struct i2c_driver jsa1212_driver = { .driver = { .name = JSA1212_DRIVER_NAME, - .pm = JSA1212_PM_OPS, + .pm = pm_ptr(&jsa1212_pm_ops), .acpi_match_table = ACPI_PTR(jsa1212_acpi_match), }, .probe = jsa1212_probe, From patchwork Tue Nov 23 21:09:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635407 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 C44E9C433EF for ; Tue, 23 Nov 2021 21:06:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239320AbhKWVJ4 (ORCPT ); Tue, 23 Nov 2021 16:09:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:40246 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239459AbhKWVJ4 (ORCPT ); Tue, 23 Nov 2021 16:09:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id F3DBD60FC1; Tue, 23 Nov 2021 21:06:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701607; bh=UYxuwQkI3/Lxj+mbASO4rnuQcbu8D+8LTICp4HksXT0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=No4vWbxssgfeSgU7Vc3W3uVN/2yr0W+D4E4moG2LLcfIK92L6y8baR56G7fa55mBq 4Ndo2N6Ua4L9Xe8GXG8qdS6rWXVlSjbLyuYPZY0PUksHn2cHdTsFFOQGg16x//bYhy sXAejhPojUny3QJYnZVx5FDh1qeGMAizpqlIGycyQd6R2Wv01BKU9JNnTN2ZPOEV5L nlq5GqXt5FBsyDJu4XZB6W5yk88gYE5Pa2PuyYjZ3pL7FbuQ2TDRow5OF56Zf2FlYU PwbvjDi6cigWmS9YnoDHAJZsXgv8c0ynK00lRKBRI4GdPWt2ccDV1Kh1B9Rv1OvWlS GdM071vXMKODw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Maslov Dmitry Subject: [PATCH 29/49] iio:light:ltr501: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:09:59 +0000 Message-Id: <20211123211019.2271440-30-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Maslov Dmitry --- drivers/iio/light/ltr501.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c index bab5b78f2e30..f64135a4bd0c 100644 --- a/drivers/iio/light/ltr501.c +++ b/drivers/iio/light/ltr501.c @@ -1586,15 +1586,14 @@ static int ltr501_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int ltr501_suspend(struct device *dev) +static __maybe_unused int ltr501_suspend(struct device *dev) { struct ltr501_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return ltr501_powerdown(data); } -static int ltr501_resume(struct device *dev) +static __maybe_unused int ltr501_resume(struct device *dev) { struct ltr501_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -1602,7 +1601,6 @@ static int ltr501_resume(struct device *dev) return ltr501_write_contr(data, data->als_contr, data->ps_contr); } -#endif static SIMPLE_DEV_PM_OPS(ltr501_pm_ops, ltr501_suspend, ltr501_resume); @@ -1636,7 +1634,7 @@ static struct i2c_driver ltr501_driver = { .driver = { .name = LTR501_DRV_NAME, .of_match_table = ltr501_of_match, - .pm = <r501_pm_ops, + .pm = pm_ptr(<r501_pm_ops), .acpi_match_table = ACPI_PTR(ltr_acpi_match), }, .probe = ltr501_probe, From patchwork Tue Nov 23 21:10:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635409 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 D9274C433EF for ; Tue, 23 Nov 2021 21:06:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239459AbhKWVJ7 (ORCPT ); Tue, 23 Nov 2021 16:09:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:40268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239539AbhKWVJ6 (ORCPT ); Tue, 23 Nov 2021 16:09:58 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2445A60FD8; Tue, 23 Nov 2021 21:06:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701610; bh=F/EJWo6E1jNEivAjaJledJVVyIbAhzPUs2zWFymEK54=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a+L2wgkeRTpkKtl8d/fi0KDc+x0kMZvnvNX+EUqzfDRaX3DJ3g7X5dpgeT4XR+cSb pvdy7XU+qFDGYFTaBcr3oFSvEOrC/NhPDRPvgyoVhk6WXBA9MA2qAxrsusmn5wrIoL 6soRsd5I9iQ7vO+iBe+mHdhFnIc7Qt9I9kadjPspXWCCV2XhfQXwx8HRDz6+vrGJ0l dXjbIxq3b5yAI3DQ5UqQFfLbrpMp2EeowW7g/KwH9qJ08dkuis/BBGRx3tYtaSZ3CJ EwN897E9PwRr5reiqzTPqF5oShRAQfoh01mGGqckSiopmD5gp/VXHqMFcRoHG39LiV FF2PNXFR+6ZLw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Icenowy Zheng , Luca Weiss , Martijn Braam Subject: [PATCH 30/49] iio:light:stk3310: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:00 +0000 Message-Id: <20211123211019.2271440-31-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Icenowy Zheng Cc: Luca Weiss Cc: Martijn Braam --- drivers/iio/light/stk3310.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c index 07e91846307c..fc2d5ebf0d68 100644 --- a/drivers/iio/light/stk3310.c +++ b/drivers/iio/light/stk3310.c @@ -632,8 +632,7 @@ static int stk3310_remove(struct i2c_client *client) return stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY); } -#ifdef CONFIG_PM_SLEEP -static int stk3310_suspend(struct device *dev) +static __maybe_unused int stk3310_suspend(struct device *dev) { struct stk3310_data *data; @@ -642,7 +641,7 @@ static int stk3310_suspend(struct device *dev) return stk3310_set_state(data, STK3310_STATE_STANDBY); } -static int stk3310_resume(struct device *dev) +static __maybe_unused int stk3310_resume(struct device *dev) { u8 state = 0; struct stk3310_data *data; @@ -658,11 +657,6 @@ static int stk3310_resume(struct device *dev) static SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend, stk3310_resume); -#define STK3310_PM_OPS (&stk3310_pm_ops) -#else -#define STK3310_PM_OPS NULL -#endif - static const struct i2c_device_id stk3310_i2c_id[] = { {"STK3310", 0}, {"STK3311", 0}, @@ -692,7 +686,7 @@ static struct i2c_driver stk3310_driver = { .driver = { .name = "stk3310", .of_match_table = stk3310_of_match, - .pm = STK3310_PM_OPS, + .pm = pm_ptr(&stk3310_pm_ops), .acpi_match_table = ACPI_PTR(stk3310_acpi_id), }, .probe = stk3310_probe, From patchwork Tue Nov 23 21:10:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635411 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 267C8C433FE for ; Tue, 23 Nov 2021 21:06:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239542AbhKWVKB (ORCPT ); Tue, 23 Nov 2021 16:10:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:40288 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239519AbhKWVKA (ORCPT ); Tue, 23 Nov 2021 16:10:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C5E516023D; Tue, 23 Nov 2021 21:06:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701612; bh=OqUrZbNfrw/lxzw5nXiwZa24qMe74byFZ+1ZbGr5xLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSCAHs07OzHNoic4yo0ilRMRzFfKPCcFKu8j3BZs1DVEfPsX7W1IimmZ/7gHCI5Ue xhVsvV0XhCaEBCoQYTNZ1TfkiU5ohTZ3rVH0PUeCGYe07T7d7h1HM67PiThrA70IzT 8gIMbaYzEzB/B/cKoBjcCukgr1JGdfAd2bIbH3X8OFSzX+p4BVSKpXFtb1TYuNX013 awt7/yQi0byPToeiD39q8Kictgr0gCbuG5gelGWNzGuWQK+M3zGPJqLysiYmS/yZeZ nYHmTIacMiiraCR7QuAj6g6c+QuSCiA1kjv0i5XoNYOLCDOiQZdyjcYr1eARm2uilx KcCKIp0uu5LpQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 31/49] iio:light:tcs3414: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:01 +0000 Message-Id: <20211123211019.2271440-32-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tcs3414.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/tcs3414.c b/drivers/iio/light/tcs3414.c index b87222141429..e6e49054ddfa 100644 --- a/drivers/iio/light/tcs3414.c +++ b/drivers/iio/light/tcs3414.c @@ -345,22 +345,20 @@ static int tcs3414_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int tcs3414_suspend(struct device *dev) +static __maybe_unused int tcs3414_suspend(struct device *dev) { struct tcs3414_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return tcs3414_powerdown(data); } -static int tcs3414_resume(struct device *dev) +static __maybe_unused int tcs3414_resume(struct device *dev) { struct tcs3414_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return i2c_smbus_write_byte_data(data->client, TCS3414_CONTROL, data->control); } -#endif static SIMPLE_DEV_PM_OPS(tcs3414_pm_ops, tcs3414_suspend, tcs3414_resume); @@ -373,7 +371,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3414_id); static struct i2c_driver tcs3414_driver = { .driver = { .name = TCS3414_DRV_NAME, - .pm = &tcs3414_pm_ops, + .pm = pm_ptr(&tcs3414_pm_ops), }, .probe = tcs3414_probe, .id_table = tcs3414_id, From patchwork Tue Nov 23 21:10:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635413 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 3F4E6C433F5 for ; Tue, 23 Nov 2021 21:06:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239569AbhKWVKD (ORCPT ); Tue, 23 Nov 2021 16:10:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:40306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239519AbhKWVKC (ORCPT ); Tue, 23 Nov 2021 16:10:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id D19B460FC3; Tue, 23 Nov 2021 21:06:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701614; bh=MWnxfnxQN8e/ifm51CPV9IJI8JaJcetotdBLKgy3r78=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JEyvTkNN3Z3VhHjuD2mbky/GglnmRnh2tKk8atyoXyi8MXiv1eoIwafSpVsEVQO5o foW2EHuoAQj9iigWfhSKqL03v66HIs/CGKrYVOv2kymwVFMO5OdlmUpH/TxiE7uycV jt9CZVansQfTWiHwiGoHLhaMddxyKOY7hmjOSdkx4hDUhN8u67617LQQ78i9a6QTFu xCvcbJ5GUBh9KpNTNWnIb31M5eMMbJOi6fXBjEoQ1HOYJKhQhWodjhP748hzTSt2Xv t3YOwFH+EdyJpfpgthKaD8/wo14STm43XkJQSmGpB+mbHcXo0VkFU5PFfoYotwCPL3 3QBCpoiWXnJXg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 32/49] iio:light:tcs3472: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:02 +0000 Message-Id: <20211123211019.2271440-33-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tcs3472.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/light/tcs3472.c b/drivers/iio/light/tcs3472.c index 371c6a39a165..ff548a562fc2 100644 --- a/drivers/iio/light/tcs3472.c +++ b/drivers/iio/light/tcs3472.c @@ -572,15 +572,14 @@ static int tcs3472_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tcs3472_suspend(struct device *dev) +static __maybe_unused int tcs3472_suspend(struct device *dev) { struct tcs3472_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); return tcs3472_powerdown(data); } -static int tcs3472_resume(struct device *dev) +static __maybe_unused int tcs3472_resume(struct device *dev) { struct tcs3472_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -598,7 +597,6 @@ static int tcs3472_resume(struct device *dev) return ret; } -#endif static SIMPLE_DEV_PM_OPS(tcs3472_pm_ops, tcs3472_suspend, tcs3472_resume); @@ -611,7 +609,7 @@ MODULE_DEVICE_TABLE(i2c, tcs3472_id); static struct i2c_driver tcs3472_driver = { .driver = { .name = TCS3472_DRV_NAME, - .pm = &tcs3472_pm_ops, + .pm = pm_ptr(&tcs3472_pm_ops), }, .probe = tcs3472_probe, .remove = tcs3472_remove, From patchwork Tue Nov 23 21:10:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635415 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 E70B8C433EF for ; Tue, 23 Nov 2021 21:06:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239519AbhKWVKF (ORCPT ); Tue, 23 Nov 2021 16:10:05 -0500 Received: from mail.kernel.org ([198.145.29.99]:40320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239571AbhKWVKF (ORCPT ); Tue, 23 Nov 2021 16:10:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C49B660FE8; Tue, 23 Nov 2021 21:06:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701616; bh=hodLaVDOQkVWgw05MUzW5K4MEOG8iM86rm9dYa8Yuds=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QEWd4Z5/xIb52V5P24S++CHfXYyO14eLUezauJQb8yk1F/p0o0eT9Tid9DqatiMFM zmoIln6j84Sq/XXpQUhJMzt6+JvtNBAH6FKAizFd0YtgS2X9LG0XmMuzGwc1xVqLtO SMARO3Ww1CrwMlk468ytGmJUy3jhuc15lFXp2wV6LHhYZPEe0Z7Z1byfhFmZM9yXGo tp5st9RcHlBcjrbdC4Pjtk4q662adBoC2XpQh7CZzgdywcjeLRHohMDMSylIOZOFmz 4W4iBGAuwpo430alj5hUmZt2XYxBnZdhUpZDqT7D2eBwfuDTpAfXEoUquuTUjA+NwH lgJPIVHjBR5wg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Vaishnav M A Subject: [PATCH 33/49] iio:light:tsl2563: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:03 +0000 Message-Id: <20211123211019.2271440-34-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Vaishnav M A --- drivers/iio/light/tsl2563.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c index 5bf2bfbc5379..49a45c78603c 100644 --- a/drivers/iio/light/tsl2563.c +++ b/drivers/iio/light/tsl2563.c @@ -814,8 +814,7 @@ static int tsl2563_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tsl2563_suspend(struct device *dev) +static __maybe_unused int tsl2563_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2563_chip *chip = iio_priv(indio_dev); @@ -834,7 +833,7 @@ static int tsl2563_suspend(struct device *dev) return ret; } -static int tsl2563_resume(struct device *dev) +static __maybe_unused int tsl2563_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct tsl2563_chip *chip = iio_priv(indio_dev); @@ -858,10 +857,6 @@ static int tsl2563_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(tsl2563_pm_ops, tsl2563_suspend, tsl2563_resume); -#define TSL2563_PM_OPS (&tsl2563_pm_ops) -#else -#define TSL2563_PM_OPS NULL -#endif static const struct i2c_device_id tsl2563_id[] = { { "tsl2560", 0 }, @@ -885,7 +880,7 @@ static struct i2c_driver tsl2563_i2c_driver = { .driver = { .name = "tsl2563", .of_match_table = tsl2563_of_match, - .pm = TSL2563_PM_OPS, + .pm = pm_ptr(&tsl2563_pm_ops), }, .probe = tsl2563_probe, .remove = tsl2563_remove, From patchwork Tue Nov 23 21:10:04 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635417 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 62D77C433FE for ; Tue, 23 Nov 2021 21:06:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239539AbhKWVKH (ORCPT ); Tue, 23 Nov 2021 16:10:07 -0500 Received: from mail.kernel.org ([198.145.29.99]:40326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239571AbhKWVKH (ORCPT ); Tue, 23 Nov 2021 16:10:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5BA0B60FC1; Tue, 23 Nov 2021 21:06:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701618; bh=73PuKOO4Dz4H/DaAL4fi2zwV/ilxX4Dad4HOXn4Y6+4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uioIur6VdNYEMGn9CXjHXYyWRrn7hQiuyagKwsMUF6JN1ltqNL5QCfWz41WW8U/kZ XIvxH2TkIyf1zU/L0fcVcBLA+D8LrYbX78oR8PRm/fYi+vhqaxjvG5WOiLTOLGerrt Uci0S6zu/xtrqQ3kqhJ7in50UD2wCGhw6HoSmxkTBW9Tmlv/bYIekiYpSGlmebb+GJ cK/f+4rc7i+nL+ZKMQjDzjm08eAA31Bva9qiyHoDELmbpnJ1jkK6fKscKVCtnDpoQd FQc2L0wz7Xs/SSPUtzbIV7ONhLsw/3PG1DBRYjRRTIWGs0uDHCjkonGiM4J1T1V4Jj O+Df4npF9ZhGQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 34/49] iio:light:tsl4531: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:04 +0000 Message-Id: <20211123211019.2271440-35-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/light/tsl4531.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/light/tsl4531.c b/drivers/iio/light/tsl4531.c index 70505ba6d858..8632927bc077 100644 --- a/drivers/iio/light/tsl4531.c +++ b/drivers/iio/light/tsl4531.c @@ -215,23 +215,18 @@ static int tsl4531_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int tsl4531_suspend(struct device *dev) +static __maybe_unused int tsl4531_suspend(struct device *dev) { return tsl4531_powerdown(to_i2c_client(dev)); } -static int tsl4531_resume(struct device *dev) +static __maybe_unused int tsl4531_resume(struct device *dev) { return i2c_smbus_write_byte_data(to_i2c_client(dev), TSL4531_CONTROL, TSL4531_MODE_NORMAL); } static SIMPLE_DEV_PM_OPS(tsl4531_pm_ops, tsl4531_suspend, tsl4531_resume); -#define TSL4531_PM_OPS (&tsl4531_pm_ops) -#else -#define TSL4531_PM_OPS NULL -#endif static const struct i2c_device_id tsl4531_id[] = { { "tsl4531", 0 }, @@ -242,7 +237,7 @@ MODULE_DEVICE_TABLE(i2c, tsl4531_id); static struct i2c_driver tsl4531_driver = { .driver = { .name = TSL4531_DRV_NAME, - .pm = TSL4531_PM_OPS, + .pm = pm_ptr(&tsl4531_pm_ops), }, .probe = tsl4531_probe, .remove = tsl4531_remove, From patchwork Tue Nov 23 21:10:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635419 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 3E225C433F5 for ; Tue, 23 Nov 2021 21:07:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239634AbhKWVKJ (ORCPT ); Tue, 23 Nov 2021 16:10:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:40334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239571AbhKWVKI (ORCPT ); Tue, 23 Nov 2021 16:10:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 01C6860FE3; Tue, 23 Nov 2021 21:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701620; bh=ghdBt6rfGotqcNIj5gAlkWkQtXRoZzErXq0ogcvPUvE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=q4FR8DX4n369Y0j37X4cQBabAEs8DU20YykjornE6yfH+ntDWxEAcVghLNLzp//Of xZUifXoE5Q2xl8cCAS+SJCvWQOptn+MnfG789zusQRzs0PA1AuhYUn0cCJoxVd47At ZQg8fDvthOVyN33wIbTb64aCC09g2//P9BX1R/x4+23SlE1ak9HW7lwe57wQ91jbei FohTeq/7JgS5DBpmv8axwGvaMp8cmunXRIahlvSV9yHFHoQJcy3ilmTPq5HPLlk+ab 2HCjGmLG5i5l6S99q6PwuLDZ2/CY96QHTIDSw0vI4CeZZFBW0PG9LNwjJUqNdn/1/P D5vXpDgR3ziaw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 35/49] iio:light:us5182: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:05 +0000 Message-Id: <20211123211019.2271440-36-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 --- drivers/iio/light/us5182d.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/light/us5182d.c b/drivers/iio/light/us5182d.c index 96e4a66ddf28..79d589f2fb79 100644 --- a/drivers/iio/light/us5182d.c +++ b/drivers/iio/light/us5182d.c @@ -916,8 +916,7 @@ static int us5182d_remove(struct i2c_client *client) return us5182d_shutdown_en(data, US5182D_CFG0_SHUTDOWN_EN); } -#if defined(CONFIG_PM_SLEEP) || defined(CONFIG_PM) -static int us5182d_suspend(struct device *dev) +static __maybe_unused int us5182d_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct us5182d_data *data = iio_priv(indio_dev); @@ -928,7 +927,7 @@ static int us5182d_suspend(struct device *dev) return 0; } -static int us5182d_resume(struct device *dev) +static __maybe_unused int us5182d_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct us5182d_data *data = iio_priv(indio_dev); @@ -939,9 +938,8 @@ static int us5182d_resume(struct device *dev) return 0; } -#endif -static const struct dev_pm_ops us5182d_pm_ops = { +static __maybe_unused const struct dev_pm_ops us5182d_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(us5182d_suspend, us5182d_resume) SET_RUNTIME_PM_OPS(us5182d_suspend, us5182d_resume, NULL) }; @@ -969,7 +967,7 @@ MODULE_DEVICE_TABLE(of, us5182d_of_match); static struct i2c_driver us5182d_driver = { .driver = { .name = US5182D_DRV_NAME, - .pm = &us5182d_pm_ops, + .pm = pm_ptr(&us5182d_pm_ops), .of_match_table = us5182d_of_match, .acpi_match_table = ACPI_PTR(us5182d_acpi_match), }, 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, }, From patchwork Tue Nov 23 21:10:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635423 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 B64E5C433EF for ; Tue, 23 Nov 2021 21:07:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239706AbhKWVKW (ORCPT ); Tue, 23 Nov 2021 16:10:22 -0500 Received: from mail.kernel.org ([198.145.29.99]:40364 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239711AbhKWVKN (ORCPT ); Tue, 23 Nov 2021 16:10:13 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 632F46023D; Tue, 23 Nov 2021 21:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701624; bh=pPyl3puDnQ2YVwDAg9Av2Db11yYm6u2B5Vk0Ez8BCMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=de+U/FpRZNNmqe97RVGNlMZYygTp6bLLyXNfu748eyS/JJI9f17qvTo3siowCKyhx glPVwfvj02kD5bpfevBNFdjhWE/+CAVR+xvuaWvApo6UkUbLkIpJOkTgqRddJcmaQ1 HSOVQalk6WzgfKqCIfaaW4YbwRgdrnc/ibw2VvUblMg1EVY0TeiA9d85Z2ao2ghhBW mIGK7K4oTeti06WpiOfx8xV/qTFhwqxLVUJnwn9HUL2PYoGxFMORnoc1OJTwjeRyHl /4D30k5/7Twfbmd5UvPCcq5xnggyLFzvHRYQsjgOHfGhYqm9Dr8er6HxhHVz72ShYd QtgXUBl2dkBFw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 37/49] iio:magn:hmc5843: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:07 +0000 Message-Id: <20211123211019.2271440-38-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/hmc5843.h | 5 ----- drivers/iio/magnetometer/hmc5843_i2c.c | 2 +- drivers/iio/magnetometer/hmc5843_spi.c | 2 +- 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/iio/magnetometer/hmc5843.h b/drivers/iio/magnetometer/hmc5843.h index 9120c8bbf3dd..c3444f3ab1dc 100644 --- a/drivers/iio/magnetometer/hmc5843.h +++ b/drivers/iio/magnetometer/hmc5843.h @@ -55,13 +55,8 @@ void hmc5843_common_remove(struct device *dev); int hmc5843_common_suspend(struct device *dev); int hmc5843_common_resume(struct device *dev); -#ifdef CONFIG_PM_SLEEP static __maybe_unused SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, hmc5843_common_suspend, hmc5843_common_resume); -#define HMC5843_PM_OPS (&hmc5843_pm_ops) -#else -#define HMC5843_PM_OPS NULL -#endif #endif /* HMC5843_CORE_H */ diff --git a/drivers/iio/magnetometer/hmc5843_i2c.c b/drivers/iio/magnetometer/hmc5843_i2c.c index bc6e12f1d521..a7359f439f10 100644 --- a/drivers/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/iio/magnetometer/hmc5843_i2c.c @@ -93,7 +93,7 @@ MODULE_DEVICE_TABLE(of, hmc5843_of_match); static struct i2c_driver hmc5843_driver = { .driver = { .name = "hmc5843", - .pm = HMC5843_PM_OPS, + .pm = pm_ptr(&hmc5843_pm_ops), .of_match_table = hmc5843_of_match, }, .id_table = hmc5843_id, diff --git a/drivers/iio/magnetometer/hmc5843_spi.c b/drivers/iio/magnetometer/hmc5843_spi.c index 89cf59a62c28..c1bd2ff3c64a 100644 --- a/drivers/iio/magnetometer/hmc5843_spi.c +++ b/drivers/iio/magnetometer/hmc5843_spi.c @@ -90,7 +90,7 @@ MODULE_DEVICE_TABLE(spi, hmc5843_id); static struct spi_driver hmc5843_driver = { .driver = { .name = "hmc5843", - .pm = HMC5843_PM_OPS, + .pm = pm_ptr(&hmc5843_pm_ops), }, .id_table = hmc5843_id, .probe = hmc5843_spi_probe, From patchwork Tue Nov 23 21:10:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635431 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 4A7CAC433F5 for ; Tue, 23 Nov 2021 21:07:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239722AbhKWVK0 (ORCPT ); Tue, 23 Nov 2021 16:10:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:40372 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239716AbhKWVKP (ORCPT ); Tue, 23 Nov 2021 16:10:15 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6ED4260FC3; Tue, 23 Nov 2021 21:07:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701626; bh=kztSKeAV/syJqtLcl2pqVaOWZUGwRM2EFsBo0VTIbTs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=b3EbBgWprewG03SMm6wk43S6fn9pyBXRXut+Rmg//j+PHqBw2/pUPeSEuDhubt2vR bA/3gLTCyr7+ewC3CVe5uE82DJqL4Y33hDKVHupWwt+rCGHObfWOOuTqDpYX2sxaz0 tkgywTUFhktnm25irADEBGSAifZCC+vra07w6TvNGUzYZgjjJikc68Ceoeb3Qh3RK9 ilDWG7b8L2UdkhSxZUp66nurrA95hfoEuoH7umdsOJ8nb8Yr5ZPbMDRzfG05eU+WnF sg3IO/HI5T8dddIr4aymlpZRuteZyFX4/95ZAq3T796UFT86vQBOCYulrFSKXaBYTG ZySC0XeUz4VgQ== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 38/49] iio:magn:mag3110: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:08 +0000 Message-Id: <20211123211019.2271440-39-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mag3110.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c index 17c62d806218..475fdff037f7 100644 --- a/drivers/iio/magnetometer/mag3110.c +++ b/drivers/iio/magnetometer/mag3110.c @@ -573,8 +573,7 @@ static int mag3110_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int mag3110_suspend(struct device *dev) +static __maybe_unused int mag3110_suspend(struct device *dev) { struct mag3110_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -600,7 +599,7 @@ static int mag3110_suspend(struct device *dev) return 0; } -static int mag3110_resume(struct device *dev) +static __maybe_unused int mag3110_resume(struct device *dev) { struct mag3110_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -624,10 +623,6 @@ static int mag3110_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(mag3110_pm_ops, mag3110_suspend, mag3110_resume); -#define MAG3110_PM_OPS (&mag3110_pm_ops) -#else -#define MAG3110_PM_OPS NULL -#endif static const struct i2c_device_id mag3110_id[] = { { "mag3110", 0 }, @@ -645,7 +640,7 @@ static struct i2c_driver mag3110_driver = { .driver = { .name = "mag3110", .of_match_table = mag3110_of_match, - .pm = MAG3110_PM_OPS, + .pm = pm_ptr(&mag3110_pm_ops), }, .probe = mag3110_probe, .remove = mag3110_remove, From patchwork Tue Nov 23 21:10:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635427 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 71745C433EF for ; Tue, 23 Nov 2021 21:07:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239712AbhKWVKZ (ORCPT ); Tue, 23 Nov 2021 16:10:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:40380 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239594AbhKWVKQ (ORCPT ); Tue, 23 Nov 2021 16:10:16 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0069660FE3; Tue, 23 Nov 2021 21:07:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701628; bh=4wuW/1YiilLk7lzlGptyP6drdNxu52X3SrhEokC6ZoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UaQkoTdotQad4hAXdPSzzbjfYMMi9h7z896skdPlVmenu7tYZ5nCR1f5yw1jm7WtR FH8G9TzRs+5qqG2+aVUh9zNwGDR0zq71ZbPxY1Bisk0R7GgIBH8v2ycWANIAdiSUx4 f3Dn5qgUjnBbUx5VtoTfP9z0cSzuAJ+0mmz4zooZNt1Pep4Jt9rk1YQWyJHz1HmcS0 BkmQXHrL467K5OmjjvRXfURT09Cv1Z5str1kAQ059QUcRVRDrHiCCzPG4N87HgIe4G BLIJeJY0szNs93vHy5jYpUpsq5UVcMNSjZwwrcSAghbY/Tubf+dqQ3vaTIeGNrDFpw fEUnDHFVM+O7g== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 39/49] iio:magn:mmc35240: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:09 +0000 Message-Id: <20211123211019.2271440-40-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_SLEEP support is simpler and less error prone than the use of #ifdef based config guards. Also use SIMPLE_DEV_PM_OPS instead of open-coding the equivalent. Removing instances of this approach from IIO also stops them being copied into new drivers. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/magnetometer/mmc35240.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/magnetometer/mmc35240.c b/drivers/iio/magnetometer/mmc35240.c index 65f3d1ed0d59..57ecb6adeb1b 100644 --- a/drivers/iio/magnetometer/mmc35240.c +++ b/drivers/iio/magnetometer/mmc35240.c @@ -521,8 +521,7 @@ static int mmc35240_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int mmc35240_suspend(struct device *dev) +static __maybe_unused int mmc35240_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mmc35240_data *data = iio_priv(indio_dev); @@ -532,7 +531,7 @@ static int mmc35240_suspend(struct device *dev) return 0; } -static int mmc35240_resume(struct device *dev) +static __maybe_unused int mmc35240_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct mmc35240_data *data = iio_priv(indio_dev); @@ -548,11 +547,8 @@ static int mmc35240_resume(struct device *dev) return 0; } -#endif -static const struct dev_pm_ops mmc35240_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(mmc35240_suspend, mmc35240_resume) -}; +static SIMPLE_DEV_PM_OPS(mmc35240_pm_ops, mmc35240_suspend, mmc35240_resume); static const struct of_device_id mmc35240_of_match[] = { { .compatible = "memsic,mmc35240", }, @@ -576,7 +572,7 @@ static struct i2c_driver mmc35240_driver = { .driver = { .name = MMC35240_DRV_NAME, .of_match_table = mmc35240_of_match, - .pm = &mmc35240_pm_ops, + .pm = pm_ptr(&mmc35240_pm_ops), .acpi_match_table = ACPI_PTR(mmc35240_acpi_match), }, .probe = mmc35240_probe, From patchwork Tue Nov 23 21:10:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635429 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 3FC75C433EF for ; Tue, 23 Nov 2021 21:07:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239571AbhKWVK0 (ORCPT ); Tue, 23 Nov 2021 16:10:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:40394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239728AbhKWVKS (ORCPT ); Tue, 23 Nov 2021 16:10:18 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CDACF60FC1; Tue, 23 Nov 2021 21:07:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701630; bh=n8ZK+v3kjyN+iI9/lY9Rj7gjEyJKxUFaRfgmFFpG3Kc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tzesbO9i6s87Aa1dnWhs6sTuX69viigTOGojpv0at8dTf6wEb1V6j4KEMtgRLaRYF 5zvfVw28KkXdAMai6oV21R03KgkZn989W9lhdVb/+zYlJtJrDPfcjRZOrHqisaUypD 5miGcdDOCIzu/7EOELC5LSCXusgAQmJarrAkoD0UAOTeQ5yeOyuLZW9qMW1KCO/MeS Mv5u1dkSJrz6tOImUruG59huYUCYs6GSQiH1JTGeTTrq5HudII6NhyOjcq8XD13IlJ XWuV33R+HZmslh3kDQTb+hUE8qm9n2u9k8T6hVDg/+aKBLpnMGEDZjIkl7e/vlOTUM l9+142Hdvoclw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 40/49] iio:pressure:mpl3115: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:10 +0000 Message-Id: <20211123211019.2271440-41-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/pressure/mpl3115.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/iio/pressure/mpl3115.c b/drivers/iio/pressure/mpl3115.c index e95b9a5475b4..8148655537c9 100644 --- a/drivers/iio/pressure/mpl3115.c +++ b/drivers/iio/pressure/mpl3115.c @@ -301,14 +301,13 @@ static int mpl3115_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int mpl3115_suspend(struct device *dev) +static __maybe_unused int mpl3115_suspend(struct device *dev) { return mpl3115_standby(iio_priv(i2c_get_clientdata( to_i2c_client(dev)))); } -static int mpl3115_resume(struct device *dev) +static __maybe_unused int mpl3115_resume(struct device *dev) { struct mpl3115_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -318,10 +317,6 @@ static int mpl3115_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(mpl3115_pm_ops, mpl3115_suspend, mpl3115_resume); -#define MPL3115_PM_OPS (&mpl3115_pm_ops) -#else -#define MPL3115_PM_OPS NULL -#endif static const struct i2c_device_id mpl3115_id[] = { { "mpl3115", 0 }, @@ -339,7 +334,7 @@ static struct i2c_driver mpl3115_driver = { .driver = { .name = "mpl3115", .of_match_table = mpl3115_of_match, - .pm = MPL3115_PM_OPS, + .pm = pm_ptr(&mpl3115_pm_ops), }, .probe = mpl3115_probe, .remove = mpl3115_remove, From patchwork Tue Nov 23 21:10:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635425 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 D6BCAC433F5 for ; Tue, 23 Nov 2021 21:07:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239659AbhKWVKY (ORCPT ); Tue, 23 Nov 2021 16:10:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:40398 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239859AbhKWVKU (ORCPT ); Tue, 23 Nov 2021 16:10:20 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C45460FE7; Tue, 23 Nov 2021 21:07:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701632; bh=sKWuV7l7ZDhygRgQvyQCxcVkH5PmDnsa9hQNtgcUDNg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SbIwBnOlbeMYWmgABeCwHd+nq6bF749OKJD7jo/3viedll0H2aFVDdOmT1ddqIOlu TQAP+AmK6kiCCGxx6sBoztOdF6PKmOhbQSXCX3FwVCy6/1ZMprNc9o51xStGsqpyUP DADfQjUuh1mApjovWmEq08pjfqQSLkRhqtVEELqKCX1lWEPo7WuwW9ZJ56X7RtHlZI I7RYEVtrOzfqEbHPLV8Wyar/cv3M7OEAdl5WQ/99huQkfJq/tKNalbK9KQDnE6k+M2 6fG8rm9kRadzPvLbl8C4vcYEJTl1xh9KO82QDlRZGhnvQfEvC+mSEQjLVkmlH0Myy+ GjYLWg1uFt6dw== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Linus Walleij Subject: [PATCH 41/49] iio:pressure:bmp280: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:11 +0000 Message-Id: <20211123211019.2271440-42-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: Linus Walleij Reviewed-by: Linus Walleij --- drivers/iio/pressure/bmp280-core.c | 6 ++---- drivers/iio/pressure/bmp280-i2c.c | 2 +- drivers/iio/pressure/bmp280-spi.c | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/pressure/bmp280-core.c b/drivers/iio/pressure/bmp280-core.c index 6b7da40f99c8..0653e1ea88da 100644 --- a/drivers/iio/pressure/bmp280-core.c +++ b/drivers/iio/pressure/bmp280-core.c @@ -1138,8 +1138,7 @@ int bmp280_common_probe(struct device *dev, } EXPORT_SYMBOL(bmp280_common_probe); -#ifdef CONFIG_PM -static int bmp280_runtime_suspend(struct device *dev) +static __maybe_unused int bmp280_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmp280_data *data = iio_priv(indio_dev); @@ -1147,7 +1146,7 @@ static int bmp280_runtime_suspend(struct device *dev) return regulator_bulk_disable(BMP280_NUM_SUPPLIES, data->supplies); } -static int bmp280_runtime_resume(struct device *dev) +static __maybe_unused int bmp280_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct bmp280_data *data = iio_priv(indio_dev); @@ -1159,7 +1158,6 @@ static int bmp280_runtime_resume(struct device *dev) usleep_range(data->start_up_time, data->start_up_time + 100); return data->chip_info->chip_config(data); } -#endif /* CONFIG_PM */ const struct dev_pm_ops bmp280_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, diff --git a/drivers/iio/pressure/bmp280-i2c.c b/drivers/iio/pressure/bmp280-i2c.c index 8b03ea15c0d0..35045bd92846 100644 --- a/drivers/iio/pressure/bmp280-i2c.c +++ b/drivers/iio/pressure/bmp280-i2c.c @@ -58,7 +58,7 @@ static struct i2c_driver bmp280_i2c_driver = { .driver = { .name = "bmp280", .of_match_table = bmp280_of_i2c_match, - .pm = &bmp280_dev_pm_ops, + .pm = pm_ptr(&bmp280_dev_pm_ops), }, .probe = bmp280_i2c_probe, .id_table = bmp280_i2c_id, diff --git a/drivers/iio/pressure/bmp280-spi.c b/drivers/iio/pressure/bmp280-spi.c index 625b86878ad8..41f6cc56d229 100644 --- a/drivers/iio/pressure/bmp280-spi.c +++ b/drivers/iio/pressure/bmp280-spi.c @@ -109,7 +109,7 @@ static struct spi_driver bmp280_spi_driver = { .driver = { .name = "bmp280", .of_match_table = bmp280_of_spi_match, - .pm = &bmp280_dev_pm_ops, + .pm = pm_ptr(&bmp280_dev_pm_ops), }, .id_table = bmp280_spi_id, .probe = bmp280_spi_probe, From patchwork Tue Nov 23 21:10:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635433 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 11D81C433EF for ; Tue, 23 Nov 2021 21:07:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239716AbhKWVK2 (ORCPT ); Tue, 23 Nov 2021 16:10:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:40416 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239697AbhKWVKW (ORCPT ); Tue, 23 Nov 2021 16:10:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 97CB660FD8; Tue, 23 Nov 2021 21:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701634; bh=vBB2NZWycv1kmd2HSobY/TLiEQ0drqU/c2g3st1MkLQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TWFChkIU1qJ4rfWzwLIED1yafdofGQty4JryddG+b9OzzZgDTmaB3/NzCwjMdTgCL qiVAN35U8VHbsz4OByljrh88aXNDUJeJgqFaO4aRWTuGhVbDzzGmCtsTN7gRa1TwNi 7ceKVCy74FTNsktUDNLtm1Z3emR/1DiZvXI09DwSRS2IjYGPhWTk2LTpX1G1sECehu 4TR1WffWNcO78QbLwA/JkQljGIsOPmTDivV07eWSGOIrC+gdoWlZGe2tqM5sNcHgBd rCbDOsj0iU6YHkeIZA/KWXGWqYW9Bzb4DGmhBf6TaeuoFB/A8depi2sFNDTI4ueZMJ OsA/Ry6+VgIOg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Matt Ranostay Subject: [PATCH 42/49] iio:proximity:as3935: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:12 +0000 Message-Id: <20211123211019.2271440-43-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Matt Ranostay Acked-by: Matt Ranostay --- drivers/iio/proximity/as3935.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/drivers/iio/proximity/as3935.c b/drivers/iio/proximity/as3935.c index d62766b6b39e..605c6095d704 100644 --- a/drivers/iio/proximity/as3935.c +++ b/drivers/iio/proximity/as3935.c @@ -295,8 +295,7 @@ static void calibrate_as3935(struct as3935_state *st) as3935_write(st, AS3935_NFLWDTH, st->nflwdth_reg); } -#ifdef CONFIG_PM_SLEEP -static int as3935_suspend(struct device *dev) +static __maybe_unused int as3935_suspend(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct as3935_state *st = iio_priv(indio_dev); @@ -316,7 +315,7 @@ static int as3935_suspend(struct device *dev) return ret; } -static int as3935_resume(struct device *dev) +static __maybe_unused int as3935_resume(struct device *dev) { struct iio_dev *indio_dev = dev_get_drvdata(dev); struct as3935_state *st = iio_priv(indio_dev); @@ -338,11 +337,6 @@ static int as3935_resume(struct device *dev) } static SIMPLE_DEV_PM_OPS(as3935_pm_ops, as3935_suspend, as3935_resume); -#define AS3935_PM_OPS (&as3935_pm_ops) - -#else -#define AS3935_PM_OPS NULL -#endif static void as3935_stop_work(void *data) { @@ -472,7 +466,7 @@ static struct spi_driver as3935_driver = { .driver = { .name = "as3935", .of_match_table = as3935_of_match, - .pm = AS3935_PM_OPS, + .pm = pm_ptr(&as3935_pm_ops), }, .probe = as3935_probe, .id_table = as3935_id, From patchwork Tue Nov 23 21:10:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635435 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 E0DA0C4332F for ; Tue, 23 Nov 2021 21:07:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239697AbhKWVKa (ORCPT ); Tue, 23 Nov 2021 16:10:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:40426 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239635AbhKWVKZ (ORCPT ); Tue, 23 Nov 2021 16:10:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A3C766023D; Tue, 23 Nov 2021 21:07:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701636; bh=1h2ZngHrSurqRcGyTzrdC7RJlzxn0swjgFcC6yUGkT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G/1PulOmA5L0QlRP4zIe8HkBirNy0tbe++LW8WK/UELTXQJl6RZBCXLQRWcTYb26T 8Q0FxAeviNp4PLV6i32egI2q6mVdrGxQ3pB+rLzSpLqQo3WUz6UNcCoVAeg5a7bTLC MhF0X8SjJakauFhhLGlHjxTI2foNGShv60XyFZVXLNz/tgLnI7kConbb74K2Uh+b/V TpYC1ZBxFUFUhQCF/19jRMvsVbT1q86yQoOuHZJ+KABArGsHTYTeyoggLdfSTjNOxA uCSn3qtj3DvVDIv5mJ0eswFg01lmTt4JS2tcwfSSAP+TLWMoaF4774GvXN9/xrURmb ozfIHwqNGC/SA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Matt Ranostay Subject: [PATCH 43/49] iio:proximity:pulsedlight: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:13 +0000 Message-Id: <20211123211019.2271440-44-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 Acked-by: Matt Ranostay --- drivers/iio/proximity/pulsedlight-lidar-lite-v2.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c index 27026c060ab9..6adc2a0c27cb 100644 --- a/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c +++ b/drivers/iio/proximity/pulsedlight-lidar-lite-v2.c @@ -338,8 +338,7 @@ static const struct of_device_id lidar_dt_ids[] = { }; MODULE_DEVICE_TABLE(of, lidar_dt_ids); -#ifdef CONFIG_PM -static int lidar_pm_runtime_suspend(struct device *dev) +static __maybe_unused int lidar_pm_runtime_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct lidar_data *data = iio_priv(indio_dev); @@ -347,7 +346,7 @@ static int lidar_pm_runtime_suspend(struct device *dev) return lidar_write_power(data, 0x0f); } -static int lidar_pm_runtime_resume(struct device *dev) +static __maybe_unused int lidar_pm_runtime_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct lidar_data *data = iio_priv(indio_dev); @@ -358,9 +357,8 @@ static int lidar_pm_runtime_resume(struct device *dev) return ret; } -#endif -static const struct dev_pm_ops lidar_pm_ops = { +static __maybe_unused const struct dev_pm_ops lidar_pm_ops = { SET_RUNTIME_PM_OPS(lidar_pm_runtime_suspend, lidar_pm_runtime_resume, NULL) }; @@ -369,7 +367,7 @@ static struct i2c_driver lidar_driver = { .driver = { .name = LIDAR_DRV_NAME, .of_match_table = lidar_dt_ids, - .pm = &lidar_pm_ops, + .pm = pm_ptr(&lidar_pm_ops), }, .probe = lidar_probe, .remove = lidar_remove, From patchwork Tue Nov 23 21:10:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635437 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 DCB1DC433F5 for ; Tue, 23 Nov 2021 21:07:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240287AbhKWVKa (ORCPT ); Tue, 23 Nov 2021 16:10:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:40452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239711AbhKWVK0 (ORCPT ); Tue, 23 Nov 2021 16:10:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id C832F60FE6; Tue, 23 Nov 2021 21:07:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701638; bh=5LtgAxXohh70ur3tDRHwz++fztttROg74AfN39J5tpo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QF+8fFrG9KT7IpBivJQz4Qa+BYaar4S+/RQ3YXJdTFMxxs1cYE9PTwyK210E1G5B/ o2SYLMJiczjaD2huE25rd0wViDhCKxlo/lLU5z+hychzWpaOTOZSinhULoI2R9cxd/ Q04ZDKQhhDWrBIEOJh6Qap+h8G3GTZfT4LcOCr2BK/4OjnVcPV0p39orLwwnzAJzui aDESWpny+H6JfyBSorDEN6SJb7XS3eupsU5H5w1VXRxii4zcgN8yzz/Q6TO1GxDoyj fGLWKVSE2yT3T61XvOTrq24HHAlOLAs9z0kXUyFc/15n7pgmD8Gc39VeOF0I9KF1pt 7BSDYLKArfy8w== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 44/49] iio:proximity:rfd77492: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:14 +0000 Message-Id: <20211123211019.2271440-45-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/proximity/rfd77402.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/proximity/rfd77402.c b/drivers/iio/proximity/rfd77402.c index 8c06d02139b6..456afeb71db1 100644 --- a/drivers/iio/proximity/rfd77402.c +++ b/drivers/iio/proximity/rfd77402.c @@ -295,17 +295,15 @@ static int rfd77402_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int rfd77402_suspend(struct device *dev) +static __maybe_unused int rfd77402_suspend(struct device *dev) { return rfd77402_powerdown(to_i2c_client(dev)); } -static int rfd77402_resume(struct device *dev) +static __maybe_unused int rfd77402_resume(struct device *dev) { return rfd77402_init(to_i2c_client(dev)); } -#endif static SIMPLE_DEV_PM_OPS(rfd77402_pm_ops, rfd77402_suspend, rfd77402_resume); @@ -318,7 +316,7 @@ MODULE_DEVICE_TABLE(i2c, rfd77402_id); static struct i2c_driver rfd77402_driver = { .driver = { .name = RFD77402_DRV_NAME, - .pm = &rfd77402_pm_ops, + .pm = pm_ptr(&rfd77402_pm_ops), }, .probe = rfd77402_probe, .id_table = rfd77402_id, From patchwork Tue Nov 23 21:10:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635439 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 000DDC433FE for ; Tue, 23 Nov 2021 21:07:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239711AbhKWVKb (ORCPT ); Tue, 23 Nov 2021 16:10:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:40466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239594AbhKWVK2 (ORCPT ); Tue, 23 Nov 2021 16:10:28 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A213560FC3; Tue, 23 Nov 2021 21:07:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701639; bh=zlRBJ8pu49A1c6EM4PdBJryTJ9odvWf9LcllmIqOBPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EcBoPkRv1Z+PhSlPCiqJtSl/CLXzVSpA3FkruxS16lTSGQgUmwG0321X8RaaiiANk x4IUymU0dlK+iAXNw8/Fb9iBmkTXWXSHe/Rc/wYVKF8Ihr14fN59LLDhFwTVOm6o1y pqxCDaEh5k74WfLbR5jGISSm37JX0H2EDiCzQrLKsDJrmNeVgTnRpeHI4wS65aiAES vCHWsOuYF2FNdyJhVOKrinlWFA04SE2M7//21+B06jEBxPg9y+usMDZDhvWTfFBnsx OAeeYMJ0+m1ubzFRJtXfQGqWOmnQRTGUHdGPDwXJf3HAx/Si9TFhFWds6mGsZ/eepj y1gXVs6Ms1WPA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 45/49] iio:proximity:sx9500: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:15 +0000 Message-Id: <20211123211019.2271440-46-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/proximity/sx9500.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/iio/proximity/sx9500.c b/drivers/iio/proximity/sx9500.c index 3e4ddb2e8c2b..f59bee2707ca 100644 --- a/drivers/iio/proximity/sx9500.c +++ b/drivers/iio/proximity/sx9500.c @@ -993,8 +993,7 @@ static int sx9500_remove(struct i2c_client *client) return 0; } -#ifdef CONFIG_PM_SLEEP -static int sx9500_suspend(struct device *dev) +static __maybe_unused int sx9500_suspend(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct sx9500_data *data = iio_priv(indio_dev); @@ -1017,7 +1016,7 @@ static int sx9500_suspend(struct device *dev) return ret; } -static int sx9500_resume(struct device *dev) +static __maybe_unused int sx9500_resume(struct device *dev) { struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev)); struct sx9500_data *data = iio_priv(indio_dev); @@ -1030,11 +1029,8 @@ static int sx9500_resume(struct device *dev) return ret; } -#endif /* CONFIG_PM_SLEEP */ -static const struct dev_pm_ops sx9500_pm_ops = { - SET_SYSTEM_SLEEP_PM_OPS(sx9500_suspend, sx9500_resume) -}; +static SIMPLE_DEV_PM_OPS(sx9500_pm_ops, sx9500_suspend, sx9500_resume); static const struct acpi_device_id sx9500_acpi_match[] = { {"SSX9500", 0}, @@ -1060,7 +1056,7 @@ static struct i2c_driver sx9500_driver = { .name = SX9500_DRIVER_NAME, .acpi_match_table = ACPI_PTR(sx9500_acpi_match), .of_match_table = of_match_ptr(sx9500_of_match), - .pm = &sx9500_pm_ops, + .pm = pm_ptr(&sx9500_pm_ops), }, .probe = sx9500_probe, .remove = sx9500_remove, From patchwork Tue Nov 23 21:10:16 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635441 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 CC9E1C433F5 for ; Tue, 23 Nov 2021 21:07:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239594AbhKWVKd (ORCPT ); Tue, 23 Nov 2021 16:10:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:40468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239859AbhKWVKa (ORCPT ); Tue, 23 Nov 2021 16:10:30 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 647A360FC1; Tue, 23 Nov 2021 21:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701641; bh=RP7Gu9UT6Yh2RoNNNNIQ+sAlrgRpgy7qPy5NzZu3qYg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gDWvEIbHFNPwSYQswJiMGc97tu056kfq1kFwlglY96fqpovf7e2m+WAIQGZ+QGJ+/ Bfvo2wtzUMMLiLAet/krwJRrHZQ+3sMKagSZlZeU4xNFXlls5Hz+7wluuAhOWTYYID N/oY7ev51bOF617pDTtl+3FlUyEkY00Tod+vxJkvIPrIe8x/PiywZpLZ80aoIhyxC2 Q3Z5RF/jVM2tg2SiTZrl6N6KTL86WUiB5ByU6A9UkUdSHSdi6+onxGfdInL8qIN06Q 7ywc7vxi7NkFMGayU2kG61NAuf6oi7YQXvKJvAo7Euy8BXVo5Y2bRlAOPhVFez/suP COo+mGs8aFYSg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron Subject: [PATCH 46/49] iio:temperature:tmp006: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:16 +0000 Message-Id: <20211123211019.2271440-47-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron --- drivers/iio/temperature/tmp006.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/temperature/tmp006.c b/drivers/iio/temperature/tmp006.c index e4943a0bc9aa..beac388e56f5 100644 --- a/drivers/iio/temperature/tmp006.c +++ b/drivers/iio/temperature/tmp006.c @@ -261,17 +261,15 @@ static int tmp006_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int tmp006_suspend(struct device *dev) +static __maybe_unused int tmp006_suspend(struct device *dev) { return tmp006_power(dev, false); } -static int tmp006_resume(struct device *dev) +static __maybe_unused int tmp006_resume(struct device *dev) { return tmp006_power(dev, true); } -#endif static SIMPLE_DEV_PM_OPS(tmp006_pm_ops, tmp006_suspend, tmp006_resume); @@ -284,7 +282,7 @@ MODULE_DEVICE_TABLE(i2c, tmp006_id); static struct i2c_driver tmp006_driver = { .driver = { .name = "tmp006", - .pm = &tmp006_pm_ops, + .pm = pm_ptr(&tmp006_pm_ops), }, .probe = tmp006_probe, .id_table = tmp006_id, From patchwork Tue Nov 23 21:10:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635445 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 CC795C433EF for ; Tue, 23 Nov 2021 21:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240334AbhKWVKi (ORCPT ); Tue, 23 Nov 2021 16:10:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:40474 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239635AbhKWVKd (ORCPT ); Tue, 23 Nov 2021 16:10:33 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0AC3460FE7; Tue, 23 Nov 2021 21:07:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701643; bh=867xwiImbbcYCPHk9Q7wJlRPxcEFxSBNxxo/sqbKcB8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nlgDJFNuTZYlzGmUfvTa4oKLpQmlku9by2ek308M5/L+51HvCa0pR28asiC1Ae3mT bMzg5ddxULI/jqDbOOdRoIYJ80NZT6s4MW3TyPqX0jxHkItAlYwz+xis6xBIe9E72q HWaM2tlF0rxQ3yNyMX5XKWRvlMmIpV4kBzTUOJ4btD19N3JxtWomYF2lQo/jIUbvTo MgzKAnYl0HqwjZKZZ5JBrhIu8/4qXftNNlEExG2bfTMSy4E+ilkTf79DdsrMVUxrpE RHVopG66FmYAugiPVKtTESU78Q6s4gh/OdrhNKW7I6vuN3RbxyaP1Oib9cPYvgDKQX 7Lw/FI+kWkyUg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Manivannan Sadhasivam Subject: [PATCH 47/49] iio:temperature:tmp007: Switch from CONFIG_PM_SLEEP guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:17 +0000 Message-Id: <20211123211019.2271440-48-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_SLEEP 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. The pm_ptr() macro only removes the reference if CONFIG_PM is not set. It is possible for CONFIG_PM=y without CONFIG_SLEEP, so this will not always remove the pm_ops structure. Signed-off-by: Jonathan Cameron Cc: Manivannan Sadhasivam --- drivers/iio/temperature/tmp007.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/iio/temperature/tmp007.c b/drivers/iio/temperature/tmp007.c index b422371a4674..9a1b7f63500e 100644 --- a/drivers/iio/temperature/tmp007.c +++ b/drivers/iio/temperature/tmp007.c @@ -537,8 +537,7 @@ static int tmp007_probe(struct i2c_client *client, return devm_iio_device_register(&client->dev, indio_dev); } -#ifdef CONFIG_PM_SLEEP -static int tmp007_suspend(struct device *dev) +static __maybe_unused int tmp007_suspend(struct device *dev) { struct tmp007_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -546,7 +545,7 @@ static int tmp007_suspend(struct device *dev) return tmp007_powerdown(data); } -static int tmp007_resume(struct device *dev) +static __maybe_unused int tmp007_resume(struct device *dev) { struct tmp007_data *data = iio_priv(i2c_get_clientdata( to_i2c_client(dev))); @@ -554,7 +553,6 @@ static int tmp007_resume(struct device *dev) return i2c_smbus_write_word_swapped(data->client, TMP007_CONFIG, data->config | TMP007_CONFIG_CONV_EN); } -#endif static SIMPLE_DEV_PM_OPS(tmp007_pm_ops, tmp007_suspend, tmp007_resume); @@ -574,7 +572,7 @@ static struct i2c_driver tmp007_driver = { .driver = { .name = "tmp007", .of_match_table = tmp007_of_match, - .pm = &tmp007_pm_ops, + .pm = pm_ptr(&tmp007_pm_ops), }, .probe = tmp007_probe, .id_table = tmp007_id, From patchwork Tue Nov 23 21:10:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635443 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 5C19DC433F5 for ; Tue, 23 Nov 2021 21:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239728AbhKWVKf (ORCPT ); Tue, 23 Nov 2021 16:10:35 -0500 Received: from mail.kernel.org ([198.145.29.99]:40484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240334AbhKWVKe (ORCPT ); Tue, 23 Nov 2021 16:10:34 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1619260FE8; Tue, 23 Nov 2021 21:07:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701645; bh=mBjZPkhTJAlcqWthrXDVyp7eMz51l6280njDVIvnVt0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MwwsmAzSQwHvBQp6YKWc0fCPfVkuj149Rse7R34oAWaNID170xzDik4KCa881EI/Y clCX2UYat5vvi8WRRBSVDq4t5cMmYvKfkybcmVGqXQho9tsemC3HtGmqDbHOYoTb/H 2S+cYloGMIYSqga8rwmkGETUKoUQeQdXhzljJUiPMrLbg2ilkPP8DKPoepG85u0Axw W80NNuVNbtRc+99h4l/kygCBti1H9pAGZYNGeVQlso6lUBbCDzq0WqsFO37XOiA+05 tNIYqumQkn8J5ULU5uMQUlpCbxLNSSM3cAu3j3iE5Vu9nI6TVCfcJBMRbEBXOZ6Kyo Gd4VXuLzvufdg== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Linus Walleij Subject: [PATCH 48/49] iio:gyro:mpu3050: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:18 +0000 Message-Id: <20211123211019.2271440-49-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: Linus Walleij Reviewed-by: Linus Walleij --- drivers/iio/gyro/mpu3050-core.c | 8 +++----- drivers/iio/gyro/mpu3050-i2c.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/gyro/mpu3050-core.c b/drivers/iio/gyro/mpu3050-core.c index ea387efab62d..4ec107b9e779 100644 --- a/drivers/iio/gyro/mpu3050-core.c +++ b/drivers/iio/gyro/mpu3050-core.c @@ -1281,19 +1281,17 @@ int mpu3050_common_remove(struct device *dev) } EXPORT_SYMBOL(mpu3050_common_remove); -#ifdef CONFIG_PM -static int mpu3050_runtime_suspend(struct device *dev) +static __maybe_unused int mpu3050_runtime_suspend(struct device *dev) { return mpu3050_power_down(iio_priv(dev_get_drvdata(dev))); } -static int mpu3050_runtime_resume(struct device *dev) +static __maybe_unused int mpu3050_runtime_resume(struct device *dev) { return mpu3050_power_up(iio_priv(dev_get_drvdata(dev))); } -#endif /* CONFIG_PM */ -const struct dev_pm_ops mpu3050_dev_pm_ops = { +const __maybe_unused struct dev_pm_ops mpu3050_dev_pm_ops = { SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume) SET_RUNTIME_PM_OPS(mpu3050_runtime_suspend, diff --git a/drivers/iio/gyro/mpu3050-i2c.c b/drivers/iio/gyro/mpu3050-i2c.c index ef5bcbc4b45b..820133cad601 100644 --- a/drivers/iio/gyro/mpu3050-i2c.c +++ b/drivers/iio/gyro/mpu3050-i2c.c @@ -114,7 +114,7 @@ static struct i2c_driver mpu3050_i2c_driver = { .driver = { .of_match_table = mpu3050_i2c_of_match, .name = "mpu3050-i2c", - .pm = &mpu3050_dev_pm_ops, + .pm = pm_ptr(&mpu3050_dev_pm_ops), }, }; module_i2c_driver(mpu3050_i2c_driver); From patchwork Tue Nov 23 21:10:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Cameron X-Patchwork-Id: 12635447 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 E5DD9C4332F for ; Tue, 23 Nov 2021 21:07:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239635AbhKWVKi (ORCPT ); Tue, 23 Nov 2021 16:10:38 -0500 Received: from mail.kernel.org ([198.145.29.99]:40494 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239859AbhKWVKg (ORCPT ); Tue, 23 Nov 2021 16:10:36 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3B0F260FC3; Tue, 23 Nov 2021 21:07:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637701647; bh=3WMSH2p9hgrSj0O6WilIfR05MT5zELoGQ0clNxa4FWM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CNMgbUQuiFqpjP5Mrsj1MxaeOFmNUoddaOrgP/loatueOlW2P2q9exYmzuAWaawT7 wVdOMOh9lmmlmMlBzGlsVAwowHn9d1PVM1ogOWgvknWSaxQrMCsu233GJ80OPpAUc7 0KovNf0/z09jHPQkYibWchA36O7TOHIw5UEEf7sLxIW5IJJo3aDpJ+BTD/EP8h2XD5 Syxs0g5vySnr8dCKysJUA3fDTbXtwiS4XVGd4EZzBjD9f1sa09aKQpPQvzeir1Tq/D owluwNiMMX2aU4btwgD6ssifc7/3qROoX3LjWL/V0Q9ovwVP+q/5eqAILkT91gDXT9 5bvABcrrU3QNA== From: Jonathan Cameron To: linux-iio@vger.kernel.org Cc: Lars-Peter Clausen , Paul Cercueil , Jonathan Cameron , Matt Ranostay Subject: [PATCH 49/49] iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() / __maybe_unused Date: Tue, 23 Nov 2021 21:10:19 +0000 Message-Id: <20211123211019.2271440-50-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 Acked-by: Matt Ranostay --- drivers/iio/chemical/atlas-sensor.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/iio/chemical/atlas-sensor.c b/drivers/iio/chemical/atlas-sensor.c index 04b44a327614..7bacd0bd6f19 100644 --- a/drivers/iio/chemical/atlas-sensor.c +++ b/drivers/iio/chemical/atlas-sensor.c @@ -737,8 +737,7 @@ static int atlas_remove(struct i2c_client *client) return atlas_set_powermode(data, 0); } -#ifdef CONFIG_PM -static int atlas_runtime_suspend(struct device *dev) +static __maybe_unused int atlas_runtime_suspend(struct device *dev) { struct atlas_data *data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); @@ -746,16 +745,15 @@ static int atlas_runtime_suspend(struct device *dev) return atlas_set_powermode(data, 0); } -static int atlas_runtime_resume(struct device *dev) +static __maybe_unused int atlas_runtime_resume(struct device *dev) { struct atlas_data *data = iio_priv(i2c_get_clientdata(to_i2c_client(dev))); return atlas_set_powermode(data, 1); } -#endif -static const struct dev_pm_ops atlas_pm_ops = { +static __maybe_unused const struct dev_pm_ops atlas_pm_ops = { SET_RUNTIME_PM_OPS(atlas_runtime_suspend, atlas_runtime_resume, NULL) }; @@ -764,7 +762,7 @@ static struct i2c_driver atlas_driver = { .driver = { .name = ATLAS_DRV_NAME, .of_match_table = atlas_dt_ids, - .pm = &atlas_pm_ops, + .pm = pm_ptr(&atlas_pm_ops), }, .probe = atlas_probe, .remove = atlas_remove,