[v2,3/8] i2c: designware: Don't use internal ___constant_swab32

Message ID 20180601134725.1375-4-jarkko.nikula@linux.intel.com
State New
Headers show
Series
  • i2c: designware: Improve debug prints
Related show

Commit Message

Jarkko Nikula June 1, 2018, 1:47 p.m.
It looks ___constant_swab32 is an internal byte swap detail. Switch to
swap32() and include header file for it explicitly. Now it comes
implicitly via linux/i2c.h include.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
---
 drivers/i2c/busses/i2c-designware-common.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko June 4, 2018, 12:36 p.m. | #1
On Fri, 2018-06-01 at 16:47 +0300, Jarkko Nikula wrote:
> It looks ___constant_swab32 is an internal byte swap detail. Switch to
> swap32() and include header file for it explicitly. Now it comes
> implicitly via linux/i2c.h include.
> 
> Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Signed-off-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> ---
>  drivers/i2c/busses/i2c-designware-common.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-common.c
> b/drivers/i2c/busses/i2c-designware-common.c
> index a9e75b809f38..c22654cce1df 100644
> --- a/drivers/i2c/busses/i2c-designware-common.c
> +++ b/drivers/i2c/busses/i2c-designware-common.c
> @@ -30,6 +30,7 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/module.h>
> +#include <linux/swab.h>
>  #include <linux/pm_runtime.h>

Can we preserve ordering?

>  
>  #include "i2c-designware-core.h"
> @@ -112,7 +113,7 @@ int i2c_dw_set_reg_access(struct dw_i2c_dev *dev)
>  	reg = dw_readl(dev, DW_IC_COMP_TYPE);
>  	i2c_dw_release_lock(dev);
>  
> -	if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
> +	if (reg == swab32(DW_IC_COMP_TYPE_VALUE)) {
>  		/* Configure register endianess access */
>  		dev->flags |= ACCESS_SWAP;
>  	} else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {

Patch

diff --git a/drivers/i2c/busses/i2c-designware-common.c b/drivers/i2c/busses/i2c-designware-common.c
index a9e75b809f38..c22654cce1df 100644
--- a/drivers/i2c/busses/i2c-designware-common.c
+++ b/drivers/i2c/busses/i2c-designware-common.c
@@ -30,6 +30,7 @@ 
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/swab.h>
 #include <linux/pm_runtime.h>
 
 #include "i2c-designware-core.h"
@@ -112,7 +113,7 @@  int i2c_dw_set_reg_access(struct dw_i2c_dev *dev)
 	reg = dw_readl(dev, DW_IC_COMP_TYPE);
 	i2c_dw_release_lock(dev);
 
-	if (reg == ___constant_swab32(DW_IC_COMP_TYPE_VALUE)) {
+	if (reg == swab32(DW_IC_COMP_TYPE_VALUE)) {
 		/* Configure register endianess access */
 		dev->flags |= ACCESS_SWAP;
 	} else if (reg == (DW_IC_COMP_TYPE_VALUE & 0x0000ffff)) {