drivers: adc: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and dev->config instead. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
This commit is contained in:
parent
2a0e66453c
commit
6745333511
4 changed files with 31 additions and 50 deletions
|
@ -20,10 +20,6 @@ LOG_MODULE_REGISTER(adc_ite_it8xxx2);
|
|||
#define ADC_CONTEXT_USES_KERNEL_TIMER
|
||||
#include "adc_context.h"
|
||||
|
||||
#define DEV_DATA(dev) ((struct adc_it8xxx2_data * const)(dev)->data)
|
||||
|
||||
#define DEV_CFG(dev) ((struct adc_it8xxx2_cfg * const)(dev)->config)
|
||||
|
||||
/* ADC internal reference voltage (Unit:mV) */
|
||||
#define IT8XXX2_ADC_VREF_VOL 3000
|
||||
/* ADC channels disabled */
|
||||
|
@ -74,7 +70,7 @@ struct adc_it8xxx2_cfg {
|
|||
static int adc_it8xxx2_channel_setup(const struct device *dev,
|
||||
const struct adc_channel_cfg *channel_cfg)
|
||||
{
|
||||
struct adc_it8xxx2_cfg *config = DEV_CFG(dev);
|
||||
struct adc_it8xxx2_cfg *config = dev->config;
|
||||
|
||||
if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) {
|
||||
LOG_ERR("Selected ADC acquisition time is not valid");
|
||||
|
@ -157,7 +153,7 @@ static int check_buffer_size(const struct adc_sequence *sequence,
|
|||
static int adc_it8xxx2_start_read(const struct device *dev,
|
||||
const struct adc_sequence *sequence)
|
||||
{
|
||||
struct adc_it8xxx2_data *data = DEV_DATA(dev);
|
||||
struct adc_it8xxx2_data *data = dev->data;
|
||||
uint32_t channel_mask = sequence->channels;
|
||||
|
||||
if (!channel_mask || channel_mask & ~BIT_MASK(CHIP_ADC_COUNT)) {
|
||||
|
@ -189,7 +185,7 @@ static void adc_context_start_sampling(struct adc_context *ctx)
|
|||
static int adc_it8xxx2_read(const struct device *dev,
|
||||
const struct adc_sequence *sequence)
|
||||
{
|
||||
struct adc_it8xxx2_data *data = DEV_DATA(dev);
|
||||
struct adc_it8xxx2_data *data = dev->data;
|
||||
uint32_t channel_mask = sequence->channels;
|
||||
uint8_t channel_count = 0;
|
||||
int err = 0;
|
||||
|
@ -229,7 +225,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
|
|||
/* Get result for each ADC selected channel. */
|
||||
static void adc_it8xxx2_get_sample(const struct device *dev)
|
||||
{
|
||||
struct adc_it8xxx2_data *data = DEV_DATA(dev);
|
||||
struct adc_it8xxx2_data *data = dev->data;
|
||||
struct adc_it8xxx2_regs *const adc_regs = ADC_IT8XXX2_REG_BASE;
|
||||
bool valid = false;
|
||||
|
||||
|
@ -251,7 +247,7 @@ static void adc_it8xxx2_get_sample(const struct device *dev)
|
|||
static void adc_it8xxx2_isr(const void *arg)
|
||||
{
|
||||
struct device *dev = (struct device *)arg;
|
||||
struct adc_it8xxx2_data *data = DEV_DATA(dev);
|
||||
struct adc_it8xxx2_data *data = dev->data;
|
||||
|
||||
LOG_DBG("ADC ISR triggered.");
|
||||
|
||||
|
@ -288,7 +284,7 @@ static void adc_accuracy_initialization(void)
|
|||
|
||||
static int adc_it8xxx2_init(const struct device *dev)
|
||||
{
|
||||
struct adc_it8xxx2_data *data = DEV_DATA(dev);
|
||||
struct adc_it8xxx2_data *data = dev->data;
|
||||
struct adc_it8xxx2_regs *const adc_regs = ADC_IT8XXX2_REG_BASE;
|
||||
|
||||
/* ADC analog accuracy initialization */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue