Browse Source

include/zephyr/drivers/clock_control: return `-ENOSYS` for empty `on`/`off`

There are in-tree clock controllers that don't implement the `on`/`off`
calls, e.g. in Intel Agilex. Let's return `-ENOSYS` when that's the case.

Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
(cherry picked from commit 5dbf61aeb8)
pull/89463/head
Filip Kokosinski 4 months ago committed by Benjamin Cabé
parent
commit
433f65fdbc
  1. 8
      include/zephyr/drivers/clock_control.h

8
include/zephyr/drivers/clock_control.h

@ -128,6 +128,10 @@ static inline int clock_control_on(const struct device *dev,
const struct clock_control_driver_api *api = const struct clock_control_driver_api *api =
(const struct clock_control_driver_api *)dev->api; (const struct clock_control_driver_api *)dev->api;
if (api->on == NULL) {
return -ENOSYS;
}
return api->on(dev, sys); return api->on(dev, sys);
} }
@ -147,6 +151,10 @@ static inline int clock_control_off(const struct device *dev,
const struct clock_control_driver_api *api = const struct clock_control_driver_api *api =
(const struct clock_control_driver_api *)dev->api; (const struct clock_control_driver_api *)dev->api;
if (api->off == NULL) {
return -ENOSYS;
}
return api->off(dev, sys); return api->off(dev, sys);
} }

Loading…
Cancel
Save