Re: [PATCH v7 33/34] i2c: tegra: Clean up whitespaces, newlines and indentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 09, 2020 at 01:40:05AM +0300, Dmitry Osipenko wrote:
> Some places in the code are missing newlines or have unnecessary
> whitespaces and newlines. This creates inconsistency of the code and
> hurts readability. This patch removes the unnecessary and adds necessary
> whitespaces / newlines, clears indentation of the code.
> 
> Reviewed-by: Michał Mirosław <mirq-linux@xxxxxxxxxxxx>
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
>  drivers/i2c/busses/i2c-tegra.c | 72 +++++++++++++++++++++-------------
>  1 file changed, 45 insertions(+), 27 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 31fbc6181dd5..087f98010963 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -314,6 +314,7 @@ static u32 tegra_i2c_reg_addr(struct tegra_i2c_dev *i2c_dev, u32 reg)
>  		reg += (reg >= I2C_TX_FIFO) ? 0x10 : 0x40;
>  	else if (i2c_dev->is_vi)
>  		reg = 0xc00 + (reg << 2);
> +
>  	return reg;
>  }
>  
> @@ -373,9 +374,12 @@ static int tegra_i2c_dma_submit(struct tegra_i2c_dev *i2c_dev, size_t len)
>  	struct dma_chan *chan;
>  
>  	dev_dbg(i2c_dev->dev, "starting DMA for length: %zu\n", len);
> +
>  	reinit_completion(&i2c_dev->dma_complete);
> +
>  	dir = i2c_dev->msg_read ? DMA_DEV_TO_MEM : DMA_MEM_TO_DEV;
>  	chan = i2c_dev->msg_read ? i2c_dev->rx_dma_chan : i2c_dev->tx_dma_chan;
> +
>  	dma_desc = dmaengine_prep_slave_single(chan, i2c_dev->dma_phys,
>  					       len, dir, DMA_PREP_INTERRUPT |
>  					       DMA_CTRL_ACK);
> @@ -387,8 +391,10 @@ static int tegra_i2c_dma_submit(struct tegra_i2c_dev *i2c_dev, size_t len)
>  
>  	dma_desc->callback = tegra_i2c_dma_complete;
>  	dma_desc->callback_param = i2c_dev;
> +
>  	dmaengine_submit(dma_desc);
>  	dma_async_issue_pending(chan);
> +
>  	return 0;
>  }
>  
> @@ -455,6 +461,7 @@ static int tegra_i2c_init_dma(struct tegra_i2c_dev *i2c_dev)
>  
>  	i2c_dev->dma_buf = dma_buf;
>  	i2c_dev->dma_phys = dma_phys;
> +
>  	return 0;
>  
>  err_out:
> @@ -557,6 +564,7 @@ static int tegra_i2c_flush_fifos(struct tegra_i2c_dev *i2c_dev)
>  		dev_err(i2c_dev->dev, "failed to flush FIFO\n");
>  		return err;
>  	}
> +
>  	return 0;
>  }
>  
> @@ -650,8 +658,7 @@ static int tegra_i2c_init(struct tegra_i2c_dev *i2c_dev)
>  	if (i2c_dev->hw->has_interface_timing_reg && tsu_thd)
>  		i2c_writel(i2c_dev, tsu_thd, I2C_INTERFACE_TIMING_1);
>  
> -	clk_multiplier  = tlow + thigh + 2;
> -	clk_multiplier *= non_hs_mode + 1;
> +	clk_multiplier = (tlow + thigh + 2) * (non_hs_mode + 1);
>  
>  	err = clk_set_rate(i2c_dev->div_clk,
>  			   i2c_dev->bus_clk_rate * clk_multiplier);
> @@ -799,9 +806,9 @@ static int tegra_i2c_fill_tx_fifo(struct tegra_i2c_dev *i2c_dev)
>  		 */
>  		buf_remaining -= words_to_transfer * BYTES_PER_FIFO_WORD;
>  		tx_fifo_avail -= words_to_transfer;
> +
>  		i2c_dev->msg_buf_remaining = buf_remaining;
> -		i2c_dev->msg_buf = buf +
> -			words_to_transfer * BYTES_PER_FIFO_WORD;
> +		i2c_dev->msg_buf = buf + words_to_transfer * BYTES_PER_FIFO_WORD;
>  
>  		i2c_writesl(i2c_dev, buf, I2C_TX_FIFO, words_to_transfer);
>  
> @@ -914,12 +921,18 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
>  	goto done;
>  err:
>  	/* mask all interrupts on error */
> -	tegra_i2c_mask_irq(i2c_dev, I2C_INT_NO_ACK | I2C_INT_ARBITRATION_LOST |
> -		I2C_INT_PACKET_XFER_COMPLETE | I2C_INT_TX_FIFO_DATA_REQ |
> -		I2C_INT_RX_FIFO_DATA_REQ);
> +	tegra_i2c_mask_irq(i2c_dev,
> +			   I2C_INT_NO_ACK |
> +			   I2C_INT_ARBITRATION_LOST |
> +			   I2C_INT_PACKET_XFER_COMPLETE |
> +			   I2C_INT_TX_FIFO_DATA_REQ |
> +			   I2C_INT_RX_FIFO_DATA_REQ);

This now seems inconsistent with the choice in other places in this
driver where we wrap only when necessary. I think it would be more
consistent to align the subsequent lines with the parameters on the
first line. Or alternatively assign to a local variable and pass that to
tegra_i2c_mask_irq().

But the above is fine with me as well:

Acked-by: Thierry Reding <treding@xxxxxxxxxx>

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux