diff options
-rw-r--r-- | drivers/media/common/ir-functions.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/media/common/ir-functions.c b/drivers/media/common/ir-functions.c index fcb194135627..fe447a06e24e 100644 --- a/drivers/media/common/ir-functions.c +++ b/drivers/media/common/ir-functions.c | |||
@@ -107,21 +107,20 @@ void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /* -------------------------------------------------------------------------- */ | 109 | /* -------------------------------------------------------------------------- */ |
110 | 110 | /* extract mask bits out of data and pack them into the result */ | |
111 | u32 ir_extract_bits(u32 data, u32 mask) | 111 | u32 ir_extract_bits(u32 data, u32 mask) |
112 | { | 112 | { |
113 | int mbit, vbit; | 113 | u32 vbit = 1, value = 0; |
114 | u32 value; | 114 | |
115 | do { | ||
116 | if (mask&1) { | ||
117 | if (data&1) | ||
118 | value |= vbit; | ||
119 | vbit<<=1; | ||
120 | } | ||
121 | data>>=1; | ||
122 | } while (mask>>=1); | ||
115 | 123 | ||
116 | value = 0; | ||
117 | vbit = 0; | ||
118 | for (mbit = 0; mbit < 32; mbit++) { | ||
119 | if (!(mask & ((u32)1 << mbit))) | ||
120 | continue; | ||
121 | if (data & ((u32)1 << mbit)) | ||
122 | value |= (1 << vbit); | ||
123 | vbit++; | ||
124 | } | ||
125 | return value; | 124 | return value; |
126 | } | 125 | } |
127 | 126 | ||