pm: device: remove usage of local states
The device PM subsystem already holds the device state, so there is no need to keep duplicates inside the device. The pm_device_state_get has been refactored to just return the device state. Note that this is still not safe, but the same applied to the previous implementation. This problem will be addressed later. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
1c0ed94601
commit
c2cf1ad203
48 changed files with 198 additions and 715 deletions
|
@ -32,8 +32,6 @@ extern void *_VectorTable;
|
|||
#define _ARC_V2_IRQ_VECT_BASE _ARC_V2_IRQ_VECT_BASE_S
|
||||
#endif
|
||||
|
||||
static enum pm_device_state _arc_v2_irq_unit_device_power_state =
|
||||
PM_DEVICE_STATE_ACTIVE;
|
||||
struct arc_v2_irq_unit_ctx {
|
||||
uint32_t irq_ctrl; /* Interrupt Context Saving Control Register. */
|
||||
uint32_t irq_vect_base; /* Interrupt Vector Base. */
|
||||
|
@ -121,8 +119,6 @@ static int arc_v2_irq_unit_suspend(const struct device *dev)
|
|||
ctx.irq_ctrl = z_arc_v2_aux_reg_read(_ARC_V2_AUX_IRQ_CTRL);
|
||||
ctx.irq_vect_base = z_arc_v2_aux_reg_read(_ARC_V2_IRQ_VECT_BASE);
|
||||
|
||||
_arc_v2_irq_unit_device_power_state = PM_DEVICE_STATE_SUSPEND;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -167,23 +163,9 @@ static int arc_v2_irq_unit_resume(const struct device *dev)
|
|||
#endif
|
||||
z_arc_v2_aux_reg_write(_ARC_V2_IRQ_VECT_BASE, ctx.irq_vect_base);
|
||||
|
||||
_arc_v2_irq_unit_device_power_state = PM_DEVICE_STATE_ACTIVE;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Get the power state of interrupt unit
|
||||
*
|
||||
* @return the power state of interrupt unit
|
||||
*/
|
||||
static enum pm_device_state arc_v2_irq_unit_get_state(const struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return _arc_v2_irq_unit_device_power_state;
|
||||
}
|
||||
|
||||
/*
|
||||
* @brief Implement the driver control of interrupt unit
|
||||
*
|
||||
|
@ -205,8 +187,6 @@ static int arc_v2_irq_unit_device_ctrl(const struct device *dev,
|
|||
} else if (*state == PM_DEVICE_STATE_ACTIVE) {
|
||||
ret = arc_v2_irq_unit_resume(dev);
|
||||
}
|
||||
} else if (ctrl_command == PM_DEVICE_STATE_GET) {
|
||||
*state = arc_v2_irq_unit_get_state(dev);
|
||||
}
|
||||
|
||||
arch_irq_unlock(key);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue