Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
4ac8a226
Commit
4ac8a226
authored
Oct 29, 2009
by
Akinobu Mita
Committed by
james toy
Oct 29, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by:
Andrew Morton
<
akpm@linux-foundation.org
>
parent
509ebaae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
21 deletions
+12
-21
lib/genalloc.c
lib/genalloc.c
+12
-21
No files found.
lib/genalloc.c
View file @
4ac8a226
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
*/
*/
#include <linux/module.h>
#include <linux/module.h>
#include <linux/bitmap.h>
#include <linux/genalloc.h>
#include <linux/genalloc.h>
...
@@ -114,7 +115,7 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
...
@@ -114,7 +115,7 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
struct
gen_pool_chunk
*
chunk
;
struct
gen_pool_chunk
*
chunk
;
unsigned
long
addr
,
flags
;
unsigned
long
addr
,
flags
;
int
order
=
pool
->
min_alloc_order
;
int
order
=
pool
->
min_alloc_order
;
int
nbits
,
bit
,
start_bit
,
end_bit
;
int
nbits
,
start_bit
,
end_bit
;
if
(
size
==
0
)
if
(
size
==
0
)
return
0
;
return
0
;
...
@@ -129,30 +130,20 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
...
@@ -129,30 +130,20 @@ unsigned long gen_pool_alloc(struct gen_pool *pool, size_t size)
end_bit
-=
nbits
+
1
;
end_bit
-=
nbits
+
1
;
spin_lock_irqsave
(
&
chunk
->
lock
,
flags
);
spin_lock_irqsave
(
&
chunk
->
lock
,
flags
);
bit
=
-
1
;
start_bit
=
bitmap_find_next_zero_area
(
chunk
->
bits
,
end_bit
,
0
,
while
(
bit
+
1
<
end_bit
)
{
nbits
,
0
);
bit
=
find_next_zero_bit
(
chunk
->
bits
,
end_bit
,
bit
+
1
);
if
(
start_bit
>=
end_bit
)
{
if
(
bit
>=
end_bit
)
spin_unlock_irqrestore
(
&
chunk
->
lock
,
flags
);
break
;
start_bit
=
bit
;
if
(
nbits
>
1
)
{
bit
=
find_next_bit
(
chunk
->
bits
,
bit
+
nbits
,
bit
+
1
);
if
(
bit
-
start_bit
<
nbits
)
continue
;
continue
;
}
}
addr
=
chunk
->
start_addr
+
addr
=
chunk
->
start_addr
+
((
unsigned
long
)
start_bit
<<
order
);
((
unsigned
long
)
start_bit
<<
order
);
while
(
nbits
--
)
bitmap_set
(
chunk
->
bits
,
start_bit
,
nbits
);
__set_bit
(
start_bit
++
,
chunk
->
bits
);
spin_unlock_irqrestore
(
&
chunk
->
lock
,
flags
);
spin_unlock_irqrestore
(
&
chunk
->
lock
,
flags
);
read_unlock
(
&
pool
->
lock
);
read_unlock
(
&
pool
->
lock
);
return
addr
;
return
addr
;
}
}
spin_unlock_irqrestore
(
&
chunk
->
lock
,
flags
);
}
read_unlock
(
&
pool
->
lock
);
read_unlock
(
&
pool
->
lock
);
return
0
;
return
0
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment