Commit 4f3523d9 authored by Fabio Baltieri's avatar Fabio Baltieri Committed by Benjamin Cabé
Browse files

i2c: stm32: drop few redundant guards



Drop few CONFIG_PM_DEVICE_RUNTIME guards, the pm_device_runtime
functions they are masking are no-op automatically when the
corresponding config option is not selected.

Signed-off-by: default avatarFabio Baltieri <fabiobaltieri@google.com>
parent 67f80e35
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -194,9 +194,7 @@ static int i2c_stm32_transfer(const struct device *dev, struct i2c_msg *msg,
	k_sem_take(&data->bus_mutex, K_FOREVER);

	/* Prevent driver from being suspended by PM until I2C transaction is complete */
#ifdef CONFIG_PM_DEVICE_RUNTIME
	(void)pm_device_runtime_get(dev);
#endif

	/* Prevent the clocks to be stopped during the i2c transaction */
	pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
@@ -220,9 +218,7 @@ static int i2c_stm32_transfer(const struct device *dev, struct i2c_msg *msg,

	pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);

#ifdef CONFIG_PM_DEVICE_RUNTIME
	(void)pm_device_runtime_put(dev);
#endif

	k_sem_give(&data->bus_mutex);

@@ -388,9 +384,7 @@ static int i2c_stm32_init(const struct device *dev)
		return ret;
	}

#ifdef CONFIG_PM_DEVICE_RUNTIME
	(void)pm_device_runtime_enable(dev);
#endif

	data->is_configured = true;

+0 −4
Original line number Diff line number Diff line
@@ -436,7 +436,6 @@ int i2c_stm32_target_register(const struct device *dev,
		return ret;
	}

#if defined(CONFIG_PM_DEVICE_RUNTIME)
	/* Mark device as active */
	(void)pm_device_runtime_get(dev);

@@ -445,7 +444,6 @@ int i2c_stm32_target_register(const struct device *dev,
		LOG_DBG("i2c: enabling wakeup from stop");
		LL_I2C_EnableWakeUpFromStop(cfg->i2c);
	}
#endif /* defined(CONFIG_PM_DEVICE_RUNTIME) */

	LL_I2C_Enable(i2c);

@@ -528,7 +526,6 @@ int i2c_stm32_target_unregister(const struct device *dev,
		LL_I2C_Disable(i2c);
	}

#if defined(CONFIG_PM_DEVICE_RUNTIME)
	if (pm_device_wakeup_is_capable(dev)) {
		/* Disable wake-up from STOP */
		LOG_DBG("i2c: disabling wakeup from stop");
@@ -537,7 +534,6 @@ int i2c_stm32_target_unregister(const struct device *dev,

	/* Release the device */
	(void)pm_device_runtime_put(dev);
#endif /* defined(CONFIG_PM_DEVICE_RUNTIME) */

	data->slave_attached = false;