All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Cercueil <paul@crapouillou.net>
To: Wolfram Sang <wsa@kernel.org>
Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,
	Paul Cercueil <paul@crapouillou.net>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	Viresh Kumar <viresh.kumar@linaro.org>,
	Conghui Chen <conghui.chen@intel.com>,
	virtualization@lists.linux-foundation.org
Subject: [PATCH v2 21/22] i2c: virtio: Remove #ifdef guards for PM related functions
Date: Sat, 22 Jul 2023 13:53:09 +0200	[thread overview]
Message-ID: <20230722115310.27681-5-paul@crapouillou.net> (raw)
In-Reply-To: <20230722115046.27323-1-paul@crapouillou.net>

Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are disabled, without having to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>

---
Cc: Conghui Chen <conghui.chen@intel.com>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Cc: virtualization@lists.linux-foundation.org
---
 drivers/i2c/busses/i2c-virtio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c
index 4b9536f50800..c60ae531ba57 100644
--- a/drivers/i2c/busses/i2c-virtio.c
+++ b/drivers/i2c/busses/i2c-virtio.c
@@ -243,7 +243,6 @@ static struct virtio_device_id id_table[] = {
 };
 MODULE_DEVICE_TABLE(virtio, id_table);
 
-#ifdef CONFIG_PM_SLEEP
 static int virtio_i2c_freeze(struct virtio_device *vdev)
 {
 	virtio_i2c_del_vqs(vdev);
@@ -254,7 +253,6 @@ static int virtio_i2c_restore(struct virtio_device *vdev)
 {
 	return virtio_i2c_setup_vqs(vdev->priv);
 }
-#endif
 
 static const unsigned int features[] = {
 	VIRTIO_I2C_F_ZERO_LENGTH_REQUEST,
@@ -269,10 +267,8 @@ static struct virtio_driver virtio_i2c_driver = {
 	.driver			= {
 		.name	= "i2c_virtio",
 	},
-#ifdef CONFIG_PM_SLEEP
-	.freeze = virtio_i2c_freeze,
-	.restore = virtio_i2c_restore,
-#endif
+	.freeze			= pm_sleep_ptr(virtio_i2c_freeze),
+	.restore		= pm_sleep_ptr(virtio_i2c_restore),
 };
 module_virtio_driver(virtio_i2c_driver);
 
-- 
2.40.1


  parent reply	other threads:[~2023-07-22 11:59 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-22 11:50 [PATCH v2 00/22] i2c: Use new PM macros Paul Cercueil
2023-07-22 11:50 ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 01/22] i2c: au1550: Remove #ifdef guards for PM related functions Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 02/22] i2c: iproc: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 14:39   ` Florian Fainelli
2023-07-22 14:39     ` Florian Fainelli
2023-07-22 11:50 ` [PATCH v2 03/22] i2c: brcmstb: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 14:39   ` Florian Fainelli
2023-07-22 14:39     ` Florian Fainelli
2023-07-22 11:50 ` [PATCH v2 04/22] i2c: davinci: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-27  7:40   ` Bartosz Golaszewski
2023-07-27  7:40     ` Bartosz Golaszewski
2023-07-22 11:50 ` [PATCH v2 05/22] i2c: designware: " Paul Cercueil
2023-07-27 10:19   ` Jarkko Nikula
2023-07-22 11:50 ` [PATCH v2 06/22] i2c: exynos5: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 07/22] i2c: hix5hd2: " Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 08/22] i2c: i801: " Paul Cercueil
2023-08-10 15:25   ` Jean Delvare
2023-07-22 11:50 ` [PATCH v2 09/22] i2c: img-scb: " Paul Cercueil
2023-07-28 12:18   ` Andi Shyti
2023-07-22 11:50 ` [PATCH v2 10/22] i2c: kempld: Convert to use regular device PM Paul Cercueil
2023-07-28 12:19   ` Andi Shyti
2023-07-22 11:50 ` [PATCH v2 11/22] i2c: lpc2k: Remove #ifdef guards for PM related functions Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 12/22] i2c: mt65xx: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 13/22] i2c: nomadik: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 14/22] i2c: ocores: " Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 15/22] i2c: pnx: " Paul Cercueil
2023-07-22 11:50   ` Paul Cercueil
2023-07-22 11:50 ` [PATCH v2 16/22] i2c: pxa: " Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 17/22] i2c: qup: " Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 18/22] i2c: rcar: " Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 19/22] i2c: s3c2410: " Paul Cercueil
2023-07-22 11:53   ` Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 20/22] i2c: sh-mobile: " Paul Cercueil
2023-07-22 11:53 ` Paul Cercueil [this message]
2023-07-22 13:55   ` [PATCH v2 21/22] i2c: virtio: " kernel test robot
2023-07-22 13:55     ` kernel test robot
2023-07-22 15:07   ` kernel test robot
2023-07-22 15:07     ` kernel test robot
2023-07-22 19:06   ` Paul Cercueil
2023-07-22 11:53 ` [PATCH v2 22/22] i2c: mux: pca954x: " Paul Cercueil
2023-08-02 20:10 ` [PATCH v2 00/22] i2c: Use new PM macros Andi Shyti
2023-08-02 20:10   ` Andi Shyti
2023-08-14 15:06   ` Wolfram Sang
2023-08-14 15:06     ` Wolfram Sang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230722115310.27681-5-paul@crapouillou.net \
    --to=paul@crapouillou.net \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=conghui.chen@intel.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viresh.kumar@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wsa@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.