sysreset: Fix unsupported request return values

The description of the sysreset request method in <sysreset.h> says that
the return value should be -EPROTONOSUPPORT if the requested reset type
is not supported by this device.

Signed-off-by: Paul Barker <paul.barker.ct@bp.renesas.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Paul Barker 2023-11-08 08:51:10 +00:00 committed by Tom Rini
parent 15e871fc5d
commit da35ab68de
6 changed files with 9 additions and 9 deletions

View file

@ -33,7 +33,7 @@ static int poweroff_gpio_request(struct udevice *dev, enum sysreset_t type)
int r;
if (type != SYSRESET_POWER_OFF)
return -ENOSYS;
return -EPROTONOSUPPORT;
debug("GPIO poweroff\n");

View file

@ -25,7 +25,7 @@ static int psci_sysreset_request(struct udevice *dev, enum sysreset_t type)
psci_sys_poweroff();
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
return -EINPROGRESS;

View file

@ -21,7 +21,7 @@ static int sandbox_warm_sysreset_request(struct udevice *dev,
state->last_sysreset = type;
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
if (!state->sysreset_allowed[type])
return -EACCES;
@ -70,7 +70,7 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type)
return -EACCES;
sandbox_exit();
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
if (!state->sysreset_allowed[type])
return -EACCES;

View file

@ -29,7 +29,7 @@ static int wdt_reboot_request(struct udevice *dev, enum sysreset_t type)
return ret;
break;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
return -EINPROGRESS;

View file

@ -87,7 +87,7 @@ static int x86_sysreset_request(struct udevice *dev, enum sysreset_t type)
return ret;
return -EINPROGRESS;
default:
return -ENOSYS;
return -EPROTONOSUPPORT;
}
outb(value, IO_PORT_RESET);

View file

@ -27,8 +27,8 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
/* Device 1 is the warm sysreset device */
ut_assertok(uclass_get_device(UCLASS_SYSRESET, 1, &dev));
ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_WARM));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_COLD));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_POWER));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_COLD));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_POWER));
state->sysreset_allowed[SYSRESET_WARM] = true;
ut_asserteq(-EINPROGRESS, sysreset_request(dev, SYSRESET_WARM));
@ -36,7 +36,7 @@ static int dm_test_sysreset_base(struct unit_test_state *uts)
/* Device 2 is the cold sysreset device */
ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev));
ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_WARM));
ut_asserteq(-EPROTONOSUPPORT, sysreset_request(dev, SYSRESET_WARM));
state->sysreset_allowed[SYSRESET_COLD] = false;
ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_COLD));
state->sysreset_allowed[SYSRESET_COLD] = true;