2020-09-08 22:45:21

by Dmitry Osipenko

[permalink] [raw]
Subject: [PATCH v7 18/34] i2c: tegra: Remove likely/unlikely from the code

The likely/unlikely annotations should be used only in a hot paths of
performance-critical code. The I2C driver doesn't have such paths, and
thus, there is no justification for usage of likely/unlikely annotations
in the code. Hence remove them.

Reviewed-by: Michał Mirosław <[email protected]>
Signed-off-by: Dmitry Osipenko <[email protected]>
---
drivers/i2c/busses/i2c-tegra.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index ab83d1de6c94..fd0d51ec447f 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -852,7 +852,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
goto err;
}

- if (unlikely(status & status_err)) {
+ if (status & status_err) {
tegra_i2c_disable_packet_mode(i2c_dev);
if (status & I2C_INT_NO_ACK)
i2c_dev->msg_err |= I2C_ERR_NO_ACK;
@@ -1294,7 +1294,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
i2c_dev->msg_err);

i2c_dev->is_curr_dma_xfer = false;
- if (likely(i2c_dev->msg_err == I2C_ERR_NONE))
+ if (i2c_dev->msg_err == I2C_ERR_NONE)
return 0;

tegra_i2c_init(i2c_dev);
--
2.27.0


2020-09-17 12:46:55

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v7 18/34] i2c: tegra: Remove likely/unlikely from the code

On Wed, Sep 09, 2020 at 01:39:50AM +0300, Dmitry Osipenko wrote:
> The likely/unlikely annotations should be used only in a hot paths of
> performance-critical code. The I2C driver doesn't have such paths, and
> thus, there is no justification for usage of likely/unlikely annotations
> in the code. Hence remove them.
>
> Reviewed-by: Michał Mirosław <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> ---
> drivers/i2c/busses/i2c-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index ab83d1de6c94..fd0d51ec447f 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -852,7 +852,7 @@ static irqreturn_t tegra_i2c_isr(int irq, void *dev_id)
> goto err;
> }
>
> - if (unlikely(status & status_err)) {
> + if (status & status_err) {
> tegra_i2c_disable_packet_mode(i2c_dev);
> if (status & I2C_INT_NO_ACK)
> i2c_dev->msg_err |= I2C_ERR_NO_ACK;

At least this one is an interrupt handler, so it's kind of performance
critical. That said, it probably doesn't make a huge difference, so I
don't have any objection:

Acked-by: Thierry Reding <[email protected]>


Attachments:
(No filename) (1.25 kB)
signature.asc (849.00 B)
Download all attachments

2020-09-21 10:23:52

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v7 18/34] i2c: tegra: Remove likely/unlikely from the code

On Wed, 09 Sep 2020 01:39:50 +0300, Dmitry Osipenko wrote:
> The likely/unlikely annotations should be used only in a hot paths of
> performance-critical code. The I2C driver doesn't have such paths, and
> thus, there is no justification for usage of likely/unlikely annotations
> in the code. Hence remove them.
>
> Reviewed-by: Michał Mirosław <[email protected]>
> Signed-off-by: Dmitry Osipenko <[email protected]>
> Acked-by: Thierry Reding <[email protected]>
> ---
> drivers/i2c/busses/i2c-tegra.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)

Tested-by: Thierry Reding <[email protected]>