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
d99ca6ca
Commit
d99ca6ca
authored
Sep 24, 2003
by
Linus Torvalds
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DRI CVS merge: whitespace cleanups for i810_dma.c
parent
bd4b19c1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
34 deletions
+36
-34
drivers/char/drm/i810_dma.c
drivers/char/drm/i810_dma.c
+36
-34
No files found.
drivers/char/drm/i810_dma.c
View file @
d99ca6ca
...
...
@@ -83,7 +83,7 @@ static drm_buf_t *i810_freelist_get(drm_device_t *dev)
/* In use is already a pointer */
used
=
cmpxchg
(
buf_priv
->
in_use
,
I810_BUF_FREE
,
I810_BUF_CLIENT
);
if
(
used
==
I810_BUF_FREE
)
{
if
(
used
==
I810_BUF_FREE
)
{
return
buf
;
}
}
...
...
@@ -101,7 +101,7 @@ static int i810_freelist_put(drm_device_t *dev, drm_buf_t *buf)
/* In use is already a pointer */
used
=
cmpxchg
(
buf_priv
->
in_use
,
I810_BUF_CLIENT
,
I810_BUF_FREE
);
if
(
used
!=
I810_BUF_CLIENT
)
{
if
(
used
!=
I810_BUF_CLIENT
)
{
DRM_ERROR
(
"Freeing buffer thats not in use : %d
\n
"
,
buf
->
idx
);
return
-
EINVAL
;
}
...
...
@@ -154,7 +154,8 @@ static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
struct
file_operations
*
old_fops
;
int
retcode
=
0
;
if
(
buf_priv
->
currently_mapped
==
I810_BUF_MAPPED
)
return
-
EINVAL
;
if
(
buf_priv
->
currently_mapped
==
I810_BUF_MAPPED
)
return
-
EINVAL
;
down_write
(
&
current
->
mm
->
mmap_sem
);
old_fops
=
filp
->
f_op
;
...
...
@@ -182,7 +183,7 @@ static int i810_unmap_buffer(drm_buf_t *buf)
drm_i810_buf_priv_t
*
buf_priv
=
buf
->
dev_private
;
int
retcode
=
0
;
if
(
buf_priv
->
currently_mapped
!=
I810_BUF_MAPPED
)
if
(
buf_priv
->
currently_mapped
!=
I810_BUF_MAPPED
)
return
-
EINVAL
;
down_write
(
&
current
->
mm
->
mmap_sem
);
...
...
@@ -212,7 +213,7 @@ static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d,
}
retcode
=
i810_map_buffer
(
buf
,
filp
);
if
(
retcode
)
{
if
(
retcode
)
{
i810_freelist_put
(
dev
,
buf
);
DRM_ERROR
(
"mapbuf failed, retcode %d
\n
"
,
retcode
);
return
retcode
;
...
...
@@ -244,7 +245,7 @@ int i810_dma_cleanup(drm_device_t *dev)
drm_i810_private_t
*
dev_priv
=
(
drm_i810_private_t
*
)
dev
->
dev_private
;
if
(
dev_priv
->
ring
.
virtual_start
)
{
if
(
dev_priv
->
ring
.
virtual_start
)
{
DRM
(
ioremapfree
)((
void
*
)
dev_priv
->
ring
.
virtual_start
,
dev_priv
->
ring
.
Size
,
dev
);
}
...
...
@@ -289,7 +290,7 @@ static int i810_wait_ring(drm_device_t *dev, int n)
}
iters
++
;
if
(
time_before
(
end
,
jiffies
))
{
if
(
time_before
(
end
,
jiffies
))
{
DRM_ERROR
(
"space: %d wanted %d
\n
"
,
ring
->
space
,
n
);
DRM_ERROR
(
"lockup
\n
"
);
goto
out_wait_ring
;
...
...
@@ -319,7 +320,7 @@ static int i810_freelist_init(drm_device_t *dev, drm_i810_private_t *dev_priv)
u32
*
hw_status
=
(
u32
*
)(
dev_priv
->
hw_status_page
+
my_idx
);
int
i
;
if
(
dma
->
buf_count
>
1019
)
{
if
(
dma
->
buf_count
>
1019
)
{
/* Not enough space in the status page for the freelist */
return
-
EINVAL
;
}
...
...
@@ -350,28 +351,28 @@ static int i810_dma_initialize(drm_device_t *dev,
list_for_each
(
list
,
&
dev
->
maplist
->
head
)
{
drm_map_list_t
*
r_list
=
list_entry
(
list
,
drm_map_list_t
,
head
);
if
(
r_list
->
map
&&
if
(
r_list
->
map
&&
r_list
->
map
->
type
==
_DRM_SHM
&&
r_list
->
map
->
flags
&
_DRM_CONTAINS_LOCK
)
{
dev_priv
->
sarea_map
=
r_list
->
map
;
break
;
}
}
if
(
!
dev_priv
->
sarea_map
)
{
if
(
!
dev_priv
->
sarea_map
)
{
dev
->
dev_private
=
(
void
*
)
dev_priv
;
i810_dma_cleanup
(
dev
);
DRM_ERROR
(
"can not find sarea!
\n
"
);
return
-
EINVAL
;
}
DRM_FIND_MAP
(
dev_priv
->
mmio_map
,
init
->
mmio_offset
);
if
(
!
dev_priv
->
mmio_map
)
{
if
(
!
dev_priv
->
mmio_map
)
{
dev
->
dev_private
=
(
void
*
)
dev_priv
;
i810_dma_cleanup
(
dev
);
DRM_ERROR
(
"can not find mmio map!
\n
"
);
return
-
EINVAL
;
}
DRM_FIND_MAP
(
dev_priv
->
buffer_map
,
init
->
buffers_offset
);
if
(
!
dev_priv
->
buffer_map
)
{
if
(
!
dev_priv
->
buffer_map
)
{
dev
->
dev_private
=
(
void
*
)
dev_priv
;
i810_dma_cleanup
(
dev
);
DRM_ERROR
(
"can not find dma buffer map!
\n
"
);
...
...
@@ -431,7 +432,7 @@ static int i810_dma_initialize(drm_device_t *dev,
DRM_DEBUG
(
"Enabled hardware status page
\n
"
);
/* Now we need to init our freelist */
if
(
i810_freelist_init
(
dev
,
dev_priv
)
!=
0
)
{
if
(
i810_freelist_init
(
dev
,
dev_priv
)
!=
0
)
{
dev
->
dev_private
=
(
void
*
)
dev_priv
;
i810_dma_cleanup
(
dev
);
DRM_ERROR
(
"Not enough space in the status page for"
...
...
@@ -467,8 +468,8 @@ int i810_dma_init_compat(drm_i810_init_t *init, unsigned long arg)
/* This is a v1.2 client, just get the v1.2 init data */
DRM_INFO
(
"Using POST v1.2 init.
\n
"
);
if
(
copy_from_user
(
init
,
(
drm_i810_init_t
*
)
arg
,
sizeof
(
drm_i810_init_t
)))
{
if
(
copy_from_user
(
init
,
(
drm_i810_init_t
*
)
arg
,
sizeof
(
drm_i810_init_t
)))
{
return
-
EFAULT
;
}
}
else
{
...
...
@@ -496,7 +497,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
int
retcode
=
0
;
/* Get only the init func */
if
(
copy_from_user
(
&
init
,
(
void
*
)
arg
,
sizeof
(
drm_i810_init_func_t
)))
if
(
copy_from_user
(
&
init
,
(
void
*
)
arg
,
sizeof
(
drm_i810_init_func_t
)))
return
-
EFAULT
;
switch
(
init
.
func
)
{
...
...
@@ -513,9 +514,9 @@ int i810_dma_init(struct inode *inode, struct file *filp,
dev_priv
=
DRM
(
alloc
)(
sizeof
(
drm_i810_private_t
),
DRM_MEM_DRIVER
);
if
(
dev_priv
==
NULL
)
return
-
ENOMEM
;
return
-
ENOMEM
;
retcode
=
i810_dma_initialize
(
dev
,
dev_priv
,
&
init
);
break
;
break
;
default:
case
I810_INIT_DMA_1_4
:
...
...
@@ -526,15 +527,15 @@ int i810_dma_init(struct inode *inode, struct file *filp,
}
dev_priv
=
DRM
(
alloc
)(
sizeof
(
drm_i810_private_t
),
DRM_MEM_DRIVER
);
if
(
dev_priv
==
NULL
)
return
-
ENOMEM
;
if
(
dev_priv
==
NULL
)
return
-
ENOMEM
;
retcode
=
i810_dma_initialize
(
dev
,
dev_priv
,
&
init
);
break
;
break
;
case
I810_CLEANUP_DMA
:
DRM_INFO
(
"DMA Cleanup
\n
"
);
retcode
=
i810_dma_cleanup
(
dev
);
break
;
break
;
}
return
retcode
;
...
...
@@ -1019,7 +1020,7 @@ void i810_reclaim_buffers(struct file *filp)
if
(
used
==
I810_BUF_CLIENT
)
DRM_DEBUG
(
"reclaimed from client
\n
"
);
if
(
buf_priv
->
currently_mapped
==
I810_BUF_MAPPED
)
if
(
buf_priv
->
currently_mapped
==
I810_BUF_MAPPED
)
buf_priv
->
currently_mapped
=
I810_BUF_UNMAPPED
;
}
}
...
...
@@ -1031,7 +1032,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp,
drm_file_t
*
priv
=
filp
->
private_data
;
drm_device_t
*
dev
=
priv
->
dev
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_flush_ioctl called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1056,7 +1057,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
if
(
copy_from_user
(
&
vertex
,
(
drm_i810_vertex_t
*
)
arg
,
sizeof
(
vertex
)))
return
-
EFAULT
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_dma_vertex called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1064,7 +1065,8 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
DRM_DEBUG
(
"i810 dma vertex, idx %d used %d discard %d
\n
"
,
vertex
.
idx
,
vertex
.
used
,
vertex
.
discard
);
if
(
vertex
.
idx
<
0
||
vertex
.
idx
>
dma
->
buf_count
)
return
-
EINVAL
;
if
(
vertex
.
idx
<
0
||
vertex
.
idx
>
dma
->
buf_count
)
return
-
EINVAL
;
i810_dma_dispatch_vertex
(
dev
,
dma
->
buflist
[
vertex
.
idx
],
...
...
@@ -1090,7 +1092,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
if
(
copy_from_user
(
&
clear
,
(
drm_i810_clear_t
*
)
arg
,
sizeof
(
clear
)))
return
-
EFAULT
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_clear_bufs called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1114,7 +1116,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp,
DRM_DEBUG
(
"i810_swap_bufs
\n
"
);
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_swap_buf called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1152,7 +1154,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
if
(
copy_from_user
(
&
d
,
(
drm_i810_dma_t
*
)
arg
,
sizeof
(
d
)))
return
-
EFAULT
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_dma called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1202,7 +1204,7 @@ static void i810_dma_dispatch_mc(drm_device_t *dev, drm_buf_t *buf, int used,
u
=
cmpxchg
(
buf_priv
->
in_use
,
I810_BUF_CLIENT
,
I810_BUF_HARDWARE
);
if
(
u
!=
I810_BUF_CLIENT
)
{
if
(
u
!=
I810_BUF_CLIENT
)
{
DRM_DEBUG
(
"MC found buffer that isn't mine!
\n
"
);
}
...
...
@@ -1266,7 +1268,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
return
-
EFAULT
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_dma_mc called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1314,7 +1316,7 @@ int i810_fstatus(struct inode *inode, struct file *filp,
drm_device_t
*
dev
=
priv
->
dev
;
drm_i810_private_t
*
dev_priv
=
(
drm_i810_private_t
*
)
dev
->
dev_private
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_fstatus called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1328,7 +1330,7 @@ int i810_ov0_flip(struct inode *inode, struct file *filp,
drm_device_t
*
dev
=
priv
->
dev
;
drm_i810_private_t
*
dev_priv
=
(
drm_i810_private_t
*
)
dev
->
dev_private
;
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_ov0_flip called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
@@ -1373,7 +1375,7 @@ int i810_flip_bufs(struct inode *inode, struct file *filp,
DRM_DEBUG
(
"%s
\n
"
,
__FUNCTION__
);
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
if
(
!
_DRM_LOCK_IS_HELD
(
dev
->
lock
.
hw_lock
->
lock
))
{
DRM_ERROR
(
"i810_flip_buf called without lock held
\n
"
);
return
-
EINVAL
;
}
...
...
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