zephyr/drivers/timer/sys_clock_init.c
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00

54 lines
992 B
C

/*
* Copyright (c) 2015 Wind River Systems, Inc.
*
* SPDX-License-Identifier: Apache-2.0
*/
/**
* @file
* @brief Initialize system clock driver
*
* Initializing the timer driver is done in this module to reduce code
* duplication.
*/
#include <kernel.h>
#include <init.h>
#include <drivers/timer/system_timer.h>
/* Weak-linked noop defaults for optional driver interfaces: */
void __weak z_clock_isr(void *arg)
{
__ASSERT_NO_MSG(false);
}
int __weak z_clock_driver_init(const struct device *device)
{
ARG_UNUSED(device);
return 0;
}
int __weak z_clock_device_ctrl(const struct device *device,
uint32_t ctrl_command,
void *context, device_pm_cb cb, void *arg)
{
return -ENOTSUP;
}
void __weak z_clock_set_timeout(int32_t ticks, bool idle)
{
}
void __weak z_clock_idle_exit(void)
{
}
void __weak sys_clock_disable(void)
{
}
SYS_DEVICE_DEFINE("sys_clock", z_clock_driver_init, z_clock_device_ctrl,
PRE_KERNEL_2, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);