diff mbox series

[i2c-next,v2,2/6] i2c: mlxbf: Fix resrticted cast warning of sparse

Message ID dbc627e710b7eb6e5127245c33a4e83ab8e5f21a.1604432921.git.kblaiech@nvidia.com
State Accepted
Commit 08e019e27a9ed0d6c410176cab4e029e3d233cb8
Headers show
Series i2c: Incremental fixes for Mellanox BlueField I2C | expand

Commit Message

Khalil Blaiech Nov. 3, 2020, 7:54 p.m. UTC
Address warnings "warning: cast to restricted __be32" reported
by sparse.

Fixes: b5b5b32081cd206b ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>
Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Wolfram Sang Nov. 6, 2020, 2:53 p.m. UTC | #1
On Tue, Nov 03, 2020 at 02:54:39PM -0500, Khalil Blaiech wrote:
> Address warnings "warning: cast to restricted __be32" reported

> by sparse.

> 

> Fixes: b5b5b32081cd206b ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC")

> Reported-by: kernel test robot <lkp@intel.com>

> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>

> Reviewed-by: Vadim Pasternak <vadimp@nvidia.com>

> Signed-off-by: Khalil Blaiech <kblaiech@nvidia.com>


Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index e18f595..4bd80b1 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -510,7 +510,7 @@  static u32 mlxbf_i2c_read(void __iomem *io, int reg)
  */
 static u32 mlxbf_i2c_read_data(void __iomem *io, int reg)
 {
-	return (u32)be32_to_cpu(mlxbf_i2c_read(io, reg));
+	return ioread32be(io + reg);
 }
 
 /*
@@ -524,7 +524,7 @@  static u32 mlxbf_i2c_read_data(void __iomem *io, int reg)
  */
 static void mlxbf_i2c_write_data(void __iomem *io, int reg, u32 val)
 {
-	mlxbf_i2c_write(io, reg, (u32)cpu_to_be32(val));
+	iowrite32be(val, io + reg);
 }
 
 /*