1 /*
2 * Copyright 2023 Cirrus Logic, Inc.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7 #include <zephyr/syscall_handler.h>
8 #include <zephyr/drivers/charger.h>
9
z_vrfy_charger_get_prop(const struct device * dev,const charger_prop_t prop,union charger_propval * val)10 static inline int z_vrfy_charger_get_prop(const struct device *dev, const charger_prop_t prop,
11 union charger_propval *val)
12 {
13 union charger_propval k_val;
14
15 Z_OOPS(Z_SYSCALL_DRIVER_CHARGER(dev, get_property));
16
17 int ret = z_impl_charger_get_prop(dev, prop, &k_val);
18
19 Z_OOPS(z_user_to_copy(val, &k_val, sizeof(union charger_propval)));
20
21 return ret;
22 }
23
24 #include <syscalls/charger_get_prop_mrsh.c>
25
z_vrfy_charger_set_prop(const struct device * dev,const charger_prop_t prop,const union charger_propval * val)26 static inline int z_vrfy_charger_set_prop(const struct device *dev, const charger_prop_t prop,
27 const union charger_propval *val)
28 {
29 union charger_propval k_val;
30
31 Z_OOPS(Z_SYSCALL_DRIVER_CHARGER(dev, set_property));
32
33 Z_OOPS(z_user_from_copy(&k_val, val, sizeof(union charger_propval)));
34
35 return z_impl_charger_set_prop(dev, prop, &k_val);
36 }
37
38 #include <syscalls/charger_set_prop_mrsh.c>
39