Skip to content

Commit

Permalink
device: Apply config_info rename everywhere
Browse files Browse the repository at this point in the history
Via coccinelle:

@r_device_config@
struct device *D;
@@

D->
-	config_info
+	config

And 2 grep/sed rules for macros:

git grep -rlz 'dev)->config_info' |
	xargs -0 sed -i 's/dev)->config_info/dev)->config/g'

git grep -rlz 'dev->config_info' |
	xargs -0 sed -i 's/dev->config_info/dev->config/g'

Fixes zephyrproject-rtos#27397

Signed-off-by: Tomasz Bursztyka <[email protected]>
  • Loading branch information
Tomasz Bursztyka authored and carlescufi committed Aug 11, 2020
1 parent a46b4a9 commit af6140c
Show file tree
Hide file tree
Showing 324 changed files with 1,048 additions and 1,071 deletions.
2 changes: 1 addition & 1 deletion boards/arm/thingy52_nrf52832/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct pwr_ctrl_cfg {

static int pwr_ctrl_init(struct device *dev)
{
const struct pwr_ctrl_cfg *cfg = dev->config_info;
const struct pwr_ctrl_cfg *cfg = dev->config;
struct device *gpio;

gpio = device_get_binding(cfg->port);
Expand Down
2 changes: 1 addition & 1 deletion doc/reference/drivers/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ For example:
}
#define DEV_CFG(_dev) \
((const struct my_driver_config *)((_dev)->config_info))
((const struct my_driver_config *)((_dev)->config))
#define DEV_DATA(_dev) \
((struct my_driver_dev_data *)((_dev)->driver_data))
Expand Down
14 changes: 7 additions & 7 deletions drivers/adc/adc_lmp90xxx.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static inline uint8_t lmp90xxx_inst2_sz(size_t len)
static int lmp90xxx_read_reg(struct device *dev, uint8_t addr, uint8_t *dptr,
size_t len)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;
struct lmp90xxx_data *data = dev->driver_data;
uint8_t ura = LMP90XXX_URA(addr);
uint8_t inst1_uab[2] = { LMP90XXX_INST1_WAB, ura };
Expand Down Expand Up @@ -250,7 +250,7 @@ static int lmp90xxx_read_reg8(struct device *dev, uint8_t addr, uint8_t *val)
static int lmp90xxx_write_reg(struct device *dev, uint8_t addr, uint8_t *dptr,
size_t len)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;
struct lmp90xxx_data *data = dev->driver_data;
uint8_t ura = LMP90XXX_URA(addr);
uint8_t inst1_uab[2] = { LMP90XXX_INST1_WAB, ura };
Expand Down Expand Up @@ -328,7 +328,7 @@ static int lmp90xxx_soft_reset(struct device *dev)

static inline bool lmp90xxx_has_channel(struct device *dev, uint8_t channel)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;

if (channel >= config->channels) {
return false;
Expand All @@ -339,7 +339,7 @@ static inline bool lmp90xxx_has_channel(struct device *dev, uint8_t channel)

static inline bool lmp90xxx_has_input(struct device *dev, uint8_t input)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;

if (input >= LMP90XXX_MAX_INPUTS) {
return false;
Expand Down Expand Up @@ -497,7 +497,7 @@ static int lmp90xxx_validate_buffer_size(const struct adc_sequence *sequence)
static int lmp90xxx_adc_start_read(struct device *dev,
const struct adc_sequence *sequence)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;
struct lmp90xxx_data *data = dev->driver_data;
int err;

Expand Down Expand Up @@ -570,7 +570,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
static int lmp90xxx_adc_read_channel(struct device *dev, uint8_t channel,
int32_t *result)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;
struct lmp90xxx_data *data = dev->driver_data;
uint8_t adc_done;
uint8_t ch_scan;
Expand Down Expand Up @@ -914,7 +914,7 @@ int lmp90xxx_gpio_port_toggle_bits(struct device *dev, gpio_port_pins_t pins)

static int lmp90xxx_init(struct device *dev)
{
const struct lmp90xxx_config *config = dev->config_info;
const struct lmp90xxx_config *config = dev->config;
struct lmp90xxx_data *data = dev->driver_data;
struct device *drdyb_dev;
k_tid_t tid;
Expand Down
10 changes: 5 additions & 5 deletions drivers/adc/adc_mcp320x.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ struct mcp320x_data {
static int mcp320x_channel_setup(struct device *dev,
const struct adc_channel_cfg *channel_cfg)
{
const struct mcp320x_config *config = dev->config_info;
const struct mcp320x_config *config = dev->config;
struct mcp320x_data *data = dev->driver_data;

if (channel_cfg->gain != ADC_GAIN_1) {
Expand Down Expand Up @@ -86,7 +86,7 @@ static int mcp320x_channel_setup(struct device *dev,
static int mcp320x_validate_buffer_size(struct device *dev,
const struct adc_sequence *sequence)
{
const struct mcp320x_config *config = dev->config_info;
const struct mcp320x_config *config = dev->config;
uint8_t channels = 0;
size_t needed;
uint32_t mask;
Expand All @@ -112,7 +112,7 @@ static int mcp320x_validate_buffer_size(struct device *dev,
static int mcp320x_start_read(struct device *dev,
const struct adc_sequence *sequence)
{
const struct mcp320x_config *config = dev->config_info;
const struct mcp320x_config *config = dev->config;
struct mcp320x_data *data = dev->driver_data;
int err;

Expand Down Expand Up @@ -181,7 +181,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,

static int mcp320x_read_channel(struct device *dev, uint8_t channel, uint16_t *result)
{
const struct mcp320x_config *config = dev->config_info;
const struct mcp320x_config *config = dev->config;
struct mcp320x_data *data = dev->driver_data;
uint8_t tx_bytes[2];
uint8_t rx_bytes[2];
Expand Down Expand Up @@ -273,7 +273,7 @@ static void mcp320x_acquisition_thread(struct device *dev)

static int mcp320x_init(struct device *dev)
{
const struct mcp320x_config *config = dev->config_info;
const struct mcp320x_config *config = dev->config;
struct mcp320x_data *data = dev->driver_data;

k_sem_init(&data->sem, 0, 1);
Expand Down
8 changes: 4 additions & 4 deletions drivers/adc/adc_mcux_adc12.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ static int mcux_adc12_channel_setup(struct device *dev,
static int mcux_adc12_start_read(struct device *dev,
const struct adc_sequence *sequence)
{
const struct mcux_adc12_config *config = dev->config_info;
const struct mcux_adc12_config *config = dev->config;
struct mcux_adc12_data *data = dev->driver_data;
adc12_hardware_average_mode_t mode;
adc12_resolution_t resolution;
Expand Down Expand Up @@ -152,7 +152,7 @@ static int mcux_adc12_read(struct device *dev,

static void mcux_adc12_start_channel(struct device *dev)
{
const struct mcux_adc12_config *config = dev->config_info;
const struct mcux_adc12_config *config = dev->config;
struct mcux_adc12_data *data = dev->driver_data;

adc12_channel_config_t channel_config;
Expand Down Expand Up @@ -191,7 +191,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
static void mcux_adc12_isr(void *arg)
{
struct device *dev = (struct device *)arg;
const struct mcux_adc12_config *config = dev->config_info;
const struct mcux_adc12_config *config = dev->config;
struct mcux_adc12_data *data = dev->driver_data;
ADC_Type *base = config->base;
uint32_t channel_group = 0U;
Expand All @@ -213,7 +213,7 @@ static void mcux_adc12_isr(void *arg)

static int mcux_adc12_init(struct device *dev)
{
const struct mcux_adc12_config *config = dev->config_info;
const struct mcux_adc12_config *config = dev->config;
struct mcux_adc12_data *data = dev->driver_data;
ADC_Type *base = config->base;
adc12_config_t adc_config;
Expand Down
8 changes: 4 additions & 4 deletions drivers/adc/adc_mcux_adc16.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ static int mcux_adc16_channel_setup(struct device *dev,

static int start_read(struct device *dev, const struct adc_sequence *sequence)
{
const struct mcux_adc16_config *config = dev->config_info;
const struct mcux_adc16_config *config = dev->config;
struct mcux_adc16_data *data = dev->driver_data;
adc16_hardware_average_mode_t mode;
adc16_resolution_t resolution;
Expand Down Expand Up @@ -162,7 +162,7 @@ static int mcux_adc16_read_async(struct device *dev,

static void mcux_adc16_start_channel(struct device *dev)
{
const struct mcux_adc16_config *config = dev->config_info;
const struct mcux_adc16_config *config = dev->config;
struct mcux_adc16_data *data = dev->driver_data;

adc16_channel_config_t channel_config;
Expand Down Expand Up @@ -205,7 +205,7 @@ static void adc_context_update_buffer_pointer(struct adc_context *ctx,
static void mcux_adc16_isr(void *arg)
{
struct device *dev = (struct device *)arg;
const struct mcux_adc16_config *config = dev->config_info;
const struct mcux_adc16_config *config = dev->config;
struct mcux_adc16_data *data = dev->driver_data;
ADC_Type *base = config->base;
uint32_t channel_group = 0U;
Expand All @@ -227,7 +227,7 @@ static void mcux_adc16_isr(void *arg)

static int mcux_adc16_init(struct device *dev)
{
const struct mcux_adc16_config *config = dev->config_info;
const struct mcux_adc16_config *config = dev->config;
struct mcux_adc16_data *data = dev->driver_data;
ADC_Type *base = config->base;
adc16_config_t adc_config;
Expand Down
2 changes: 1 addition & 1 deletion drivers/adc/adc_sam0.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ struct adc_sam0_cfg {
};

#define DEV_CFG(dev) \
((const struct adc_sam0_cfg *const)(dev)->config_info)
((const struct adc_sam0_cfg *const)(dev)->config)
#define DEV_DATA(dev) \
((struct adc_sam0_data *)(dev)->driver_data)

Expand Down
2 changes: 1 addition & 1 deletion drivers/adc/adc_sam_afec.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct adc_sam_cfg {
};

#define DEV_CFG(dev) \
((const struct adc_sam_cfg *const)(dev)->config_info)
((const struct adc_sam_cfg *const)(dev)->config)

#define DEV_DATA(dev) \
((struct adc_sam_data *)(dev)->driver_data)
Expand Down
12 changes: 6 additions & 6 deletions drivers/adc/adc_stm32.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ static int check_buffer_size(const struct adc_sequence *sequence,

static void adc_stm32_start_conversion(struct device *dev)
{
const struct adc_stm32_cfg *config = dev->config_info;
const struct adc_stm32_cfg *config = dev->config;
ADC_TypeDef *adc = (ADC_TypeDef *)config->base;

LOG_DBG("Starting conversion");
Expand All @@ -265,7 +265,7 @@ static void adc_stm32_start_conversion(struct device *dev)

static int start_read(struct device *dev, const struct adc_sequence *sequence)
{
const struct adc_stm32_cfg *config = dev->config_info;
const struct adc_stm32_cfg *config = dev->config;
struct adc_stm32_data *data = dev->driver_data;
ADC_TypeDef *adc = (ADC_TypeDef *)config->base;
uint8_t resolution;
Expand Down Expand Up @@ -390,7 +390,7 @@ static void adc_stm32_isr(void *arg)
struct device *dev = (struct device *)arg;
struct adc_stm32_data *data = (struct adc_stm32_data *)dev->driver_data;
const struct adc_stm32_cfg *config =
(const struct adc_stm32_cfg *)dev->config_info;
(const struct adc_stm32_cfg *)dev->config;
ADC_TypeDef *adc = config->base;

*data->buffer++ = LL_ADC_REG_ReadConversionData32(adc);
Expand Down Expand Up @@ -450,7 +450,7 @@ static void adc_stm32_setup_speed(struct device *dev, uint8_t id,
uint8_t acq_time_index)
{
const struct adc_stm32_cfg *config =
(const struct adc_stm32_cfg *)dev->config_info;
(const struct adc_stm32_cfg *)dev->config;
ADC_TypeDef *adc = config->base;

#if defined(CONFIG_SOC_SERIES_STM32F0X) || defined(CONFIG_SOC_SERIES_STM32L0X)
Expand Down Expand Up @@ -523,7 +523,7 @@ static int adc_stm32_channel_setup(struct device *dev,
static void adc_stm32_calib(struct device *dev)
{
const struct adc_stm32_cfg *config =
(const struct adc_stm32_cfg *)dev->config_info;
(const struct adc_stm32_cfg *)dev->config;
ADC_TypeDef *adc = config->base;

#if defined(CONFIG_SOC_SERIES_STM32F3X) || \
Expand All @@ -545,7 +545,7 @@ static void adc_stm32_calib(struct device *dev)
static int adc_stm32_init(struct device *dev)
{
struct adc_stm32_data *data = dev->driver_data;
const struct adc_stm32_cfg *config = dev->config_info;
const struct adc_stm32_cfg *config = dev->config;
struct device *clk =
device_get_binding(STM32_CLOCK_CONTROL_NAME);
ADC_TypeDef *adc = (ADC_TypeDef *)config->base;
Expand Down
2 changes: 1 addition & 1 deletion drivers/audio/mpxxdtyy.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ extern "C" {
#define MPXXDTYY_MAX_PDM_FREQ 3250000 /* 3.25MHz */

#define DEV_CFG(dev) \
((const struct mpxxdtyy_config *const)(dev)->config_info)
((const struct mpxxdtyy_config *const)(dev)->config)
#define DEV_DATA(dev) \
((struct mpxxdtyy_data *const)(dev)->driver_data)

Expand Down
2 changes: 1 addition & 1 deletion drivers/audio/tlv320dac310x.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static struct codec_driver_config codec_device_config = {
static struct codec_driver_data codec_device_data;

#define DEV_CFG(dev) \
((struct codec_driver_config *const)(dev)->config_info)
((struct codec_driver_config *const)(dev)->config)
#define DEV_DATA(dev) \
((struct codec_driver_data *const)(dev)->driver_data)

Expand Down
2 changes: 1 addition & 1 deletion drivers/can/can_loopback.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#define DEV_DATA(dev) ((struct can_loopback_data *const)(dev)->driver_data)
#define DEV_CFG(dev) \
((const struct can_loopback_config *const)(dev)->config_info)
((const struct can_loopback_config *const)(dev)->config)

struct can_loopback_filter {
can_rx_callback_t rx_cb;
Expand Down
2 changes: 1 addition & 1 deletion drivers/can/can_mcp2515.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define MCP2515_FRAME_LEN 13

#define DEV_CFG(dev) \
((const struct mcp2515_config *const)(dev)->config_info)
((const struct mcp2515_config *const)(dev)->config)
#define DEV_DATA(dev) ((struct mcp2515_data *const)(dev)->driver_data)

struct mcp2515_tx_cb {
Expand Down
20 changes: 10 additions & 10 deletions drivers/can/can_mcux_flexcan.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ struct mcux_flexcan_data {
static int mcux_flexcan_configure(struct device *dev, enum can_mode mode,
uint32_t bitrate)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
flexcan_config_t flexcan_config;
struct device *clock_dev;
uint32_t clock_freq;
Expand Down Expand Up @@ -249,7 +249,7 @@ static int mcux_flexcan_send(struct device *dev, const struct zcan_frame *msg,
k_timeout_t timeout,
can_tx_callback_t callback_isr, void *callback_arg)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;
flexcan_mb_transfer_t xfer;
status_t status;
Expand Down Expand Up @@ -299,7 +299,7 @@ static int mcux_flexcan_attach_isr(struct device *dev, can_rx_callback_t isr,
void *callback_arg,
const struct zcan_filter *filter)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;
flexcan_mb_transfer_t xfer;
status_t status;
Expand Down Expand Up @@ -361,7 +361,7 @@ static void mcux_flexcan_register_state_change_isr(struct device *dev,
static enum can_state mcux_flexcan_get_state(struct device *dev,
struct can_bus_err_cnt *err_cnt)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
uint32_t status_flags;

if (err_cnt) {
Expand All @@ -386,7 +386,7 @@ static enum can_state mcux_flexcan_get_state(struct device *dev,
#ifndef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY
int mcux_flexcan_recover(struct device *dev, k_timeout_t timeout)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
int ret = 0;
uint64_t start_time;

Expand Down Expand Up @@ -414,7 +414,7 @@ int mcux_flexcan_recover(struct device *dev, k_timeout_t timeout)

static void mcux_flexcan_detach(struct device *dev, int filter_id)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;

if (filter_id >= MCUX_FLEXCAN_MAX_RX) {
Expand Down Expand Up @@ -443,7 +443,7 @@ static void mcux_flexcan_detach(struct device *dev, int filter_id)
static inline void mcux_flexcan_transfer_error_status(struct device *dev,
uint32_t error)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;
can_tx_callback_t function;
int status = CAN_TX_OK;
Expand Down Expand Up @@ -545,7 +545,7 @@ static inline void mcux_flexcan_transfer_tx_idle(struct device *dev,
static inline void mcux_flexcan_transfer_rx_idle(struct device *dev,
uint32_t mb)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;
can_rx_callback_t function;
flexcan_mb_transfer_t xfer;
Expand Down Expand Up @@ -610,15 +610,15 @@ static void mcux_flexcan_transfer_callback(CAN_Type *base,
static void mcux_flexcan_isr(void *arg)
{
struct device *dev = (struct device *)arg;
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;

FLEXCAN_TransferHandleIRQ(config->base, &data->handle);
}

static int mcux_flexcan_init(struct device *dev)
{
const struct mcux_flexcan_config *config = dev->config_info;
const struct mcux_flexcan_config *config = dev->config;
struct mcux_flexcan_data *data = dev->driver_data;
int err;
int i;
Expand Down
Loading

0 comments on commit af6140c

Please sign in to comment.