Commit 5dbf61ae authored by Filip Kokosinski's avatar Filip Kokosinski Committed by Benjamin Cabé
Browse files

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: default avatarFilip Kokosinski <fkokosinski@antmicro.com>
parent 8286db1a
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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 *)dev->api;

	if (api->on == NULL) {
		return -ENOSYS;
	}

	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 *)dev->api;

	if (api->off == NULL) {
		return -ENOSYS;
	}

	return api->off(dev, sys);
}