Skip to content

Commit e38cc89

Browse files
rruuaanngkartben
authored andcommitted
drivers: counter: Fix incorrect error codes
Unimplemented interfaces should return -ENOSYS instead of -ENOTSUP. Signed-off-by: James Roy <[email protected]>
1 parent d9f3ee4 commit e38cc89

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

include/zephyr/drivers/counter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ static inline int z_impl_counter_get_value_64(const struct device *dev,
427427
(struct counter_driver_api *)dev->api;
428428

429429
if (!api->get_value_64) {
430-
return -ENOTSUP;
430+
return -ENOSYS;
431431
}
432432

433433
return api->get_value_64(dev, ticks);
@@ -650,7 +650,7 @@ static inline uint32_t z_impl_counter_get_top_value(const struct device *dev)
650650
* @param flags See @ref COUNTER_GUARD_PERIOD_FLAGS.
651651
*
652652
* @retval 0 if successful.
653-
* @retval -ENOTSUP if function or flags are not supported.
653+
* @retval -ENOSYS if function or flags are not supported.
654654
* @retval -EINVAL if ticks value is invalid.
655655
*/
656656
__syscall int counter_set_guard_period(const struct device *dev,
@@ -664,7 +664,7 @@ static inline int z_impl_counter_set_guard_period(const struct device *dev,
664664
(struct counter_driver_api *)dev->api;
665665

666666
if (!api->set_guard_period) {
667-
return -ENOTSUP;
667+
return -ENOSYS;
668668
}
669669

670670
return api->set_guard_period(dev, ticks, flags);

tests/drivers/counter/counter_basic_api/src/test_counter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ static bool late_detection_capable(const struct device *dev)
882882
int err = counter_set_guard_period(dev, guard,
883883
COUNTER_GUARD_PERIOD_LATE_TO_SET);
884884

885-
if (err == -ENOTSUP) {
885+
if (err == -ENOSYS) {
886886
return false;
887887
}
888888

0 commit comments

Comments
 (0)