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
e0be428e
Commit
e0be428e
authored
Jul 12, 2007
by
Dave Airlie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
drm: detypedef the hashtab and more of sman
Signed-off-by:
Dave Airlie
<
airlied@linux.ie
>
parent
9698b4db
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
59 deletions
+59
-59
drivers/char/drm/drmP.h
drivers/char/drm/drmP.h
+4
-4
drivers/char/drm/drm_auth.c
drivers/char/drm/drm_auth.c
+2
-2
drivers/char/drm/drm_bufs.c
drivers/char/drm/drm_bufs.c
+1
-1
drivers/char/drm/drm_hashtab.c
drivers/char/drm/drm_hashtab.c
+17
-17
drivers/char/drm/drm_hashtab.h
drivers/char/drm/drm_hashtab.h
+12
-12
drivers/char/drm/drm_sman.c
drivers/char/drm/drm_sman.c
+18
-18
drivers/char/drm/drm_sman.h
drivers/char/drm/drm_sman.h
+3
-3
drivers/char/drm/drm_vm.c
drivers/char/drm/drm_vm.c
+2
-2
No files found.
drivers/char/drm/drmP.h
View file @
e0be428e
...
...
@@ -276,7 +276,7 @@ typedef struct drm_ioctl_desc {
struct
drm_magic_entry
{
struct
list_head
head
;
drm_hash_item_t
hash_item
;
struct
drm_hash_item
hash_item
;
struct
drm_file
*
priv
;
struct
drm_magic_entry
*
next
;
};
...
...
@@ -481,7 +481,7 @@ struct drm_sigdata {
*/
struct
drm_map_list
{
struct
list_head
head
;
/**< list head */
drm_hash_item_t
hash
;
struct
drm_hash_item
hash
;
struct
drm_map
*
map
;
/**< mapping */
unsigned
int
user_token
;
};
...
...
@@ -660,7 +660,7 @@ struct drm_device {
/** \name Authentication */
/*@{ */
struct
list_head
filelist
;
drm_open_hash_t
magiclist
;
/**< magic hash table */
struct
drm_open_hash
magiclist
;
/**< magic hash table */
struct
list_head
magicfree
;
/*@} */
...
...
@@ -668,7 +668,7 @@ struct drm_device {
/*@{ */
struct
list_head
maplist
;
/**< Linked list of regions */
int
map_count
;
/**< Number of mappable regions */
drm_open_hash_t
map_hash
;
/**< User token hash table for maps */
struct
drm_open_hash
map_hash
;
/**< User token hash table for maps */
/** \name Context handle management */
/*@{ */
...
...
drivers/char/drm/drm_auth.c
View file @
e0be428e
...
...
@@ -49,7 +49,7 @@ static struct drm_file *drm_find_file(struct drm_device * dev, drm_magic_t magic
{
struct
drm_file
*
retval
=
NULL
;
struct
drm_magic_entry
*
pt
;
drm_hash_item_t
*
hash
;
struct
drm_hash_item
*
hash
;
mutex_lock
(
&
dev
->
struct_mutex
);
if
(
!
drm_ht_find_item
(
&
dev
->
magiclist
,
(
unsigned
long
)
magic
,
&
hash
))
{
...
...
@@ -105,7 +105,7 @@ static int drm_add_magic(struct drm_device * dev, struct drm_file * priv,
static
int
drm_remove_magic
(
struct
drm_device
*
dev
,
drm_magic_t
magic
)
{
struct
drm_magic_entry
*
pt
;
drm_hash_item_t
*
hash
;
struct
drm_hash_item
*
hash
;
DRM_DEBUG
(
"%d
\n
"
,
magic
);
...
...
drivers/char/drm/drm_bufs.c
View file @
e0be428e
...
...
@@ -64,7 +64,7 @@ static struct drm_map_list *drm_find_matching_map(struct drm_device *dev,
return
NULL
;
}
static
int
drm_map_handle
(
struct
drm_device
*
dev
,
drm_hash_item_t
*
hash
,
static
int
drm_map_handle
(
struct
drm_device
*
dev
,
struct
drm_hash_item
*
hash
,
unsigned
long
user_token
,
int
hashed_handle
)
{
int
use_hashed_handle
;
...
...
drivers/char/drm/drm_hashtab.c
View file @
e0be428e
...
...
@@ -36,7 +36,7 @@
#include "drm_hashtab.h"
#include <linux/hash.h>
int
drm_ht_create
(
drm_open_hash_t
*
ht
,
unsigned
int
order
)
int
drm_ht_create
(
struct
drm_open_hash
*
ht
,
unsigned
int
order
)
{
unsigned
int
i
;
...
...
@@ -63,9 +63,9 @@ int drm_ht_create(drm_open_hash_t *ht, unsigned int order)
return
0
;
}
void
drm_ht_verbose_list
(
drm_open_hash_t
*
ht
,
unsigned
long
key
)
void
drm_ht_verbose_list
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
)
{
drm_hash_item_t
*
entry
;
struct
drm_hash_item
*
entry
;
struct
hlist_head
*
h_list
;
struct
hlist_node
*
list
;
unsigned
int
hashed_key
;
...
...
@@ -75,15 +75,15 @@ void drm_ht_verbose_list(drm_open_hash_t *ht, unsigned long key)
DRM_DEBUG
(
"Key is 0x%08lx, Hashed key is 0x%08x
\n
"
,
key
,
hashed_key
);
h_list
=
&
ht
->
table
[
hashed_key
];
hlist_for_each
(
list
,
h_list
)
{
entry
=
hlist_entry
(
list
,
drm_hash_item_t
,
head
);
entry
=
hlist_entry
(
list
,
struct
drm_hash_item
,
head
);
DRM_DEBUG
(
"count %d, key: 0x%08lx
\n
"
,
count
++
,
entry
->
key
);
}
}
static
struct
hlist_node
*
drm_ht_find_key
(
drm_open_hash_t
*
ht
,
static
struct
hlist_node
*
drm_ht_find_key
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
)
{
drm_hash_item_t
*
entry
;
struct
drm_hash_item
*
entry
;
struct
hlist_head
*
h_list
;
struct
hlist_node
*
list
;
unsigned
int
hashed_key
;
...
...
@@ -91,7 +91,7 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
hashed_key
=
hash_long
(
key
,
ht
->
order
);
h_list
=
&
ht
->
table
[
hashed_key
];
hlist_for_each
(
list
,
h_list
)
{
entry
=
hlist_entry
(
list
,
drm_hash_item_t
,
head
);
entry
=
hlist_entry
(
list
,
struct
drm_hash_item
,
head
);
if
(
entry
->
key
==
key
)
return
list
;
if
(
entry
->
key
>
key
)
...
...
@@ -101,9 +101,9 @@ static struct hlist_node *drm_ht_find_key(drm_open_hash_t *ht,
}
int
drm_ht_insert_item
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
)
int
drm_ht_insert_item
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
)
{
drm_hash_item_t
*
entry
;
struct
drm_hash_item
*
entry
;
struct
hlist_head
*
h_list
;
struct
hlist_node
*
list
,
*
parent
;
unsigned
int
hashed_key
;
...
...
@@ -113,7 +113,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
h_list
=
&
ht
->
table
[
hashed_key
];
parent
=
NULL
;
hlist_for_each
(
list
,
h_list
)
{
entry
=
hlist_entry
(
list
,
drm_hash_item_t
,
head
);
entry
=
hlist_entry
(
list
,
struct
drm_hash_item
,
head
);
if
(
entry
->
key
==
key
)
return
-
EINVAL
;
if
(
entry
->
key
>
key
)
...
...
@@ -132,7 +132,7 @@ int drm_ht_insert_item(drm_open_hash_t *ht, drm_hash_item_t *item)
* Just insert an item and return any "bits" bit key that hasn't been
* used before.
*/
int
drm_ht_just_insert_please
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
,
int
drm_ht_just_insert_please
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
,
unsigned
long
seed
,
int
bits
,
int
shift
,
unsigned
long
add
)
{
...
...
@@ -156,8 +156,8 @@ int drm_ht_just_insert_please(drm_open_hash_t *ht, drm_hash_item_t *item,
return
0
;
}
int
drm_ht_find_item
(
drm_open_hash_t
*
ht
,
unsigned
long
key
,
drm_hash_item_t
**
item
)
int
drm_ht_find_item
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
,
struct
drm_hash_item
**
item
)
{
struct
hlist_node
*
list
;
...
...
@@ -165,11 +165,11 @@ int drm_ht_find_item(drm_open_hash_t *ht, unsigned long key,
if
(
!
list
)
return
-
EINVAL
;
*
item
=
hlist_entry
(
list
,
drm_hash_item_t
,
head
);
*
item
=
hlist_entry
(
list
,
struct
drm_hash_item
,
head
);
return
0
;
}
int
drm_ht_remove_key
(
drm_open_hash_t
*
ht
,
unsigned
long
key
)
int
drm_ht_remove_key
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
)
{
struct
hlist_node
*
list
;
...
...
@@ -182,14 +182,14 @@ int drm_ht_remove_key(drm_open_hash_t *ht, unsigned long key)
return
-
EINVAL
;
}
int
drm_ht_remove_item
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
)
int
drm_ht_remove_item
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
)
{
hlist_del_init
(
&
item
->
head
);
ht
->
fill
--
;
return
0
;
}
void
drm_ht_remove
(
drm_open_hash_t
*
ht
)
void
drm_ht_remove
(
struct
drm_open_hash
*
ht
)
{
if
(
ht
->
table
)
{
if
(
ht
->
use_vmalloc
)
...
...
drivers/char/drm/drm_hashtab.h
View file @
e0be428e
...
...
@@ -37,31 +37,31 @@
#define drm_hash_entry(_ptr, _type, _member) container_of(_ptr, _type, _member)
typedef
struct
drm_hash_item
{
struct
drm_hash_item
{
struct
hlist_node
head
;
unsigned
long
key
;
}
drm_hash_item_t
;
};
typedef
struct
drm_open_hash
{
struct
drm_open_hash
{
unsigned
int
size
;
unsigned
int
order
;
unsigned
int
fill
;
struct
hlist_head
*
table
;
int
use_vmalloc
;
}
drm_open_hash_t
;
};
extern
int
drm_ht_create
(
drm_open_hash_t
*
ht
,
unsigned
int
order
);
extern
int
drm_ht_insert_item
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
);
extern
int
drm_ht_just_insert_please
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
,
extern
int
drm_ht_create
(
struct
drm_open_hash
*
ht
,
unsigned
int
order
);
extern
int
drm_ht_insert_item
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
);
extern
int
drm_ht_just_insert_please
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
,
unsigned
long
seed
,
int
bits
,
int
shift
,
unsigned
long
add
);
extern
int
drm_ht_find_item
(
drm_open_hash_t
*
ht
,
unsigned
long
key
,
drm_hash_item_t
**
item
);
extern
int
drm_ht_find_item
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
,
struct
drm_hash_item
**
item
);
extern
void
drm_ht_verbose_list
(
drm_open_hash_t
*
ht
,
unsigned
long
key
);
extern
int
drm_ht_remove_key
(
drm_open_hash_t
*
ht
,
unsigned
long
key
);
extern
int
drm_ht_remove_item
(
drm_open_hash_t
*
ht
,
drm_hash_item_t
*
item
);
extern
void
drm_ht_remove
(
drm_open_hash_t
*
ht
);
extern
void
drm_ht_verbose_list
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
);
extern
int
drm_ht_remove_key
(
struct
drm_open_hash
*
ht
,
unsigned
long
key
);
extern
int
drm_ht_remove_item
(
struct
drm_open_hash
*
ht
,
struct
drm_hash_item
*
item
);
extern
void
drm_ht_remove
(
struct
drm_open_hash
*
ht
);
#endif
...
...
drivers/char/drm/drm_sman.c
View file @
e0be428e
...
...
@@ -38,11 +38,11 @@
#include "drm_sman.h"
typedef
struct
drm_owner_item
{
drm_hash_item_t
owner_hash
;
struct
drm_owner_item
{
struct
drm_hash_item
owner_hash
;
struct
list_head
sman_list
;
struct
list_head
mem_blocks
;
}
drm_owner_item_t
;
};
void
drm_sman_takedown
(
struct
drm_sman
*
sman
)
{
...
...
@@ -163,16 +163,16 @@ drm_sman_set_manager(struct drm_sman * sman, unsigned int manager,
}
EXPORT_SYMBOL
(
drm_sman_set_manager
);
static
drm_owner_item_t
*
drm_sman_get_owner_item
(
struct
drm_sman
*
sman
,
static
struct
drm_owner_item
*
drm_sman_get_owner_item
(
struct
drm_sman
*
sman
,
unsigned
long
owner
)
{
int
ret
;
drm_hash_item_t
*
owner_hash_item
;
drm_owner_item_t
*
owner_item
;
struct
drm_hash_item
*
owner_hash_item
;
struct
drm_owner_item
*
owner_item
;
ret
=
drm_ht_find_item
(
&
sman
->
owner_hash_tab
,
owner
,
&
owner_hash_item
);
if
(
!
ret
)
{
return
drm_hash_entry
(
owner_hash_item
,
drm_owner_item_t
,
return
drm_hash_entry
(
owner_hash_item
,
struct
drm_owner_item
,
owner_hash
);
}
...
...
@@ -200,7 +200,7 @@ struct drm_memblock_item *drm_sman_alloc(struct drm_sman *sman, unsigned int man
{
void
*
tmp
;
struct
drm_sman_mm
*
sman_mm
;
drm_owner_item_t
*
owner_item
;
struct
drm_owner_item
*
owner_item
;
struct
drm_memblock_item
*
memblock
;
BUG_ON
(
manager
>=
sman
->
num_managers
);
...
...
@@ -258,7 +258,7 @@ static void drm_sman_free(struct drm_memblock_item *item)
int
drm_sman_free_key
(
struct
drm_sman
*
sman
,
unsigned
int
key
)
{
drm_hash_item_t
*
hash_item
;
struct
drm_hash_item
*
hash_item
;
struct
drm_memblock_item
*
memblock_item
;
if
(
drm_ht_find_item
(
&
sman
->
user_hash_tab
,
key
,
&
hash_item
))
...
...
@@ -273,7 +273,7 @@ int drm_sman_free_key(struct drm_sman *sman, unsigned int key)
EXPORT_SYMBOL
(
drm_sman_free_key
);
static
void
drm_sman_remove_owner
(
struct
drm_sman
*
sman
,
drm_owner_item_t
*
owner_item
)
struct
drm_owner_item
*
owner_item
)
{
list_del
(
&
owner_item
->
sman_list
);
drm_ht_remove_item
(
&
sman
->
owner_hash_tab
,
&
owner_item
->
owner_hash
);
...
...
@@ -283,14 +283,14 @@ static void drm_sman_remove_owner(struct drm_sman *sman,
int
drm_sman_owner_clean
(
struct
drm_sman
*
sman
,
unsigned
long
owner
)
{
drm_hash_item_t
*
hash_item
;
drm_owner_item_t
*
owner_item
;
struct
drm_hash_item
*
hash_item
;
struct
drm_owner_item
*
owner_item
;
if
(
drm_ht_find_item
(
&
sman
->
owner_hash_tab
,
owner
,
&
hash_item
))
{
return
-
1
;
}
owner_item
=
drm_hash_entry
(
hash_item
,
drm_owner_item_t
,
owner_hash
);
owner_item
=
drm_hash_entry
(
hash_item
,
struct
drm_owner_item
,
owner_hash
);
if
(
owner_item
->
mem_blocks
.
next
==
&
owner_item
->
mem_blocks
)
{
drm_sman_remove_owner
(
sman
,
owner_item
);
return
-
1
;
...
...
@@ -302,7 +302,7 @@ int drm_sman_owner_clean(struct drm_sman *sman, unsigned long owner)
EXPORT_SYMBOL
(
drm_sman_owner_clean
);
static
void
drm_sman_do_owner_cleanup
(
struct
drm_sman
*
sman
,
drm_owner_item_t
*
owner_item
)
struct
drm_owner_item
*
owner_item
)
{
struct
drm_memblock_item
*
entry
,
*
next
;
...
...
@@ -316,15 +316,15 @@ static void drm_sman_do_owner_cleanup(struct drm_sman *sman,
void
drm_sman_owner_cleanup
(
struct
drm_sman
*
sman
,
unsigned
long
owner
)
{
drm_hash_item_t
*
hash_item
;
drm_owner_item_t
*
owner_item
;
struct
drm_hash_item
*
hash_item
;
struct
drm_owner_item
*
owner_item
;
if
(
drm_ht_find_item
(
&
sman
->
owner_hash_tab
,
owner
,
&
hash_item
))
{
return
;
}
owner_item
=
drm_hash_entry
(
hash_item
,
drm_owner_item_t
,
owner_hash
);
owner_item
=
drm_hash_entry
(
hash_item
,
struct
drm_owner_item
,
owner_hash
);
drm_sman_do_owner_cleanup
(
sman
,
owner_item
);
}
...
...
@@ -332,7 +332,7 @@ EXPORT_SYMBOL(drm_sman_owner_cleanup);
void
drm_sman_cleanup
(
struct
drm_sman
*
sman
)
{
drm_owner_item_t
*
entry
,
*
next
;
struct
drm_owner_item
*
entry
,
*
next
;
unsigned
int
i
;
struct
drm_sman_mm
*
sman_mm
;
...
...
drivers/char/drm/drm_sman.h
View file @
e0be428e
...
...
@@ -78,7 +78,7 @@ struct drm_sman_mm {
struct
drm_memblock_item
{
struct
list_head
owner_list
;
drm_hash_item_t
user_hash
;
struct
drm_hash_item
user_hash
;
void
*
mm_info
;
struct
drm_sman_mm
*
mm
;
struct
drm_sman
*
sman
;
...
...
@@ -87,8 +87,8 @@ struct drm_memblock_item {
struct
drm_sman
{
struct
drm_sman_mm
*
mm
;
int
num_managers
;
drm_open_hash_t
owner_hash_tab
;
drm_open_hash_t
user_hash_tab
;
struct
drm_open_hash
owner_hash_tab
;
struct
drm_open_hash
user_hash_tab
;
struct
list_head
owner_items
;
};
...
...
drivers/char/drm/drm_vm.c
View file @
e0be428e
...
...
@@ -83,7 +83,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
struct
drm_device
*
dev
=
priv
->
head
->
dev
;
struct
drm_map
*
map
=
NULL
;
struct
drm_map_list
*
r_list
;
drm_hash_item_t
*
hash
;
struct
drm_hash_item
*
hash
;
/*
* Find the right map
...
...
@@ -549,7 +549,7 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
struct
drm_device
*
dev
=
priv
->
head
->
dev
;
struct
drm_map
*
map
=
NULL
;
unsigned
long
offset
=
0
;
drm_hash_item_t
*
hash
;
struct
drm_hash_item
*
hash
;
DRM_DEBUG
(
"start = 0x%lx, end = 0x%lx, page offset = 0x%lx
\n
"
,
vma
->
vm_start
,
vma
->
vm_end
,
vma
->
vm_pgoff
);
...
...
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