Message ID | 2a8f7484a7e5974279f2fd64eb4ad8a40da89c61.1695396848.git.petrm@nvidia.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 1f73286371c27cca0fd0094962e480e2b9ef3809 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | mlxsw: Provide enhancements and new feature | expand |
diff --git a/drivers/net/ethernet/mellanox/mlxsw/i2c.c b/drivers/net/ethernet/mellanox/mlxsw/i2c.c index d23f293e285c..1e150ce1c73a 100644 --- a/drivers/net/ethernet/mellanox/mlxsw/i2c.c +++ b/drivers/net/ethernet/mellanox/mlxsw/i2c.c @@ -424,9 +424,7 @@ mlxsw_i2c_cmd(struct device *dev, u16 opcode, u32 in_mod, size_t in_mbox_size, if (in_mbox) { reg_size = mlxsw_i2c_get_reg_size(in_mbox); - num = reg_size / mlxsw_i2c->block_size; - if (reg_size % mlxsw_i2c->block_size) - num++; + num = DIV_ROUND_UP(reg_size, mlxsw_i2c->block_size); if (mutex_lock_interruptible(&mlxsw_i2c->cmd.lock) < 0) { dev_err(&client->dev, "Could not acquire lock");