File tree Expand file tree Collapse file tree 1 file changed +8
-18
lines changed
drivers/firmware/efi/libstub Expand file tree Collapse file tree 1 file changed +8
-18
lines changed Original file line number Diff line number Diff line change 5
5
*
6
6
* ----------------------------------------------------------------------- */
7
7
8
+ #include <linux/bitops.h>
8
9
#include <linux/efi.h>
9
10
#include <linux/screen_info.h>
10
11
#include <asm/efi.h>
11
12
#include <asm/setup.h>
12
13
13
14
#include "efistub.h"
14
15
15
- static void find_bits (unsigned long mask , u8 * pos , u8 * size )
16
+ static void find_bits (u32 mask , u8 * pos , u8 * size )
16
17
{
17
- u8 first , len ;
18
-
19
- first = 0 ;
20
- len = 0 ;
21
-
22
- if (mask ) {
23
- while (!(mask & 0x1 )) {
24
- mask = mask >> 1 ;
25
- first ++ ;
26
- }
27
-
28
- while (mask & 0x1 ) {
29
- mask = mask >> 1 ;
30
- len ++ ;
31
- }
18
+ if (!mask ) {
19
+ * pos = * size = 0 ;
20
+ return ;
32
21
}
33
22
34
- * pos = first ;
35
- * size = len ;
23
+ /* UEFI spec guarantees that the set bits are contiguous */
24
+ * pos = __ffs (mask );
25
+ * size = __fls (mask ) - * pos + 1 ;
36
26
}
37
27
38
28
static void
You can’t perform that action at this time.
0 commit comments