linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: rk3x: Remove unlikely() annotations
@ 2014-08-22 17:43 Doug Anderson
       [not found] ` <1408729424-11433-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Doug Anderson @ 2014-08-22 17:43 UTC (permalink / raw)
  To: Wolfram Sang, Dmitry Torokhov
  Cc: Addy Ke, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Doug Anderson,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, max.schwarz-BGeptl67XyCzQB+pC5nmwQ,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Having a transfer more than 32 bits is not all that unlikely.  Remove
the annotation.

The unlikely in the IRQ handler can't gain us much.  It's not in a
loop, so at most it would save 1 instruction per IRQ, which isn't
much.  In fact on the compiler I tested it produced the exact same
code.  Remove it too.

Suggested-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
---
 drivers/i2c/busses/i2c-rk3x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 69e1185..b8b2b89 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -208,7 +208,7 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c)
 	 * The hw can read up to 32 bytes at a time. If we need more than one
 	 * chunk, send an ACK after the last byte of the current chunk.
 	 */
-	if (unlikely(len > 32)) {
+	if (len > 32) {
 		len = 32;
 		con &= ~REG_CON_LASTACK;
 	} else {
@@ -399,7 +399,7 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id)
 	}
 
 	/* is there anything left to handle? */
-	if (unlikely((ipd & REG_INT_ALL) == 0))
+	if ((ipd & REG_INT_ALL) == 0)
 		goto out;
 
 	switch (i2c->state) {
-- 
2.1.0.rc2.206.gedb03e5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] i2c: rk3x: Remove unlikely() annotations
       [not found] ` <1408729424-11433-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
@ 2014-09-20 12:17   ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2014-09-20 12:17 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Dmitry Torokhov, Addy Ke,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-rockchip-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, max.schwarz-BGeptl67XyCzQB+pC5nmwQ,
	dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 606 bytes --]

On Fri, Aug 22, 2014 at 10:43:44AM -0700, Doug Anderson wrote:
> Having a transfer more than 32 bits is not all that unlikely.  Remove
> the annotation.
> 
> The unlikely in the IRQ handler can't gain us much.  It's not in a
> loop, so at most it would save 1 instruction per IRQ, which isn't
> much.  In fact on the compiler I tested it produced the exact same
> code.  Remove it too.
> 
> Suggested-by: Dmitry Torokhov <dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> Signed-off-by: Doug Anderson <dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>

Applied to for-next, thanks!


[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-20 12:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-22 17:43 [PATCH] i2c: rk3x: Remove unlikely() annotations Doug Anderson
     [not found] ` <1408729424-11433-1-git-send-email-dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>
2014-09-20 12:17   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).