aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiner Kallweit <hkallweit1@gmail.com>2016-08-02 01:44:44 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-09-22 10:24:28 -0400
commitbacf8351f23cfdccb0cd252e3df0f82871896f9a (patch)
tree3c25935a22acd65cfc9190bf16e5a085da556333
parentd14f291b6280a675b7bf129aa9a2d7a077554a31 (diff)
[media] media: rc: nuvoton: remove usage of b_idx in nvt_get_rx_ir_data
The call to nvt_get_rx_ir_data and nvt_process_rx_ir_data from the ISR is protected with spinlock nvt->lock. Therefore it's guaranteed that nvt->pkts is 0 when entering nvt_get_rx_ir_data (as nvt->pkts is set to 0 at the end of nvt_process_rx_ir_data). Having said that we can remove b_idx. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
-rw-r--r--drivers/media/rc/nuvoton-cir.c13
1 files changed, 2 insertions, 11 deletions
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 0c69536ea813..e4158a962c7a 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -802,7 +802,6 @@ static void nvt_handle_rx_fifo_overrun(struct nvt_dev *nvt)
802static void nvt_get_rx_ir_data(struct nvt_dev *nvt) 802static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
803{ 803{
804 u8 fifocount, val; 804 u8 fifocount, val;
805 unsigned int b_idx;
806 int i; 805 int i;
807 806
808 /* Get count of how many bytes to read from RX FIFO */ 807 /* Get count of how many bytes to read from RX FIFO */
@@ -810,21 +809,13 @@ static void nvt_get_rx_ir_data(struct nvt_dev *nvt)
810 809
811 nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount); 810 nvt_dbg("attempting to fetch %u bytes from hw rx fifo", fifocount);
812 811
813 b_idx = nvt->pkts;
814
815 /* This should never happen, but lets check anyway... */
816 if (b_idx + fifocount > RX_BUF_LEN) {
817 nvt_process_rx_ir_data(nvt);
818 b_idx = 0;
819 }
820
821 /* Read fifocount bytes from CIR Sample RX FIFO register */ 812 /* Read fifocount bytes from CIR Sample RX FIFO register */
822 for (i = 0; i < fifocount; i++) { 813 for (i = 0; i < fifocount; i++) {
823 val = nvt_cir_reg_read(nvt, CIR_SRXFIFO); 814 val = nvt_cir_reg_read(nvt, CIR_SRXFIFO);
824 nvt->buf[b_idx + i] = val; 815 nvt->buf[i] = val;
825 } 816 }
826 817
827 nvt->pkts += fifocount; 818 nvt->pkts = fifocount;
828 nvt_dbg("%s: pkts now %d", __func__, nvt->pkts); 819 nvt_dbg("%s: pkts now %d", __func__, nvt->pkts);
829 820
830 nvt_process_rx_ir_data(nvt); 821 nvt_process_rx_ir_data(nvt);