linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Richter <stefanr@s5r6.in-berlin.de>
To: linux1394-devel@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] firewire: ohci: add some "unlikely" hints
Date: Sat, 28 Aug 2010 14:22:27 +0200 (CEST)	[thread overview]
Message-ID: <tkrat.3fd9444150751f66@s5r6.in-berlin.de> (raw)
In-Reply-To: <tkrat.8705132a95f3f284@s5r6.in-berlin.de>

Mark evt_no_status and evt_bus_reset packet reception events as ones
that occur rarely.

Also, inline the debug flag check of log_ar_at_event().  [The same is
hopefully not necessary for log_irqs() which is only called at a single
site and hence auto-inlined by the compiler.]

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
---
 drivers/firewire/ohci.c |   28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

Index: b/drivers/firewire/ohci.c
===================================================================
--- a/drivers/firewire/ohci.c
+++ b/drivers/firewire/ohci.c
@@ -398,14 +401,11 @@ static const char *phys[] = {
 	[0x2] = "self-id packet",	[0x3] = "-reserved-",
 };
 
-static void log_ar_at_event(char dir, int speed, u32 *header, int evt)
+static void _ar_at_event(char dir, int speed, u32 *header, int evt)
 {
 	int tcode = header[0] >> 4 & 0xf;
 	char specific[12];
 
-	if (likely(!(param_debug & OHCI_PARAM_DEBUG_AT_AR)))
-		return;
-
 	if (unlikely(evt >= ARRAY_SIZE(evts)))
 			evt = 0x1f;
 
@@ -456,6 +456,12 @@ static void log_ar_at_event(char dir, in
 	}
 }
 
+static inline void log_ar_at_event(char dir, int speed, u32 *header, int evt)
+{
+	if (unlikely(param_debug & OHCI_PARAM_DEBUG_AT_AR))
+		_ar_at_event(dir, speed, header, evt);
+}
+
 #else
 
 #define param_debug 0
@@ -697,7 +703,7 @@ static __le32 *handle_ar_packet(struct a
 	 * Several controllers, notably from NEC and VIA, forget to
 	 * write ack_complete status at PHY packet reception.
 	 */
-	if (evt == OHCI1394_evt_no_status &&
+	if (unlikely(evt == OHCI1394_evt_no_status) &&
 	    (p.header[0] & 0xff) == (OHCI1394_phy_tcode << 4))
 		p.ack = ACK_COMPLETE;
 
@@ -714,7 +720,7 @@ static __le32 *handle_ar_packet(struct a
 	 * wrong generation.  We set the correct generation for these
 	 * at a slightly incorrect time (in bus_reset_tasklet).
 	 */
-	if (evt == OHCI1394_evt_bus_reset) {
+	if (unlikely(evt == OHCI1394_evt_bus_reset)) {
 		if (!(ohci->quirks & QUIRK_RESET_PACKET))
 			ohci->request_generation = (p.header[2] >> 16) & 0xff;
 	} else if (ctx == &ohci->ar_request_ctx) {

-- 
Stefan Richter
-=====-==-=- =--- ===--
http://arcgraph.de/sr/


      reply	other threads:[~2010-08-28 12:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4C6909DD.3070002@ladisch.de>
2010-08-28 12:21 ` [PATCH] firewire: ohci: work around VIA and NEC PHY packet reception bug Stefan Richter
2010-08-28 12:22   ` Stefan Richter [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tkrat.3fd9444150751f66@s5r6.in-berlin.de \
    --to=stefanr@s5r6.in-berlin.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux1394-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).