zephyr/drivers/pwm/pwm_handlers.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

32 lines
895 B
C

/*
* Copyright (c) 2017 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <syscall_handler.h>
#include <drivers/pwm.h>
static inline int z_vrfy_pwm_pin_set_cycles(const struct device *dev,
uint32_t pwm,
uint32_t period, uint32_t pulse,
pwm_flags_t flags)
{
Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, pin_set));
return z_impl_pwm_pin_set_cycles((const struct device *)dev, pwm,
period,
pulse, flags);
}
#include <syscalls/pwm_pin_set_cycles_mrsh.c>
static inline int z_vrfy_pwm_get_cycles_per_sec(const struct device *dev,
uint32_t pwm,
uint64_t *cycles)
{
Z_OOPS(Z_SYSCALL_DRIVER_PWM(dev, get_cycles_per_sec));
Z_OOPS(Z_SYSCALL_MEMORY_WRITE(cycles, sizeof(uint64_t)));
return z_impl_pwm_get_cycles_per_sec((const struct device *)dev,
pwm, (uint64_t *)cycles);
}
#include <syscalls/pwm_get_cycles_per_sec_mrsh.c>