Skip to content

Commit 4f3523d

Browse files
fabiobaltierikartben
authored andcommitted
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: Fabio Baltieri <fabiobaltieri@google.com>
1 parent 67f80e3 commit 4f3523d

File tree

2 files changed

+0
-10
lines changed

2 files changed

+0
-10
lines changed

drivers/i2c/i2c_ll_stm32.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ static int i2c_stm32_transfer(const struct device *dev, struct i2c_msg *msg,
194194
k_sem_take(&data->bus_mutex, K_FOREVER);
195195

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

201199
/* Prevent the clocks to be stopped during the i2c transaction */
202200
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,
220218

221219
pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES);
222220

223-
#ifdef CONFIG_PM_DEVICE_RUNTIME
224221
(void)pm_device_runtime_put(dev);
225-
#endif
226222

227223
k_sem_give(&data->bus_mutex);
228224

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

391-
#ifdef CONFIG_PM_DEVICE_RUNTIME
392387
(void)pm_device_runtime_enable(dev);
393-
#endif
394388

395389
data->is_configured = true;
396390

drivers/i2c/i2c_ll_stm32_v2.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,6 @@ int i2c_stm32_target_register(const struct device *dev,
436436
return ret;
437437
}
438438

439-
#if defined(CONFIG_PM_DEVICE_RUNTIME)
440439
/* Mark device as active */
441440
(void)pm_device_runtime_get(dev);
442441

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

450448
LL_I2C_Enable(i2c);
451449

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

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

538535
/* Release the device */
539536
(void)pm_device_runtime_put(dev);
540-
#endif /* defined(CONFIG_PM_DEVICE_RUNTIME) */
541537

542538
data->slave_attached = false;
543539

0 commit comments

Comments
 (0)