Skip to content

Commit 9d7809a

Browse files
ukleineklag-linaro
authored andcommitted
counter: stm32-timer-cnt: Use TIM_DIER_CCxIE(x) instead of TIM_DIER_CCxIE(x)
These two defines have the same purpose and this change doesn't introduce any differences in drivers/counter/stm32-timer-cnt.o. The only difference between the two is that TIM_DIER_CC_IE(1) == TIM_DIER_CC2IE while TIM_DIER_CCxIE(1) == TIM_DIER_CC1IE . That makes it necessary to have an explicit "+ 1" in the user code, but IMHO this is a good thing as this is the code locatation that "knows" that for software channel 1 you have to use TIM_DIER_CC2IE (because software guys start counting at 0, while the relevant hardware designer started at 1). Signed-off-by: Uwe Kleine-König <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Link: https://lore.kernel.org/r/126bd153a03f39e42645573eecf44ffab5354fc7.1718791090.git.u.kleine-koenig@baylibre.com Signed-off-by: Lee Jones <[email protected]>
1 parent 796b942 commit 9d7809a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/counter/stm32-timer-cnt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static int stm32_count_events_configure(struct counter_device *counter)
465465
ret = stm32_count_capture_configure(counter, event_node->channel, true);
466466
if (ret)
467467
return ret;
468-
dier |= TIM_DIER_CC_IE(event_node->channel);
468+
dier |= TIM_DIER_CCxIE(event_node->channel + 1);
469469
break;
470470
default:
471471
/* should never reach this path */
@@ -478,7 +478,7 @@ static int stm32_count_events_configure(struct counter_device *counter)
478478

479479
/* check for disabled capture events */
480480
for (i = 0 ; i < priv->nchannels; i++) {
481-
if (!(dier & TIM_DIER_CC_IE(i))) {
481+
if (!(dier & TIM_DIER_CCxIE(i + 1))) {
482482
ret = stm32_count_capture_configure(counter, i, false);
483483
if (ret)
484484
return ret;

0 commit comments

Comments
 (0)