2019-09-18 09:24:11

by William Breathitt Gray

[permalink] [raw]
Subject: [PATCH v2 7/7] counter: stm32-timer-cnt: Update count_read and count_write callbacks

The count_read and count_write callbacks pass unsigned long now.

Cc: Fabrice Gasnier <[email protected]>
Signed-off-by: William Breathitt Gray <[email protected]>
---
drivers/counter/stm32-timer-cnt.c | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)

diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 644ba18a72ad..839083543323 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -48,34 +48,27 @@ static enum counter_count_function stm32_count_functions[] = {
};

static int stm32_count_read(struct counter_device *counter,
- struct counter_count *count,
- struct counter_count_read_value *val)
+ struct counter_count *count, unsigned long *val)
{
struct stm32_timer_cnt *const priv = counter->priv;
u32 cnt;

regmap_read(priv->regmap, TIM_CNT, &cnt);
- counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cnt);
+ *val = cnt;

return 0;
}

static int stm32_count_write(struct counter_device *counter,
struct counter_count *count,
- struct counter_count_write_value *val)
+ const unsigned long val)
{
struct stm32_timer_cnt *const priv = counter->priv;
- u32 cnt;
- int err;
-
- err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val);
- if (err)
- return err;

- if (cnt > priv->ceiling)
+ if (val > priv->ceiling)
return -EINVAL;

- return regmap_write(priv->regmap, TIM_CNT, cnt);
+ return regmap_write(priv->regmap, TIM_CNT, val);
}

static int stm32_count_function_get(struct counter_device *counter,
--
2.23.0


2019-09-18 13:27:37

by Fabrice Gasnier

[permalink] [raw]
Subject: Re: [PATCH v2 7/7] counter: stm32-timer-cnt: Update count_read and count_write callbacks

On 9/18/19 9:52 AM, William Breathitt Gray wrote:
> The count_read and count_write callbacks pass unsigned long now.
>
> Cc: Fabrice Gasnier <[email protected]>
> Signed-off-by: William Breathitt Gray <[email protected]>

Hi William,

I tested your series for STM32 timer and LPtimer drivers. Maybe you can
squash as suggested by Benjamin ?
With that, you can add my acked-by for the two STM32 drivers.

Thanks,
Fabrice

> ---
> drivers/counter/stm32-timer-cnt.c | 17 +++++------------
> 1 file changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 644ba18a72ad..839083543323 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -48,34 +48,27 @@ static enum counter_count_function stm32_count_functions[] = {
> };
>
> static int stm32_count_read(struct counter_device *counter,
> - struct counter_count *count,
> - struct counter_count_read_value *val)
> + struct counter_count *count, unsigned long *val)
> {
> struct stm32_timer_cnt *const priv = counter->priv;
> u32 cnt;
>
> regmap_read(priv->regmap, TIM_CNT, &cnt);
> - counter_count_read_value_set(val, COUNTER_COUNT_POSITION, &cnt);
> + *val = cnt;
>
> return 0;
> }
>
> static int stm32_count_write(struct counter_device *counter,
> struct counter_count *count,
> - struct counter_count_write_value *val)
> + const unsigned long val)
> {
> struct stm32_timer_cnt *const priv = counter->priv;
> - u32 cnt;
> - int err;
> -
> - err = counter_count_write_value_get(&cnt, COUNTER_COUNT_POSITION, val);
> - if (err)
> - return err;
>
> - if (cnt > priv->ceiling)
> + if (val > priv->ceiling)
> return -EINVAL;
>
> - return regmap_write(priv->regmap, TIM_CNT, cnt);
> + return regmap_write(priv->regmap, TIM_CNT, val);
> }
>
> static int stm32_count_function_get(struct counter_device *counter,
>