diff options
author | Sean Young <sean@mess.org> | 2019-10-07 13:36:45 +0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-10-16 17:46:38 +0300 |
commit | d587cdb2a5f57053ef182f64894ed3ba9e1559dc (patch) | |
tree | 2ea8830a2ad0e6154a744b6b2955a29aebedb1a1 /drivers | |
parent | 14494583336880640654300c76d0f5df3360d85f (diff) | |
download | linux-d587cdb2a5f57053ef182f64894ed3ba9e1559dc.tar.xz |
media: imon_raw: simplify loop
The code for pulse and space is the same so remove duplication.
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/rc/imon_raw.c | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/drivers/media/rc/imon_raw.c b/drivers/media/rc/imon_raw.c index d4aedcf76418..aae0a3cc9479 100644 --- a/drivers/media/rc/imon_raw.c +++ b/drivers/media/rc/imon_raw.c @@ -57,32 +57,18 @@ static void imon_ir_data(struct imon *imon) * fls will tell us the highest bit set plus 1 (or 0 if no * bits are set). */ + rawir.pulse = !rawir.pulse; bit = fls64(data & (BIT_ULL(offset) - 1)); if (bit < offset) { - dev_dbg(imon->dev, "pulse: %d bits", offset - bit); - rawir.pulse = true; + dev_dbg(imon->dev, "%s: %d bits", + rawir.pulse ? "pulse" : "space", offset - bit); rawir.duration = (offset - bit) * BIT_DURATION; ir_raw_event_store_with_filter(imon->rcdev, &rawir); - if (bit == 0) - break; - offset = bit; } - /* - * Find highest clear bit which is less than offset. - * - * Just invert the data and use same trick as above. - */ - bit = fls64(~data & (BIT_ULL(offset) - 1)); - dev_dbg(imon->dev, "space: %d bits", offset - bit); - - rawir.pulse = false; - rawir.duration = (offset - bit) * BIT_DURATION; - ir_raw_event_store_with_filter(imon->rcdev, &rawir); - - offset = bit; + data = ~data; } while (offset > 0); if (packet_no == 0x0a && !imon->rcdev->idle) { |