Skip to content

Commit 08e2a66

Browse files
ccpalexWilliam Breathitt Gray
authored andcommitted
counter: interrupt-cnt: Convert atomic_t -> atomic_long_t
Convert the internal counter type to atomic_long_t, which: - doesn't change much for existing in-tree users as they are 32-bit anyway (stm32/i.MX6) - doesn't introduce performace penalty on 32-bit platforms - provides 64-bit resolution on 64-bit platforms with virtually no preformance penalty Signed-off-by: Alexander Sverdlin <[email protected]> Acked-by: Oleksij Rempel <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: William Breathitt Gray <[email protected]>
1 parent b443265 commit 08e2a66

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/counter/interrupt-cnt.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#define INTERRUPT_CNT_NAME "interrupt-cnt"
1616

1717
struct interrupt_cnt_priv {
18-
atomic_t count;
18+
atomic_long_t count;
1919
struct gpio_desc *gpio;
2020
int irq;
2121
bool enabled;
@@ -29,7 +29,7 @@ static irqreturn_t interrupt_cnt_isr(int irq, void *dev_id)
2929
struct counter_device *counter = dev_id;
3030
struct interrupt_cnt_priv *priv = counter_priv(counter);
3131

32-
atomic_inc(&priv->count);
32+
atomic_long_inc(&priv->count);
3333

3434
counter_push_event(counter, COUNTER_EVENT_CHANGE_OF_STATE, 0);
3535

@@ -89,7 +89,7 @@ static int interrupt_cnt_read(struct counter_device *counter,
8989
{
9090
struct interrupt_cnt_priv *priv = counter_priv(counter);
9191

92-
*val = atomic_read(&priv->count);
92+
*val = atomic_long_read(&priv->count);
9393

9494
return 0;
9595
}
@@ -102,7 +102,7 @@ static int interrupt_cnt_write(struct counter_device *counter,
102102
if (val != (typeof(priv->count.counter))val)
103103
return -ERANGE;
104104

105-
atomic_set(&priv->count, val);
105+
atomic_long_set(&priv->count, val);
106106

107107
return 0;
108108
}

0 commit comments

Comments
 (0)