Skip to content

Commit e152833

Browse files
Uwe Kleine-Königgregkh
authored andcommitted
counter: stm32-timer-cnt: Convert to counter_priv() wrapper
This is a straight forward conversion to the new counter_priv() wrapper. Acked-by: Jonathan Cameron <[email protected]> Acked-by: William Breathitt Gray <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e98ea38 commit e152833

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

drivers/counter/stm32-timer-cnt.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = {
4747
static int stm32_count_read(struct counter_device *counter,
4848
struct counter_count *count, u64 *val)
4949
{
50-
struct stm32_timer_cnt *const priv = counter->priv;
50+
struct stm32_timer_cnt *const priv = counter_priv(counter);
5151
u32 cnt;
5252

5353
regmap_read(priv->regmap, TIM_CNT, &cnt);
@@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter,
5959
static int stm32_count_write(struct counter_device *counter,
6060
struct counter_count *count, const u64 val)
6161
{
62-
struct stm32_timer_cnt *const priv = counter->priv;
62+
struct stm32_timer_cnt *const priv = counter_priv(counter);
6363
u32 ceiling;
6464

6565
regmap_read(priv->regmap, TIM_ARR, &ceiling);
@@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter,
7373
struct counter_count *count,
7474
enum counter_function *function)
7575
{
76-
struct stm32_timer_cnt *const priv = counter->priv;
76+
struct stm32_timer_cnt *const priv = counter_priv(counter);
7777
u32 smcr;
7878

7979
regmap_read(priv->regmap, TIM_SMCR, &smcr);
@@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter,
100100
struct counter_count *count,
101101
enum counter_function function)
102102
{
103-
struct stm32_timer_cnt *const priv = counter->priv;
103+
struct stm32_timer_cnt *const priv = counter_priv(counter);
104104
u32 cr1, sms;
105105

106106
switch (function) {
@@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
140140
struct counter_count *count,
141141
enum counter_count_direction *direction)
142142
{
143-
struct stm32_timer_cnt *const priv = counter->priv;
143+
struct stm32_timer_cnt *const priv = counter_priv(counter);
144144
u32 cr1;
145145

146146
regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
153153
static int stm32_count_ceiling_read(struct counter_device *counter,
154154
struct counter_count *count, u64 *ceiling)
155155
{
156-
struct stm32_timer_cnt *const priv = counter->priv;
156+
struct stm32_timer_cnt *const priv = counter_priv(counter);
157157
u32 arr;
158158

159159
regmap_read(priv->regmap, TIM_ARR, &arr);
@@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter,
166166
static int stm32_count_ceiling_write(struct counter_device *counter,
167167
struct counter_count *count, u64 ceiling)
168168
{
169-
struct stm32_timer_cnt *const priv = counter->priv;
169+
struct stm32_timer_cnt *const priv = counter_priv(counter);
170170

171171
if (ceiling > priv->max_arr)
172172
return -ERANGE;
@@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter,
181181
static int stm32_count_enable_read(struct counter_device *counter,
182182
struct counter_count *count, u8 *enable)
183183
{
184-
struct stm32_timer_cnt *const priv = counter->priv;
184+
struct stm32_timer_cnt *const priv = counter_priv(counter);
185185
u32 cr1;
186186

187187
regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter,
194194
static int stm32_count_enable_write(struct counter_device *counter,
195195
struct counter_count *count, u8 enable)
196196
{
197-
struct stm32_timer_cnt *const priv = counter->priv;
197+
struct stm32_timer_cnt *const priv = counter_priv(counter);
198198
u32 cr1;
199199

200200
if (enable) {

0 commit comments

Comments
 (0)