Skip to content

Commit 8233b70

Browse files
sylvioalvesnashif
authored andcommitted
espressif: clean up unused code
Remove all entries that as not being used. This also update hal to re-enable warning flags as such as -Wno-unused-variable. Signed-off-by: Sylvio Alves <[email protected]>
1 parent d207edb commit 8233b70

File tree

22 files changed

+28
-62
lines changed

22 files changed

+28
-62
lines changed

drivers/adc/adc_esp32.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,6 @@ static void adc_hw_calibration(adc_unit_t unit)
145145

146146
static bool adc_calibration_init(const struct device *dev)
147147
{
148-
struct adc_esp32_data *data = dev->data;
149-
150148
switch (esp_adc_cal_check_efuse(ADC_CALI_SCHEME)) {
151149
case ESP_ERR_NOT_SUPPORTED:
152150
LOG_WRN("Skip software calibration - Not supported!");
@@ -570,7 +568,6 @@ static int adc_esp32_channel_setup(const struct device *dev, const struct adc_ch
570568
{
571569
const struct adc_esp32_conf *conf = (const struct adc_esp32_conf *)dev->config;
572570
struct adc_esp32_data *data = (struct adc_esp32_data *) dev->data;
573-
int err;
574571

575572
if (cfg->channel_id >= conf->channel_count) {
576573
LOG_ERR("Unsupported channel id '%d'", cfg->channel_id);
@@ -638,7 +635,8 @@ static int adc_esp32_channel_setup(const struct device *dev, const struct adc_ch
638635
.pin = io_num,
639636
};
640637

641-
err = gpio_pin_configure_dt(&gpio, GPIO_DISCONNECTED);
638+
int err = gpio_pin_configure_dt(&gpio, GPIO_DISCONNECTED);
639+
642640
if (err) {
643641
LOG_ERR("Error disconnecting io (%d)", io_num);
644642
return err;

drivers/clock_control/clock_control_esp32.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,6 @@ static int esp32_cpu_clock_configure(const struct esp32_cpu_clock_config *cpu_cf
616616
rtc_cpu_freq_config_t old_config;
617617
rtc_cpu_freq_config_t new_config;
618618
rtc_clk_config_t rtc_clk_cfg = RTC_CLK_CONFIG_DEFAULT();
619-
uint32_t uart_clock_src_hz;
620619
bool ret;
621620

622621
rtc_clk_cfg.xtal_freq = cpu_cfg->xtal_freq;
@@ -687,14 +686,13 @@ static int esp32_cpu_clock_configure(const struct esp32_cpu_clock_config *cpu_cf
687686
esp_cpu_set_cycle_count((uint64_t)esp_cpu_get_cycle_count() * rtc_clk_cfg.cpu_freq_mhz /
688687
old_config.freq_mhz);
689688

689+
#if !defined(ESP_CONSOLE_UART_NONE)
690690
#if !defined(CONFIG_SOC_SERIES_ESP32C2) && !defined(CONFIG_SOC_SERIES_ESP32C6)
691+
uint32_t uart_clock_src_hz = esp_clk_apb_freq();
691692
#if ESP_ROM_UART_CLK_IS_XTAL
692693
uart_clock_src_hz = (uint32_t)rtc_clk_xtal_freq_get() * MHZ(1);
693-
#else
694-
uart_clock_src_hz = esp_clk_apb_freq();
695694
#endif
696695

697-
#if !defined(ESP_CONSOLE_UART_NONE)
698696
esp_rom_uart_set_clock_baudrate(ESP_CONSOLE_UART_NUM, uart_clock_src_hz,
699697
ESP_CONSOLE_UART_BAUDRATE);
700698
#endif
@@ -705,8 +703,6 @@ static int esp32_cpu_clock_configure(const struct esp32_cpu_clock_config *cpu_cf
705703
static int clock_control_esp32_configure(const struct device *dev, clock_control_subsys_t sys,
706704
void *data)
707705
{
708-
709-
const struct esp32_clock_config *cfg = dev->config;
710706
struct esp32_clock_config *new_cfg = data;
711707
int ret = 0;
712708

drivers/dma/dma_esp32_gdma.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ static int dma_esp32_config_rx(const struct device *dev, struct dma_esp32_channe
192192
{
193193
struct dma_esp32_config *config = (struct dma_esp32_config *)dev->config;
194194
struct dma_esp32_data *data = (struct dma_esp32_data *const)(dev)->data;
195-
struct dma_block_config *block = config_dma->head_block;
196195

197196
dma_channel->dir = DMA_RX;
198197

@@ -277,9 +276,7 @@ static int dma_esp32_config_tx_descriptor(struct dma_esp32_channel *dma_channel,
277276
static int dma_esp32_config_tx(const struct device *dev, struct dma_esp32_channel *dma_channel,
278277
struct dma_config *config_dma)
279278
{
280-
struct dma_esp32_config *config = (struct dma_esp32_config *)dev->config;
281279
struct dma_esp32_data *data = (struct dma_esp32_data *const)(dev)->data;
282-
struct dma_block_config *block = config_dma->head_block;
283280

284281
dma_channel->dir = DMA_TX;
285282

@@ -315,7 +312,6 @@ static int dma_esp32_config(const struct device *dev, uint32_t channel,
315312
struct dma_config *config_dma)
316313
{
317314
struct dma_esp32_config *config = (struct dma_esp32_config *)dev->config;
318-
struct dma_esp32_data *data = (struct dma_esp32_data *const)(dev)->data;
319315
struct dma_esp32_channel *dma_channel = &config->dma_channel[channel];
320316
int ret = 0;
321317

drivers/flash/flash_esp32.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,11 @@ flash_esp32_get_parameters(const struct device *dev)
146146

147147
static int flash_esp32_init(const struct device *dev)
148148
{
149-
struct flash_esp32_dev_data *const dev_data = dev->data;
150149
uint32_t ret = 0;
151150

152151
#ifdef CONFIG_MULTITHREADING
152+
struct flash_esp32_dev_data *const dev_data = dev->data;
153+
153154
k_sem_init(&dev_data->sem, 1, 1);
154155
#endif /* CONFIG_MULTITHREADING */
155156
ret = esp_flash_init_default_chip();

drivers/gpio/gpio_esp32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ static int gpio_esp32_config(const struct device *dev,
108108
gpio_flags_t flags)
109109
{
110110
const struct gpio_esp32_config *const cfg = dev->config;
111-
struct gpio_esp32_data *data = dev->data;
112111
uint32_t io_pin = (uint32_t) pin + ((cfg->gpio_port == 1 && pin < 32) ? 32 : 0);
113112
uint32_t key;
114113
int ret = 0;
@@ -474,7 +473,6 @@ static void gpio_esp32_isr(void *param);
474473

475474
static int gpio_esp32_init(const struct device *dev)
476475
{
477-
struct gpio_esp32_data *data = dev->data;
478476
static bool isr_connected;
479477

480478
if (!isr_connected) {

drivers/i2c/i2c_esp32.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ static i2c_clock_source_t i2c_get_clk_src(uint32_t clk_freq)
149149
static int i2c_esp32_config_pin(const struct device *dev)
150150
{
151151
const struct i2c_esp32_config *config = dev->config;
152-
struct i2c_esp32_data *data = (struct i2c_esp32_data *const)(dev)->data;
153152
int ret = 0;
154153

155154
if (config->index >= SOC_I2C_NUM) {
@@ -313,7 +312,6 @@ static void i2c_esp32_configure_data_mode(const struct device *dev)
313312

314313
static int i2c_esp32_configure(const struct device *dev, uint32_t dev_config)
315314
{
316-
const struct i2c_esp32_config *config = dev->config;
317315
struct i2c_esp32_data *data = (struct i2c_esp32_data *const)(dev)->data;
318316
uint32_t bitrate;
319317

@@ -508,7 +506,6 @@ static int IRAM_ATTR i2c_esp32_read_msg(const struct device *dev,
508506
struct i2c_msg *msg, uint16_t addr)
509507
{
510508
int ret = 0;
511-
struct i2c_esp32_data *data = (struct i2c_esp32_data *const)(dev)->data;
512509

513510
/* Set the R/W bit to R */
514511
addr |= BIT(0);
@@ -584,7 +581,6 @@ static int IRAM_ATTR i2c_esp32_master_write(const struct device *dev, struct i2c
584581
static int IRAM_ATTR i2c_esp32_write_msg(const struct device *dev,
585582
struct i2c_msg *msg, uint16_t addr)
586583
{
587-
struct i2c_esp32_data *data = (struct i2c_esp32_data *const)(dev)->data;
588584
int ret = 0;
589585

590586
if (msg->flags & I2C_MSG_RESTART) {

drivers/pwm/pwm_led_esp32.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ static struct pwm_ledc_esp32_channel_config *get_channel_config(const struct dev
6262

6363
static void pwm_led_esp32_low_speed_update(const struct device *dev, int speed_mode, int channel)
6464
{
65-
uint32_t reg_addr;
6665
struct pwm_ledc_esp32_data *data = (struct pwm_ledc_esp32_data *const)(dev)->data;
6766

6867
if (speed_mode == LEDC_LOW_SPEED_MODE) {
@@ -250,7 +249,6 @@ static int pwm_led_esp32_timer_set(const struct device *dev,
250249
static int pwm_led_esp32_get_cycles_per_sec(const struct device *dev,
251250
uint32_t channel_idx, uint64_t *cycles)
252251
{
253-
struct pwm_ledc_esp32_config *config = (struct pwm_ledc_esp32_config *) dev->config;
254252
struct pwm_ledc_esp32_channel_config *channel = get_channel_config(dev, channel_idx);
255253

256254
if (!channel) {
@@ -273,7 +271,6 @@ static int pwm_led_esp32_set_cycles(const struct device *dev, uint32_t channel_i
273271
{
274272
int ret;
275273
uint64_t clk_freq;
276-
struct pwm_ledc_esp32_config *config = (struct pwm_ledc_esp32_config *) dev->config;
277274
struct pwm_ledc_esp32_data *data = (struct pwm_ledc_esp32_data *const)(dev)->data;
278275
struct pwm_ledc_esp32_channel_config *channel = get_channel_config(dev, channel_idx);
279276

@@ -333,9 +330,7 @@ static int pwm_led_esp32_set_cycles(const struct device *dev, uint32_t channel_i
333330

334331
int pwm_led_esp32_init(const struct device *dev)
335332
{
336-
int ret;
337333
const struct pwm_ledc_esp32_config *config = dev->config;
338-
struct pwm_ledc_esp32_data *data = (struct pwm_ledc_esp32_data *const)(dev)->data;
339334

340335
if (!device_is_ready(config->clock_dev)) {
341336
LOG_ERR("clock control device not ready");

drivers/pwm/pwm_mc_esp32.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,6 @@ int mcpwm_esp32_init(const struct device *dev)
413413
int ret;
414414
struct mcpwm_esp32_config *config = (struct mcpwm_esp32_config *)dev->config;
415415
struct mcpwm_esp32_data *data = (struct mcpwm_esp32_data *const)(dev)->data;
416-
struct mcpwm_esp32_channel_config *channel;
417416

418417
if (!device_is_ready(config->clock_dev)) {
419418
LOG_ERR("clock control device not ready");
@@ -452,7 +451,6 @@ static void IRAM_ATTR mcpwm_esp32_isr(const struct device *dev)
452451
struct mcpwm_esp32_channel_config *channel;
453452
struct mcpwm_esp32_capture_config *capture;
454453
uint32_t mcpwm_intr_status;
455-
struct capture_data cap_data;
456454

457455
mcpwm_intr_status = mcpwm_ll_intr_get_capture_status(data->hal.dev);
458456

drivers/regulator/regulator_axp192.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static const struct linear_range dcdc1_ranges[] = {
6464
LINEAR_RANGE_INIT(700000U, 25000U, 0x00U, 0x7FU),
6565
};
6666

67-
static const struct regulator_axp192_desc dcdc1_desc = {
67+
__maybe_unused static const struct regulator_axp192_desc dcdc1_desc = {
6868
.enable_reg = AXP192_REG_DCDC123_LDO23_CONTROL,
6969
.enable_mask = 0x01U,
7070
.enable_val = 0x01U,
@@ -83,7 +83,7 @@ static const struct linear_range dcdc2_ranges[] = {
8383
LINEAR_RANGE_INIT(700000U, 25000U, 0x00U, 0x3FU),
8484
};
8585

86-
static const struct regulator_axp192_desc dcdc2_desc = {
86+
__maybe_unused static const struct regulator_axp192_desc dcdc2_desc = {
8787
.enable_reg = AXP192_REG_EXTEN_DCDC2_CONTROL,
8888
.enable_mask = 0x01U,
8989
.enable_val = 0x01U,
@@ -102,7 +102,7 @@ static const struct linear_range dcdc3_ranges[] = {
102102
LINEAR_RANGE_INIT(700000U, 25000U, 0x00U, 0x7FU),
103103
};
104104

105-
static const struct regulator_axp192_desc dcdc3_desc = {
105+
__maybe_unused static const struct regulator_axp192_desc dcdc3_desc = {
106106
.enable_reg = AXP192_REG_DCDC123_LDO23_CONTROL,
107107
.enable_mask = 0x02U,
108108
.enable_val = 0x02U,
@@ -121,7 +121,7 @@ static const struct linear_range ldoio0_ranges[] = {
121121
LINEAR_RANGE_INIT(1800000u, 100000u, 0x00u, 0x0Fu),
122122
};
123123

124-
static const struct regulator_axp192_desc ldoio0_desc = {
124+
__maybe_unused static const struct regulator_axp192_desc ldoio0_desc = {
125125
.enable_reg = AXP192_REG_GPIO0_CONTROL,
126126
.enable_mask = 0x07u,
127127
.enable_val = 0x03u,
@@ -139,7 +139,7 @@ static const struct linear_range ldo2_ranges[] = {
139139
LINEAR_RANGE_INIT(1800000U, 100000U, 0x00U, 0x0FU),
140140
};
141141

142-
static const struct regulator_axp192_desc ldo2_desc = {
142+
__maybe_unused static const struct regulator_axp192_desc ldo2_desc = {
143143
.enable_reg = AXP192_REG_DCDC123_LDO23_CONTROL,
144144
.enable_mask = 0x04U,
145145
.enable_val = 0x04U,
@@ -157,7 +157,7 @@ static const struct linear_range ldo3_ranges[] = {
157157
LINEAR_RANGE_INIT(1800000U, 100000U, 0x00U, 0x0FU),
158158
};
159159

160-
static const struct regulator_axp192_desc ldo3_desc = {
160+
__maybe_unused static const struct regulator_axp192_desc ldo3_desc = {
161161
.enable_reg = AXP192_REG_DCDC123_LDO23_CONTROL,
162162
.enable_mask = 0x08U,
163163
.enable_val = 0x08U,

drivers/sensor/espressif/esp32_temp/esp32_temp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ static int esp32_temp_channel_get(const struct device *dev, enum sensor_channel
5353
struct sensor_value *val)
5454
{
5555
struct esp32_temp_data *data = dev->data;
56-
const struct esp32_temp_config *cfg = dev->config;
5756

5857
if (chan != SENSOR_CHAN_DIE_TEMP) {
5958
return -ENOTSUP;

0 commit comments

Comments
 (0)