diff options
author | Sean Young <sean@mess.org> | 2022-01-15 13:08:14 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@kernel.org> | 2022-01-24 03:38:32 +0300 |
commit | 7dc5fc6d3bd6779c4859d888221f47e986cb45b5 (patch) | |
tree | e900d1866e12a09bfbfe1886b343fb40a87dbd26 | |
parent | 6a554bb5653f9844c2ee179d91a757b28ec36a99 (diff) | |
download | linux-7dc5fc6d3bd6779c4859d888221f47e986cb45b5.tar.xz |
media: mtk-cir: simplify code
Re-write without unnecessary shifts.
Cc: Sean Wang <sean.wang@mediatek.com>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
-rw-r--r-- | drivers/media/rc/mtk-cir.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/media/rc/mtk-cir.c b/drivers/media/rc/mtk-cir.c index 1255e3afb032..27b7412d02a5 100644 --- a/drivers/media/rc/mtk-cir.c +++ b/drivers/media/rc/mtk-cir.c @@ -203,10 +203,10 @@ static inline void mtk_irq_enable(struct mtk_ir *ir, u32 mask) static irqreturn_t mtk_ir_irq(int irqno, void *dev_id) { + struct ir_raw_event rawir = {}; struct mtk_ir *ir = dev_id; - u8 wid = 0; u32 i, j, val; - struct ir_raw_event rawir = {}; + u8 wid; /* * Each pulse and space is encoded as a single byte, each byte @@ -228,7 +228,8 @@ static irqreturn_t mtk_ir_irq(int irqno, void *dev_id) dev_dbg(ir->dev, "@reg%d=0x%08x\n", i, val); for (j = 0 ; j < 4 ; j++) { - wid = (val & (MTK_WIDTH_MASK << j * 8)) >> j * 8; + wid = val & MTK_WIDTH_MASK; + val >>= 8; rawir.pulse = !rawir.pulse; rawir.duration = wid * (MTK_IR_SAMPLE + 1); ir_raw_event_store_with_filter(ir->rc, &rawir); |