Use likely() and unlikely() in code which is called regularily. Signed-off-by: Daniel Mack <daniel@xxxxxxxx>
diff --git a/sound/usb/caiaq/caiaq-audio.c b/sound/usb/caiaq/caiaq-audio.c index 24970a5..8cb417f 100644 --- a/sound/usb/caiaq/caiaq-audio.c +++ b/sound/usb/caiaq/caiaq-audio.c @@ -365,10 +365,10 @@ static void read_in_urb_mode2(struct snd_usb_caiaqdev *dev, check_byte = MAKE_CHECKBYTE(dev, stream, i); - if ((usb_buf[i] & 0x3f) != check_byte) + if (unlikely((usb_buf[i] & 0x3f) != check_byte)) dev->input_panic = 1; - if (usb_buf[i] & 0x80) + if (unlikely(usb_buf[i] & 0x80)) dev->output_panic = 1; } } @@ -394,7 +394,7 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, const struct urb *urb, const struct usb_iso_packet_descriptor *iso) { - if (!dev->streaming) + if (unlikely(!dev->streaming)) return; switch (dev->spec.data_alignment) { @@ -406,7 +406,7 @@ static void read_in_urb(struct snd_usb_caiaqdev *dev, break; } - if (dev->input_panic || dev->output_panic) { + if (unlikely(dev->input_panic || dev->output_panic)) { debug("streaming error detected %s %s\n", dev->input_panic ? "(input)" : "", dev->output_panic ? "(output)" : ""); @@ -454,12 +454,12 @@ static void read_completed(struct urb *urb) struct urb *out; int frame, len, send_it = 0, outframe = 0; - if (urb->status || !info) + if (unlikely(urb->status || !info)) return; dev = info->dev; - if (!dev->streaming) + if (unlikely(!dev->streaming)) return; out = dev->data_urbs_out[info->index]; @@ -467,7 +467,7 @@ static void read_completed(struct urb *urb) /* read the recently received packet and send back one which has * the same layout */ for (frame = 0; frame < FRAMES_PER_URB; frame++) { - if (urb->iso_frame_desc[frame].status) + if (unlikely(urb->iso_frame_desc[frame].status != 0)) continue; len = urb->iso_frame_desc[outframe].actual_length; @@ -488,7 +488,7 @@ static void read_completed(struct urb *urb) outframe++; } - if (send_it) { + if (likely(send_it)) { out->number_of_packets = FRAMES_PER_URB; out->transfer_flags = URB_ISO_ASAP; usb_submit_urb(out, GFP_ATOMIC); @@ -511,7 +511,7 @@ static void write_completed(struct urb *urb) struct snd_usb_caiaq_cb_info *info = urb->context; struct snd_usb_caiaqdev *dev = info->dev; - if (!dev->output_running) { + if (unlikely(!dev->output_running)) { dev->output_running = 1; wake_up(&dev->prepare_wait_queue); } diff --git a/sound/usb/caiaq/caiaq-device.c b/sound/usb/caiaq/caiaq-device.c index e97d8b2..e1dbce5 100644 --- a/sound/usb/caiaq/caiaq-device.c +++ b/sound/usb/caiaq/caiaq-device.c @@ -42,7 +42,7 @@ #endif MODULE_AUTHOR("Daniel Mack <daniel@xxxxxxxx>"); -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.6"); +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.7"); MODULE_LICENSE("GPL"); MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2}," "{Native Instruments, RigKontrol3}," @@ -119,7 +119,7 @@ static void usb_ep1_command_reply_dispatch (struct urb* urb) struct snd_usb_caiaqdev *dev = urb->context; unsigned char *buf = urb->transfer_buffer; - if (urb->status || !dev) { + if (unlikely(urb->status || !dev)) { log("received EP1 urb->status = %i\n", urb->status); return; }
_______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel