Skip to content

Commit 5981296

Browse files
avisconticfriedt
authored andcommitted
drivers/sensor: lis2mdl: Fix errors when CONFIG_PM_DEVICE=y
Fix a couple of issues related to Power Management: 1. A build error because 'dev' was used even if not declared in the caller routine scope 2. The lis2mdl power management init specific routine was not declared in in the device instance definition Signed-off-by: Armando Visconti <armando.visconti@st.com>
1 parent 26bd4fb commit 5981296

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/sensor/lis2mdl/lis2mdl.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,7 @@ static int lis2mdl_set_power_state(struct lis2mdl_data *lis2mdl,
450450
const struct lis2mdl_config *const config,
451451
enum pm_device_state new_state)
452452
{
453-
const struct lis2mdl_config *cfg = dev->config;
454-
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&cfg->ctx;
453+
stmdev_ctx_t *ctx = (stmdev_ctx_t *)&config->ctx;
455454
int status = 0;
456455

457456
if (new_state == PM_DEVICE_STATE_ACTIVE) {
@@ -523,7 +522,7 @@ static int lis2mdl_pm_control(const struct device *dev, uint32_t ctrl_command,
523522
#define LIS2MDL_DEVICE_INIT(inst) \
524523
DEVICE_DT_INST_DEFINE(inst, \
525524
lis2mdl_init, \
526-
NULL, \
525+
lis2mdl_pm_control, \
527526
&lis2mdl_data_##inst, \
528527
&lis2mdl_config_##inst, \
529528
POST_KERNEL, \

0 commit comments

Comments
 (0)