diff mbox series

[v2,10/23] counter: ti-eqep: Convert to counter_priv() wrapper

Message ID 20211227094526.698714-11-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/ti-eqep.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

Comments

Jonathan Cameron Dec. 28, 2021, 6:07 p.m. UTC | #1
On Mon, 27 Dec 2021 10:45:13 +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/ti-eqep.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
> index 09817c953f9a..abeda966e7be 100644
> --- a/drivers/counter/ti-eqep.c
> +++ b/drivers/counter/ti-eqep.c
> @@ -90,7 +90,7 @@ struct ti_eqep_cnt {
>  static int ti_eqep_count_read(struct counter_device *counter,
>  			      struct counter_count *count, u64 *val)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 cnt;
>  
>  	regmap_read(priv->regmap32, QPOSCNT, &cnt);
> @@ -102,7 +102,7 @@ static int ti_eqep_count_read(struct counter_device *counter,
>  static int ti_eqep_count_write(struct counter_device *counter,
>  			       struct counter_count *count, u64 val)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 max;
>  
>  	regmap_read(priv->regmap32, QPOSMAX, &max);
> @@ -116,7 +116,7 @@ static int ti_eqep_function_read(struct counter_device *counter,
>  				 struct counter_count *count,
>  				 enum counter_function *function)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qdecctl;
>  
>  	regmap_read(priv->regmap16, QDECCTL, &qdecctl);
> @@ -143,7 +143,7 @@ static int ti_eqep_function_write(struct counter_device *counter,
>  				  struct counter_count *count,
>  				  enum counter_function function)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	enum ti_eqep_count_func qsrc;
>  
>  	switch (function) {
> @@ -173,7 +173,7 @@ static int ti_eqep_action_read(struct counter_device *counter,
>  			       struct counter_synapse *synapse,
>  			       enum counter_synapse_action *action)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	enum counter_function function;
>  	u32 qdecctl;
>  	int err;
> @@ -245,7 +245,7 @@ static int ti_eqep_position_ceiling_read(struct counter_device *counter,
>  					 struct counter_count *count,
>  					 u64 *ceiling)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qposmax;
>  
>  	regmap_read(priv->regmap32, QPOSMAX, &qposmax);
> @@ -259,7 +259,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
>  					  struct counter_count *count,
>  					  u64 ceiling)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  
>  	if (ceiling != (u32)ceiling)
>  		return -ERANGE;
> @@ -272,7 +272,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
>  static int ti_eqep_position_enable_read(struct counter_device *counter,
>  					struct counter_count *count, u8 *enable)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qepctl;
>  
>  	regmap_read(priv->regmap16, QEPCTL, &qepctl);
> @@ -285,7 +285,7 @@ static int ti_eqep_position_enable_read(struct counter_device *counter,
>  static int ti_eqep_position_enable_write(struct counter_device *counter,
>  					 struct counter_count *count, u8 enable)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  
>  	regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0);
>
William Breathitt Gray Dec. 29, 2021, 7:45 a.m. UTC | #2
On Mon, Dec 27, 2021 at 10:45:13AM +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>

This patch conflicts with commit 60f07e74f86b ("counter: ti-eqep: Use
container_of instead of struct counter_device::priv"). Because that
commit has a similar purpose as this patchset, I'm going to skip this
patch for now and continue looking over the rest of the patches in this
series.

> ---
>  drivers/counter/ti-eqep.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
> index 09817c953f9a..abeda966e7be 100644
> --- a/drivers/counter/ti-eqep.c
> +++ b/drivers/counter/ti-eqep.c
> @@ -90,7 +90,7 @@ struct ti_eqep_cnt {
>  static int ti_eqep_count_read(struct counter_device *counter,
>  			      struct counter_count *count, u64 *val)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 cnt;
>  
>  	regmap_read(priv->regmap32, QPOSCNT, &cnt);
> @@ -102,7 +102,7 @@ static int ti_eqep_count_read(struct counter_device *counter,
>  static int ti_eqep_count_write(struct counter_device *counter,
>  			       struct counter_count *count, u64 val)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 max;
>  
>  	regmap_read(priv->regmap32, QPOSMAX, &max);
> @@ -116,7 +116,7 @@ static int ti_eqep_function_read(struct counter_device *counter,
>  				 struct counter_count *count,
>  				 enum counter_function *function)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qdecctl;
>  
>  	regmap_read(priv->regmap16, QDECCTL, &qdecctl);
> @@ -143,7 +143,7 @@ static int ti_eqep_function_write(struct counter_device *counter,
>  				  struct counter_count *count,
>  				  enum counter_function function)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	enum ti_eqep_count_func qsrc;
>  
>  	switch (function) {
> @@ -173,7 +173,7 @@ static int ti_eqep_action_read(struct counter_device *counter,
>  			       struct counter_synapse *synapse,
>  			       enum counter_synapse_action *action)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	enum counter_function function;
>  	u32 qdecctl;
>  	int err;
> @@ -245,7 +245,7 @@ static int ti_eqep_position_ceiling_read(struct counter_device *counter,
>  					 struct counter_count *count,
>  					 u64 *ceiling)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qposmax;
>  
>  	regmap_read(priv->regmap32, QPOSMAX, &qposmax);
> @@ -259,7 +259,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
>  					  struct counter_count *count,
>  					  u64 ceiling)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  
>  	if (ceiling != (u32)ceiling)
>  		return -ERANGE;
> @@ -272,7 +272,7 @@ static int ti_eqep_position_ceiling_write(struct counter_device *counter,
>  static int ti_eqep_position_enable_read(struct counter_device *counter,
>  					struct counter_count *count, u8 *enable)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  	u32 qepctl;
>  
>  	regmap_read(priv->regmap16, QEPCTL, &qepctl);
> @@ -285,7 +285,7 @@ static int ti_eqep_position_enable_read(struct counter_device *counter,
>  static int ti_eqep_position_enable_write(struct counter_device *counter,
>  					 struct counter_count *count, u8 enable)
>  {
> -	struct ti_eqep_cnt *priv = counter->priv;
> +	struct ti_eqep_cnt *priv = counter_priv(counter);
>  
>  	regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0);
>  
> -- 
> 2.33.0
>
Uwe Kleine-König Dec. 29, 2021, 11:19 a.m. UTC | #3
On Wed, Dec 29, 2021 at 04:45:21PM +0900, William Breathitt Gray wrote:
> On Mon, Dec 27, 2021 at 10:45:13AM +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>
> 
> This patch conflicts with commit 60f07e74f86b ("counter: ti-eqep: Use
> container_of instead of struct counter_device::priv"). Because that
> commit has a similar purpose as this patchset, I'm going to skip this
> patch for now and continue looking over the rest of the patches in this
> series.

Ah right. I will base v3 on top of v5.16-rc6 + 60f07e74f86b. 

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/counter/ti-eqep.c b/drivers/counter/ti-eqep.c
index 09817c953f9a..abeda966e7be 100644
--- a/drivers/counter/ti-eqep.c
+++ b/drivers/counter/ti-eqep.c
@@ -90,7 +90,7 @@  struct ti_eqep_cnt {
 static int ti_eqep_count_read(struct counter_device *counter,
 			      struct counter_count *count, u64 *val)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	u32 cnt;
 
 	regmap_read(priv->regmap32, QPOSCNT, &cnt);
@@ -102,7 +102,7 @@  static int ti_eqep_count_read(struct counter_device *counter,
 static int ti_eqep_count_write(struct counter_device *counter,
 			       struct counter_count *count, u64 val)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	u32 max;
 
 	regmap_read(priv->regmap32, QPOSMAX, &max);
@@ -116,7 +116,7 @@  static int ti_eqep_function_read(struct counter_device *counter,
 				 struct counter_count *count,
 				 enum counter_function *function)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	u32 qdecctl;
 
 	regmap_read(priv->regmap16, QDECCTL, &qdecctl);
@@ -143,7 +143,7 @@  static int ti_eqep_function_write(struct counter_device *counter,
 				  struct counter_count *count,
 				  enum counter_function function)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	enum ti_eqep_count_func qsrc;
 
 	switch (function) {
@@ -173,7 +173,7 @@  static int ti_eqep_action_read(struct counter_device *counter,
 			       struct counter_synapse *synapse,
 			       enum counter_synapse_action *action)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	enum counter_function function;
 	u32 qdecctl;
 	int err;
@@ -245,7 +245,7 @@  static int ti_eqep_position_ceiling_read(struct counter_device *counter,
 					 struct counter_count *count,
 					 u64 *ceiling)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	u32 qposmax;
 
 	regmap_read(priv->regmap32, QPOSMAX, &qposmax);
@@ -259,7 +259,7 @@  static int ti_eqep_position_ceiling_write(struct counter_device *counter,
 					  struct counter_count *count,
 					  u64 ceiling)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 
 	if (ceiling != (u32)ceiling)
 		return -ERANGE;
@@ -272,7 +272,7 @@  static int ti_eqep_position_ceiling_write(struct counter_device *counter,
 static int ti_eqep_position_enable_read(struct counter_device *counter,
 					struct counter_count *count, u8 *enable)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 	u32 qepctl;
 
 	regmap_read(priv->regmap16, QEPCTL, &qepctl);
@@ -285,7 +285,7 @@  static int ti_eqep_position_enable_read(struct counter_device *counter,
 static int ti_eqep_position_enable_write(struct counter_device *counter,
 					 struct counter_count *count, u8 enable)
 {
-	struct ti_eqep_cnt *priv = counter->priv;
+	struct ti_eqep_cnt *priv = counter_priv(counter);
 
 	regmap_write_bits(priv->regmap16, QEPCTL, QEPCTL_PHEN, enable ? -1 : 0);