This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: usb: ttusb-dec: reduce the number of memory reads in 
ttusb_dec_handle_irq()
Author:  Jia-Ju Bai <[email protected]>
Date:    Thu May 7 12:25:21 2020 +0200

In ttusb_dec_handle_irq(), buffer[4] is continuously read from memory
three times, without being modified.
To reduce the number of memory reads, buffer[4] is first assigned to a
local variable index, and then index is used to replace buffer[4].

Signed-off-by: Jia-Ju Bai <[email protected]>
Reviewed-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Sean Young <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/usb/ttusb-dec/ttusb_dec.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

---

diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c 
b/drivers/media/usb/ttusb-dec/ttusb_dec.c
index 3198f9624b7c..b8d39b2f777f 100644
--- a/drivers/media/usb/ttusb-dec/ttusb_dec.c
+++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c
@@ -250,6 +250,7 @@ static void ttusb_dec_handle_irq( struct urb *urb)
        struct ttusb_dec *dec = urb->context;
        char *buffer = dec->irq_buffer;
        int retval;
+       int index = buffer[4];
 
        switch(urb->status) {
                case 0: /*success*/
@@ -281,11 +282,11 @@ static void ttusb_dec_handle_irq( struct urb *urb)
                 * this should/could be added later ...
                 * for now lets report each signal as a key down and up
                 */
-               if (buffer[4] - 1 < ARRAY_SIZE(rc_keys)) {
-                       dprintk("%s:rc signal:%d\n", __func__, buffer[4]);
-                       input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 
1], 1);
+               if (index - 1 < ARRAY_SIZE(rc_keys)) {
+                       dprintk("%s:rc signal:%d\n", __func__, index);
+                       input_report_key(dec->rc_input_dev, rc_keys[index - 1], 
1);
                        input_sync(dec->rc_input_dev);
-                       input_report_key(dec->rc_input_dev, rc_keys[buffer[4] - 
1], 0);
+                       input_report_key(dec->rc_input_dev, rc_keys[index - 1], 
0);
                        input_sync(dec->rc_input_dev);
                }
        }

_______________________________________________
linuxtv-commits mailing list
[email protected]
https://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to