Skip to content

Commit

Permalink
watchdog: intel_adsp: fix num cpus
Browse files Browse the repository at this point in the history
This will allow to init watchdog on HW's supporting different
number of cpus and watchdogs based on runtime arch_num_cpus

Signed-off-by: Adrian Bonislawski <[email protected]>
  • Loading branch information
abonislawski authored and nashif committed Nov 29, 2023
1 parent f74f309 commit aa91ddb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/watchdog/wdt_intel_adsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static int intel_adsp_wdt_setup(const struct device *dev, uint8_t options)
return ret;
}

for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS; i++) {
for (i = 0; i < arch_num_cpus(); i++) {
ret = dw_wdt_configure(dev_data->core_wdt[i], dev_data->period_cfg);
if (ret) {
return ret;
Expand Down Expand Up @@ -120,7 +120,7 @@ static int intel_adsp_wdt_feed(const struct device *dev, int channel_id)
{
struct intel_adsp_wdt_dev_data *const dev_data = dev->data;

if (channel_id >= CONFIG_MP_MAX_NUM_CPUS) {
if (channel_id >= arch_num_cpus()) {
return -EINVAL;
}

Expand Down Expand Up @@ -154,7 +154,7 @@ static int intel_adsp_wdt_init(const struct device *dev)
unsigned int i;
int ret;

for (i = 0; i < CONFIG_MP_MAX_NUM_CPUS; i++) {
for (i = 0; i < arch_num_cpus(); i++) {
dev_data->core_wdt[i] = intel_adsp_wdt_pointer_get(dev_config->base, i);
ret = dw_wdt_probe(dev_data->core_wdt[i], reset_pulse_length);
if (ret) {
Expand Down Expand Up @@ -183,7 +183,7 @@ int intel_adsp_watchdog_pause(const struct device *dev, const int channel_id)
{
const struct intel_adsp_wdt_dev_cfg *const dev_config = dev->config;

if (channel_id >= CONFIG_MP_MAX_NUM_CPUS) {
if (channel_id >= arch_num_cpus()) {
return -EINVAL;
}

Expand All @@ -203,7 +203,7 @@ int intel_adsp_watchdog_resume(const struct device *dev, const int channel_id)
{
const struct intel_adsp_wdt_dev_cfg *const dev_config = dev->config;

if (channel_id >= CONFIG_MP_MAX_NUM_CPUS) {
if (channel_id >= arch_num_cpus()) {
return -EINVAL;
}

Expand Down

0 comments on commit aa91ddb

Please sign in to comment.