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>
This commit is contained in:
parent
c8906fef79
commit
e18fcbba5a
1426 changed files with 9356 additions and 8368 deletions
|
@ -11,10 +11,10 @@
|
|||
* instance and return an integral value
|
||||
*/
|
||||
#define COUNTER_HANDLER(name) \
|
||||
static inline int z_vrfy_counter_##name(struct device *dev) \
|
||||
static inline int z_vrfy_counter_##name(const struct device *dev) \
|
||||
{ \
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, name)); \
|
||||
return z_impl_counter_ ## name((struct device *)dev); \
|
||||
return z_impl_counter_ ## name((const struct device *)dev); \
|
||||
}
|
||||
|
||||
COUNTER_HANDLER(get_pending_int)
|
||||
|
@ -64,17 +64,18 @@ static inline uint64_t z_vrfy_counter_ticks_to_us(const struct device *dev,
|
|||
}
|
||||
#include <syscalls/counter_ticks_to_us_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_counter_get_value(struct device *dev,
|
||||
static inline int z_vrfy_counter_get_value(const struct device *dev,
|
||||
uint32_t *ticks)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_value));
|
||||
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(ticks, sizeof(*ticks)));
|
||||
return z_impl_counter_get_value((struct device *)dev, ticks);
|
||||
return z_impl_counter_get_value((const struct device *)dev, ticks);
|
||||
}
|
||||
#include <syscalls/counter_get_value_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_counter_set_channel_alarm(struct device *dev,
|
||||
uint8_t chan_id, const struct counter_alarm_cfg *alarm_cfg)
|
||||
static inline int z_vrfy_counter_set_channel_alarm(const struct device *dev,
|
||||
uint8_t chan_id,
|
||||
const struct counter_alarm_cfg *alarm_cfg)
|
||||
{
|
||||
struct counter_alarm_cfg cfg_copy;
|
||||
|
||||
|
@ -82,22 +83,23 @@ static inline int z_vrfy_counter_set_channel_alarm(struct device *dev,
|
|||
Z_OOPS(z_user_from_copy(&cfg_copy, alarm_cfg, sizeof(cfg_copy)));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == 0,
|
||||
"callbacks may not be set from user mode"));
|
||||
return z_impl_counter_set_channel_alarm((struct device *)dev,
|
||||
(uint8_t)chan_id, (const struct counter_alarm_cfg *)&cfg_copy);
|
||||
return z_impl_counter_set_channel_alarm((const struct device *)dev,
|
||||
(uint8_t)chan_id,
|
||||
(const struct counter_alarm_cfg *)&cfg_copy);
|
||||
|
||||
}
|
||||
#include <syscalls/counter_set_channel_alarm_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_counter_cancel_channel_alarm(struct device *dev,
|
||||
static inline int z_vrfy_counter_cancel_channel_alarm(const struct device *dev,
|
||||
uint8_t chan_id)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, cancel_alarm));
|
||||
return z_vrfy_counter_cancel_channel_alarm((struct device *)dev,
|
||||
return z_vrfy_counter_cancel_channel_alarm((const struct device *)dev,
|
||||
(uint8_t)chan_id);
|
||||
}
|
||||
#include <syscalls/counter_cancel_channel_alarm_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_counter_set_top_value(struct device *dev,
|
||||
static inline int z_vrfy_counter_set_top_value(const struct device *dev,
|
||||
const struct counter_top_cfg
|
||||
*cfg)
|
||||
{
|
||||
|
@ -107,46 +109,48 @@ static inline int z_vrfy_counter_set_top_value(struct device *dev,
|
|||
Z_OOPS(z_user_from_copy(&cfg_copy, cfg, sizeof(cfg_copy)));
|
||||
Z_OOPS(Z_SYSCALL_VERIFY_MSG(cfg_copy.callback == 0,
|
||||
"callbacks may not be set from user mode"));
|
||||
return z_impl_counter_set_top_value((struct device *)dev,
|
||||
return z_impl_counter_set_top_value((const struct device *)dev,
|
||||
(const struct counter_top_cfg *)
|
||||
&cfg_copy);
|
||||
}
|
||||
#include <syscalls/counter_set_top_value_mrsh.c>
|
||||
|
||||
static inline uint32_t z_vrfy_counter_get_top_value(struct device *dev)
|
||||
static inline uint32_t z_vrfy_counter_get_top_value(const struct device *dev)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_top_value));
|
||||
return z_impl_counter_get_top_value((struct device *)dev);
|
||||
return z_impl_counter_get_top_value((const struct device *)dev);
|
||||
}
|
||||
#include <syscalls/counter_get_top_value_mrsh.c>
|
||||
|
||||
static inline uint32_t z_vrfy_counter_get_max_top_value(const struct device *dev)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_COUNTER));
|
||||
return z_impl_counter_get_max_top_value((struct device *)dev);
|
||||
return z_impl_counter_get_max_top_value((const struct device *)dev);
|
||||
}
|
||||
#include <syscalls/counter_get_max_top_value_mrsh.c>
|
||||
|
||||
static inline uint32_t z_vrfy_counter_get_max_relative_alarm(struct device *dev)
|
||||
static inline uint32_t z_vrfy_counter_get_max_relative_alarm(const struct device *dev)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_DRIVER_COUNTER(dev, get_max_relative_alarm));
|
||||
return z_impl_counter_get_max_relative_alarm((struct device *)dev);
|
||||
return z_impl_counter_get_max_relative_alarm((const struct device *)dev);
|
||||
}
|
||||
#include <syscalls/counter_get_max_relative_alarm_mrsh.c>
|
||||
|
||||
static inline uint32_t z_vrfy_counter_get_guard_period(struct device *dev,
|
||||
static inline uint32_t z_vrfy_counter_get_guard_period(const struct device *dev,
|
||||
uint32_t flags)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_COUNTER));
|
||||
return z_impl_counter_get_guard_period((struct device *)dev, flags);
|
||||
return z_impl_counter_get_guard_period((const struct device *)dev,
|
||||
flags);
|
||||
}
|
||||
#include <syscalls/counter_get_guard_period_mrsh.c>
|
||||
|
||||
static inline int z_vrfy_counter_set_guard_period(struct device *dev,
|
||||
static inline int z_vrfy_counter_set_guard_period(const struct device *dev,
|
||||
uint32_t ticks, uint32_t flags)
|
||||
{
|
||||
Z_OOPS(Z_SYSCALL_OBJ(dev, K_OBJ_DRIVER_COUNTER));
|
||||
return z_impl_counter_set_guard_period((struct device *)dev, ticks,
|
||||
return z_impl_counter_set_guard_period((const struct device *)dev,
|
||||
ticks,
|
||||
flags);
|
||||
}
|
||||
#include <syscalls/counter_set_guard_period_mrsh.c>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue