Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
10a5709f
Commit
10a5709f
authored
Dec 31, 2002
by
Dave Jones
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[AGP] mmap readability cleanup
parent
0a5bd7ac
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
31 deletions
+32
-31
drivers/char/agp/frontend.c
drivers/char/agp/frontend.c
+32
-31
No files found.
drivers/char/agp/frontend.c
View file @
10a5709f
...
...
@@ -584,14 +584,12 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
AGP_LOCK
();
if
(
agp_fe
.
backend_acquired
!=
TRUE
)
{
AGP_UNLOCK
();
return
-
EPERM
;
}
if
(
!
(
test_bit
(
AGP_FF_IS_VALID
,
&
priv
->
access_flags
)))
{
AGP_UNLOCK
();
return
-
EPERM
;
}
if
(
agp_fe
.
backend_acquired
!=
TRUE
)
goto
out_eperm
;
if
(
!
(
test_bit
(
AGP_FF_IS_VALID
,
&
priv
->
access_flags
)))
goto
out_eperm
;
agp_copy_info
(
&
kerninfo
);
size
=
vma
->
vm_end
-
vma
->
vm_start
;
current_size
=
kerninfo
.
aper_size
;
...
...
@@ -599,45 +597,48 @@ static int agp_mmap(struct file *file, struct vm_area_struct *vma)
offset
=
vma
->
vm_pgoff
<<
PAGE_SHIFT
;
if
(
test_bit
(
AGP_FF_IS_CLIENT
,
&
priv
->
access_flags
))
{
if
((
size
+
offset
)
>
current_size
)
{
AGP_UNLOCK
();
return
-
EINVAL
;
}
if
((
size
+
offset
)
>
current_size
)
goto
out_inval
;
client
=
agp_find_client_by_pid
(
current
->
pid
);
if
(
client
==
NULL
)
{
AGP_UNLOCK
();
return
-
EPERM
;
}
if
(
!
agp_find_seg_in_client
(
client
,
offset
,
size
,
vma
->
vm_page_prot
))
{
AGP_UNLOCK
();
return
-
EINVAL
;
}
if
(
remap_page_range
(
vma
,
vma
->
vm_start
,
(
kerninfo
.
aper_base
+
offset
),
if
(
client
==
NULL
)
goto
out_eperm
;
if
(
!
agp_find_seg_in_client
(
client
,
offset
,
size
,
vma
->
vm_page_prot
))
goto
out_inval
;
if
(
remap_page_range
(
vma
,
vma
->
vm_start
,
(
kerninfo
.
aper_base
+
offset
),
size
,
vma
->
vm_page_prot
))
{
AGP_UNLOCK
();
return
-
EAGAIN
;
goto
out_again
;
}
AGP_UNLOCK
();
return
0
;
}
if
(
test_bit
(
AGP_FF_IS_CONTROLLER
,
&
priv
->
access_flags
))
{
if
(
size
!=
current_size
)
{
AGP_UNLOCK
();
return
-
EINVAL
;
}
if
(
size
!=
current_size
)
goto
out_inval
;
if
(
remap_page_range
(
vma
,
vma
->
vm_start
,
kerninfo
.
aper_base
,
size
,
vma
->
vm_page_prot
))
{
AGP_UNLOCK
();
return
-
EAGAIN
;
goto
out_again
;
}
AGP_UNLOCK
();
return
0
;
}
out_eperm:
AGP_UNLOCK
();
return
-
EPERM
;
out_inval:
AGP_UNLOCK
();
return
-
EINVAL
;
out_again:
AGP_UNLOCK
();
return
-
EAGAIN
;
}
static
int
agp_release
(
struct
inode
*
inode
,
struct
file
*
file
)
...
...
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