diff mbox series

[v2,12/23] counter: stm32-timer-cnt: Convert to counter_priv() wrapper

Message ID 20211227094526.698714-13-u.kleine-koenig@pengutronix.de (mailing list archive)
State Handled Elsewhere
Headers show
Series [v2,01/23] counter: Use container_of instead of drvdata to track counter_device | expand

Commit Message

Uwe Kleine-König Dec. 27, 2021, 9:45 a.m. UTC
This is a straight forward conversion to the new counter_priv() wrapper.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/counter/stm32-timer-cnt.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Jonathan Cameron Dec. 28, 2021, 6:08 p.m. UTC | #1
On Mon, 27 Dec 2021 10:45:15 +0100
Uwe Kleine-König         <u.kleine-koenig@pengutronix.de> wrote:

> This is a straight forward conversion to the new counter_priv() wrapper.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
>  drivers/counter/stm32-timer-cnt.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 0546e932db0c..4b05b198a8d8 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = {
>  static int stm32_count_read(struct counter_device *counter,
>  			    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;
>  
>  	regmap_read(priv->regmap, TIM_CNT, &cnt);
> @@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter,
>  static int stm32_count_write(struct counter_device *counter,
>  			     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;
>  
>  	regmap_read(priv->regmap, TIM_ARR, &ceiling);
> @@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter,
>  				     struct counter_count *count,
>  				     enum counter_function *function)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 smcr;
>  
>  	regmap_read(priv->regmap, TIM_SMCR, &smcr);
> @@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter,
>  				      struct counter_count *count,
>  				      enum counter_function function)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 cr1, sms;
>  
>  	switch (function) {
> @@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
>  				      struct counter_count *count,
>  				      enum counter_count_direction *direction)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 cr1;
>  
>  	regmap_read(priv->regmap, TIM_CR1, &cr1);
> @@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
>  static int stm32_count_ceiling_read(struct counter_device *counter,
>  				    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;
>  
>  	regmap_read(priv->regmap, TIM_ARR, &arr);
> @@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter,
>  static int stm32_count_ceiling_write(struct counter_device *counter,
>  				     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)
>  		return -ERANGE;
> @@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter,
>  static int stm32_count_enable_read(struct counter_device *counter,
>  				   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;
>  
>  	regmap_read(priv->regmap, TIM_CR1, &cr1);
> @@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter,
>  static int stm32_count_enable_write(struct counter_device *counter,
>  				    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;
>  
>  	if (enable) {
William Breathitt Gray Dec. 29, 2021, 7:48 a.m. UTC | #2
On Mon, Dec 27, 2021 at 10:45:15AM +0100, Uwe Kleine-König wrote:
> This is a straight forward conversion to the new counter_priv() wrapper.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Acked-by: William Breathitt Gray <vilhelm.gray@gmail.com>

> ---
>  drivers/counter/stm32-timer-cnt.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
> index 0546e932db0c..4b05b198a8d8 100644
> --- a/drivers/counter/stm32-timer-cnt.c
> +++ b/drivers/counter/stm32-timer-cnt.c
> @@ -47,7 +47,7 @@ static const enum counter_function stm32_count_functions[] = {
>  static int stm32_count_read(struct counter_device *counter,
>  			    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;
>  
>  	regmap_read(priv->regmap, TIM_CNT, &cnt);
> @@ -59,7 +59,7 @@ static int stm32_count_read(struct counter_device *counter,
>  static int stm32_count_write(struct counter_device *counter,
>  			     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;
>  
>  	regmap_read(priv->regmap, TIM_ARR, &ceiling);
> @@ -73,7 +73,7 @@ static int stm32_count_function_read(struct counter_device *counter,
>  				     struct counter_count *count,
>  				     enum counter_function *function)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 smcr;
>  
>  	regmap_read(priv->regmap, TIM_SMCR, &smcr);
> @@ -100,7 +100,7 @@ static int stm32_count_function_write(struct counter_device *counter,
>  				      struct counter_count *count,
>  				      enum counter_function function)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 cr1, sms;
>  
>  	switch (function) {
> @@ -140,7 +140,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
>  				      struct counter_count *count,
>  				      enum counter_count_direction *direction)
>  {
> -	struct stm32_timer_cnt *const priv = counter->priv;
> +	struct stm32_timer_cnt *const priv = counter_priv(counter);
>  	u32 cr1;
>  
>  	regmap_read(priv->regmap, TIM_CR1, &cr1);
> @@ -153,7 +153,7 @@ static int stm32_count_direction_read(struct counter_device *counter,
>  static int stm32_count_ceiling_read(struct counter_device *counter,
>  				    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;
>  
>  	regmap_read(priv->regmap, TIM_ARR, &arr);
> @@ -166,7 +166,7 @@ static int stm32_count_ceiling_read(struct counter_device *counter,
>  static int stm32_count_ceiling_write(struct counter_device *counter,
>  				     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)
>  		return -ERANGE;
> @@ -181,7 +181,7 @@ static int stm32_count_ceiling_write(struct counter_device *counter,
>  static int stm32_count_enable_read(struct counter_device *counter,
>  				   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;
>  
>  	regmap_read(priv->regmap, TIM_CR1, &cr1);
> @@ -194,7 +194,7 @@ static int stm32_count_enable_read(struct counter_device *counter,
>  static int stm32_count_enable_write(struct counter_device *counter,
>  				    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;
>  
>  	if (enable) {
> -- 
> 2.33.0
>
diff mbox series

Patch

diff --git a/drivers/counter/stm32-timer-cnt.c b/drivers/counter/stm32-timer-cnt.c
index 0546e932db0c..4b05b198a8d8 100644
--- a/drivers/counter/stm32-timer-cnt.c
+++ b/drivers/counter/stm32-timer-cnt.c
@@ -47,7 +47,7 @@  static const enum counter_function stm32_count_functions[] = {
 static int stm32_count_read(struct counter_device *counter,
 			    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;
 
 	regmap_read(priv->regmap, TIM_CNT, &cnt);
@@ -59,7 +59,7 @@  static int stm32_count_read(struct counter_device *counter,
 static int stm32_count_write(struct counter_device *counter,
 			     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;
 
 	regmap_read(priv->regmap, TIM_ARR, &ceiling);
@@ -73,7 +73,7 @@  static int stm32_count_function_read(struct counter_device *counter,
 				     struct counter_count *count,
 				     enum counter_function *function)
 {
-	struct stm32_timer_cnt *const priv = counter->priv;
+	struct stm32_timer_cnt *const priv = counter_priv(counter);
 	u32 smcr;
 
 	regmap_read(priv->regmap, TIM_SMCR, &smcr);
@@ -100,7 +100,7 @@  static int stm32_count_function_write(struct counter_device *counter,
 				      struct counter_count *count,
 				      enum counter_function function)
 {
-	struct stm32_timer_cnt *const priv = counter->priv;
+	struct stm32_timer_cnt *const priv = counter_priv(counter);
 	u32 cr1, sms;
 
 	switch (function) {
@@ -140,7 +140,7 @@  static int stm32_count_direction_read(struct counter_device *counter,
 				      struct counter_count *count,
 				      enum counter_count_direction *direction)
 {
-	struct stm32_timer_cnt *const priv = counter->priv;
+	struct stm32_timer_cnt *const priv = counter_priv(counter);
 	u32 cr1;
 
 	regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -153,7 +153,7 @@  static int stm32_count_direction_read(struct counter_device *counter,
 static int stm32_count_ceiling_read(struct counter_device *counter,
 				    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;
 
 	regmap_read(priv->regmap, TIM_ARR, &arr);
@@ -166,7 +166,7 @@  static int stm32_count_ceiling_read(struct counter_device *counter,
 static int stm32_count_ceiling_write(struct counter_device *counter,
 				     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)
 		return -ERANGE;
@@ -181,7 +181,7 @@  static int stm32_count_ceiling_write(struct counter_device *counter,
 static int stm32_count_enable_read(struct counter_device *counter,
 				   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;
 
 	regmap_read(priv->regmap, TIM_CR1, &cr1);
@@ -194,7 +194,7 @@  static int stm32_count_enable_read(struct counter_device *counter,
 static int stm32_count_enable_write(struct counter_device *counter,
 				    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;
 
 	if (enable) {