Skip to content

Commit 87735ed

Browse files
drivers: can: max32: use proper namespace for Kconfig symbols
Use proper namespace for the CAN max32 Kconfig symbols, renaming CONFIG_CAN_MAX_FILTER to CONFIG_CAN_MAX32_MAX_FILTER. This prevents Kconfig symbol clashes between different CAN controller drivers. Signed-off-by: Henrik Brix Andersen <henrik@brixandersen.dk>
1 parent 929902a commit 87735ed

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

drivers/can/Kconfig.max32

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ config CAN_MAX32
1111

1212
if CAN_MAX32
1313

14-
config CAN_MAX_FILTER
14+
config CAN_MAX32_MAX_FILTER
1515
int "Maximum number of concurrent active filters"
1616
default 5
1717
range 1 32

drivers/can/can_max32.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct max32_can_data {
5454
struct max32_req_data tx_data;
5555

5656
uint32_t filter_usage;
57-
struct max32_can_rx_callback rx_callbacks[CONFIG_CAN_MAX_FILTER];
57+
struct max32_can_rx_callback rx_callbacks[CONFIG_CAN_MAX32_MAX_FILTER];
5858
struct max32_req_data rx_data;
5959
};
6060

@@ -352,12 +352,13 @@ static int can_max32_add_rx_filter(const struct device *dev, can_rx_callback_t c
352352
k_mutex_lock(&dev_data->inst_mutex, K_FOREVER);
353353

354354
/* find free filter */
355-
while ((BIT(filter_idx) & dev_data->filter_usage) && (filter_idx < CONFIG_CAN_MAX_FILTER)) {
355+
while ((BIT(filter_idx) & dev_data->filter_usage) &&
356+
(filter_idx < CONFIG_CAN_MAX32_MAX_FILTER)) {
356357
filter_idx++;
357358
}
358359

359360
/* setup filter */
360-
if (filter_idx < CONFIG_CAN_MAX_FILTER) {
361+
if (filter_idx < CONFIG_CAN_MAX32_MAX_FILTER) {
361362
unsigned int key = irq_lock();
362363

363364
dev_data->filter_usage |= BIT(filter_idx);
@@ -371,7 +372,8 @@ static int can_max32_add_rx_filter(const struct device *dev, can_rx_callback_t c
371372
LOG_DBG("Set filter id:%08X mask:%08X", filter->id, filter->mask);
372373
} else {
373374
filter_idx = -ENOSPC;
374-
LOG_WRN("All filters are used CONFIG_CAN_MAX_FILTER=%d", CONFIG_CAN_MAX_FILTER);
375+
LOG_WRN("All filters are used CONFIG_CAN_MAX32_MAX_FILTER=%d",
376+
CONFIG_CAN_MAX32_MAX_FILTER);
375377
}
376378

377379
k_mutex_unlock(&dev_data->inst_mutex);
@@ -384,7 +386,7 @@ static void can_max32_remove_rx_filter(const struct device *dev, int filter_idx)
384386
struct max32_can_data *dev_data = dev->data;
385387
unsigned int key;
386388

387-
if ((filter_idx < 0) || (filter_idx >= CONFIG_CAN_MAX_FILTER)) {
389+
if ((filter_idx < 0) || (filter_idx >= CONFIG_CAN_MAX32_MAX_FILTER)) {
388390
LOG_ERR("Filter ID %d out of bounds", filter_idx);
389391
return;
390392
}
@@ -465,7 +467,7 @@ static int can_max32_get_max_filters(const struct device *dev, bool ide)
465467
ARG_UNUSED(dev);
466468
ARG_UNUSED(ide);
467469

468-
return CONFIG_CAN_MAX_FILTER;
470+
return CONFIG_CAN_MAX32_MAX_FILTER;
469471
}
470472

471473
#ifdef CONFIG_CAN_MANUAL_RECOVERY_MODE
@@ -510,7 +512,7 @@ static void can_max32_rx_soft_filter(const struct device *dev, struct can_frame
510512
}
511513
#endif /* !CONFIG_CAN_ACCEPT_RTR */
512514

513-
for (; filter_id < CONFIG_CAN_MAX_FILTER; filter_id++) {
515+
for (; filter_id < CONFIG_CAN_MAX32_MAX_FILTER; filter_id++) {
514516
if (!(BIT(filter_id) & dev_data->filter_usage)) {
515517
continue; /* filter slot empty */
516518
}

0 commit comments

Comments
 (0)