drivers: adc: add system call handlers
Straightforward conversion for adc_enable/disable. adc_read() uses a sequence table, which points to an array of struct adc_seq_entry, each element pointing to memory buffers. Need to validate all of these as being readable by the caller, and the buffers writable. Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
This commit is contained in:
parent
2a2a855aa8
commit
c93a4789cb
3 changed files with 43 additions and 3 deletions
|
@ -89,7 +89,9 @@ struct adc_driver_api {
|
|||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static inline void adc_enable(struct device *dev)
|
||||
__syscall void adc_enable(struct device *dev);
|
||||
|
||||
static inline void _impl_adc_enable(struct device *dev)
|
||||
{
|
||||
const struct adc_driver_api *api = dev->driver_api;
|
||||
|
||||
|
@ -106,7 +108,9 @@ static inline void adc_enable(struct device *dev)
|
|||
*
|
||||
* @return N/A
|
||||
*/
|
||||
static inline void adc_disable(struct device *dev)
|
||||
__syscall void adc_disable(struct device *dev);
|
||||
|
||||
static inline void _impl_adc_disable(struct device *dev)
|
||||
{
|
||||
const struct adc_driver_api *api = dev->driver_api;
|
||||
|
||||
|
@ -128,7 +132,10 @@ static inline void adc_disable(struct device *dev)
|
|||
* @retval 0 On success
|
||||
* @retval else Otherwise.
|
||||
*/
|
||||
static inline int adc_read(struct device *dev, struct adc_seq_table *seq_table)
|
||||
__syscall int adc_read(struct device *dev, struct adc_seq_table *seq_table);
|
||||
|
||||
static inline int _impl_adc_read(struct device *dev,
|
||||
struct adc_seq_table *seq_table)
|
||||
{
|
||||
const struct adc_driver_api *api = dev->driver_api;
|
||||
|
||||
|
@ -143,4 +150,6 @@ static inline int adc_read(struct device *dev, struct adc_seq_table *seq_table)
|
|||
}
|
||||
#endif
|
||||
|
||||
#include <syscalls/adc.h>
|
||||
|
||||
#endif /* __INCLUDE_ADC_H__ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue