diff mbox series

i2c: imx: Use __maybe_unused instead of #if CONFIG_PM

Message ID 1557026820-29428-1-git-send-email-Anson.Huang@nxp.com (mailing list archive)
State New, archived
Headers show
Series i2c: imx: Use __maybe_unused instead of #if CONFIG_PM | expand

Commit Message

Anson Huang May 5, 2019, 3:31 a.m. UTC
Use __maybe_unused for runtime PM related functions instead
of #if CONFIG_PM to simply the code.

Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
---
 drivers/i2c/busses/i2c-imx.c | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

Comments

Dong Aisheng May 5, 2019, 7:31 a.m. UTC | #1
> From: Anson Huang
> Sent: Sunday, May 5, 2019 11:32 AM
> Subject: [PATCH] i2c: imx: Use __maybe_unused instead of #if CONFIG_PM
> 
> Use __maybe_unused for runtime PM related functions instead of #if
> CONFIG_PM to simply the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Reviewed-by: Dong Aisheng <aisheng.dong@nxp.com>

Regards
Dong Aisheng
Wolfram Sang May 27, 2019, 7:06 p.m. UTC | #2
On Sun, May 05, 2019 at 03:31:55AM +0000, Anson Huang wrote:
> Use __maybe_unused for runtime PM related functions instead
> of #if CONFIG_PM to simply the code.
> 
> Signed-off-by: Anson Huang <Anson.Huang@nxp.com>

Applied to for-next, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index fd70b11..b1b8b93 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1220,8 +1220,7 @@  static int i2c_imx_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int i2c_imx_runtime_suspend(struct device *dev)
+static int __maybe_unused i2c_imx_runtime_suspend(struct device *dev)
 {
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 
@@ -1230,7 +1229,7 @@  static int i2c_imx_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int i2c_imx_runtime_resume(struct device *dev)
+static int __maybe_unused i2c_imx_runtime_resume(struct device *dev)
 {
 	struct imx_i2c_struct *i2c_imx = dev_get_drvdata(dev);
 	int ret;
@@ -1246,17 +1245,13 @@  static const struct dev_pm_ops i2c_imx_pm_ops = {
 	SET_RUNTIME_PM_OPS(i2c_imx_runtime_suspend,
 			   i2c_imx_runtime_resume, NULL)
 };
-#define I2C_IMX_PM_OPS (&i2c_imx_pm_ops)
-#else
-#define I2C_IMX_PM_OPS NULL
-#endif /* CONFIG_PM */
 
 static struct platform_driver i2c_imx_driver = {
 	.probe = i2c_imx_probe,
 	.remove = i2c_imx_remove,
 	.driver = {
 		.name = DRIVER_NAME,
-		.pm = I2C_IMX_PM_OPS,
+		.pm = &i2c_imx_pm_ops,
 		.of_match_table = i2c_imx_dt_ids,
 	},
 	.id_table = imx_i2c_devtype,