Commit e152833b authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Greg Kroah-Hartman

counter: stm32-timer-cnt: Convert to counter_priv() wrapper

This is a straight forward conversion to the new counter_priv() wrapper.
Acked-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Acked-by: default avatarWilliam Breathitt Gray <vilhelm.gray@gmail.com>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Link: https://lore.kernel.org/r/20211230150300.72196-13-u.kleine-koenig@pengutronix.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e98ea385
...@@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = { ...@@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = {
static int stm32_count_read(struct counter_device *counter, static int stm32_count_read(struct counter_device *counter,
struct counter_count *count, u64 *val) struct counter_count *count, u64 *val)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cnt; u32 cnt;
regmap_read(priv->regmap, TIM_CNT, &cnt); regmap_read(priv->regmap, TIM_CNT, &cnt);
...@@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter, ...@@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter,
static int stm32_count_write(struct counter_device *counter, static int stm32_count_write(struct counter_device *counter,
struct counter_count *count, const u64 val) struct counter_count *count, const u64 val)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 ceiling; u32 ceiling;
regmap_read(priv->regmap, TIM_ARR, &ceiling); regmap_read(priv->regmap, TIM_ARR, &ceiling);
...@@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter, ...@@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
enum counter_function *function) enum counter_function *function)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 smcr; u32 smcr;
regmap_read(priv->regmap, TIM_SMCR, &smcr); regmap_read(priv->regmap, TIM_SMCR, &smcr);
...@@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter, ...@@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
enum counter_function function) enum counter_function function)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1, sms; u32 cr1, sms;
switch (function) { switch (function) {
...@@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter, ...@@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
struct counter_count *count, struct counter_count *count,
enum counter_count_direction *direction) enum counter_count_direction *direction)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1; u32 cr1;
regmap_read(priv->regmap, TIM_CR1, &cr1); regmap_read(priv->regmap, TIM_CR1, &cr1);
...@@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter, ...@@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
static int stm32_count_ceiling_read(struct counter_device *counter, static int stm32_count_ceiling_read(struct counter_device *counter,
struct counter_count *count, u64 *ceiling) struct counter_count *count, u64 *ceiling)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 arr; u32 arr;
regmap_read(priv->regmap, TIM_ARR, &arr); regmap_read(priv->regmap, TIM_ARR, &arr);
...@@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter, ...@@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter,
static int stm32_count_ceiling_write(struct counter_device *counter, static int stm32_count_ceiling_write(struct counter_device *counter,
struct counter_count *count, u64 ceiling) struct counter_count *count, u64 ceiling)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
if (ceiling > priv->max_arr) if (ceiling > priv->max_arr)
return -ERANGE; return -ERANGE;
...@@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter, ...@@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter,
static int stm32_count_enable_read(struct counter_device *counter, static int stm32_count_enable_read(struct counter_device *counter,
struct counter_count *count, u8 *enable) struct counter_count *count, u8 *enable)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1; u32 cr1;
regmap_read(priv->regmap, TIM_CR1, &cr1); regmap_read(priv->regmap, TIM_CR1, &cr1);
...@@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter, ...@@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter,
static int stm32_count_enable_write(struct counter_device *counter, static int stm32_count_enable_write(struct counter_device *counter,
struct counter_count *count, u8 enable) struct counter_count *count, u8 enable)
{ {
struct stm32_timer_cnt *const priv = counter->priv; struct stm32_timer_cnt *const priv = counter_priv(counter);
u32 cr1; u32 cr1;
if (enable) { if (enable) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment