Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
ttm_lock.c File Reference
#include <drm/ttm/ttm_lock.h>
#include <drm/ttm/ttm_module.h>
#include <linux/atomic.h>
#include <linux/errno.h>
#include <linux/wait.h>
#include <linux/sched.h>
#include <linux/module.h>

Go to the source code of this file.

Macros

#define TTM_WRITE_LOCK_PENDING   (1 << 0)
 
#define TTM_VT_LOCK_PENDING   (1 << 1)
 
#define TTM_SUSPEND_LOCK_PENDING   (1 << 2)
 
#define TTM_VT_LOCK   (1 << 3)
 
#define TTM_SUSPEND_LOCK   (1 << 4)
 

Functions

void ttm_lock_init (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_lock_init)
 
void ttm_read_unlock (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_read_unlock)
 
int ttm_read_lock (struct ttm_lock *lock, bool interruptible)
 
 EXPORT_SYMBOL (ttm_read_lock)
 
int ttm_read_trylock (struct ttm_lock *lock, bool interruptible)
 
void ttm_write_unlock (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_write_unlock)
 
int ttm_write_lock (struct ttm_lock *lock, bool interruptible)
 
 EXPORT_SYMBOL (ttm_write_lock)
 
void ttm_write_lock_downgrade (struct ttm_lock *lock)
 
int ttm_vt_lock (struct ttm_lock *lock, bool interruptible, struct ttm_object_file *tfile)
 
 EXPORT_SYMBOL (ttm_vt_lock)
 
int ttm_vt_unlock (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_vt_unlock)
 
void ttm_suspend_unlock (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_suspend_unlock)
 
void ttm_suspend_lock (struct ttm_lock *lock)
 
 EXPORT_SYMBOL (ttm_suspend_lock)
 

Macro Definition Documentation

#define TTM_SUSPEND_LOCK   (1 << 4)

Definition at line 43 of file ttm_lock.c.

#define TTM_SUSPEND_LOCK_PENDING   (1 << 2)

Definition at line 41 of file ttm_lock.c.

#define TTM_VT_LOCK   (1 << 3)

Definition at line 42 of file ttm_lock.c.

#define TTM_VT_LOCK_PENDING   (1 << 1)

Definition at line 40 of file ttm_lock.c.

#define TTM_WRITE_LOCK_PENDING   (1 << 0)

Definition at line 39 of file ttm_lock.c.

Function Documentation

EXPORT_SYMBOL ( ttm_lock_init  )
EXPORT_SYMBOL ( ttm_read_unlock  )
EXPORT_SYMBOL ( ttm_read_lock  )
EXPORT_SYMBOL ( ttm_write_unlock  )
EXPORT_SYMBOL ( ttm_write_lock  )
EXPORT_SYMBOL ( ttm_vt_lock  )
EXPORT_SYMBOL ( ttm_vt_unlock  )
EXPORT_SYMBOL ( ttm_suspend_unlock  )
EXPORT_SYMBOL ( ttm_suspend_lock  )
void ttm_lock_init ( struct ttm_lock lock)

ttm_lock_init

: Pointer to a struct ttm_lock Initializes the lock.

Definition at line 45 of file ttm_lock.c.

int ttm_read_lock ( struct ttm_lock lock,
bool  interruptible 
)

ttm_read_lock

: Pointer to a struct ttm_lock : Interruptible sleeping while waiting for a lock.

Takes the lock in read mode. Returns: -ERESTARTSYS If interrupted by a signal and interruptible is true.

Definition at line 83 of file ttm_lock.c.

int ttm_read_trylock ( struct ttm_lock lock,
bool  interruptible 
)

ttm_read_trylock

: Pointer to a struct ttm_lock : Interruptible sleeping while waiting for a lock.

Tries to take the lock in read mode. If the lock is already held in write mode, the function will return -EBUSY. If the lock is held in vt or suspend mode, the function will sleep until these modes are unlocked.

Returns: -EBUSY The lock was already held in write mode. -ERESTARTSYS If interrupted by a signal and interruptible is true.

Definition at line 120 of file ttm_lock.c.

void ttm_read_unlock ( struct ttm_lock lock)

ttm_read_unlock

: Pointer to a struct ttm_lock

Releases a read lock.

Definition at line 56 of file ttm_lock.c.

void ttm_suspend_lock ( struct ttm_lock lock)

ttm_suspend_lock

: Pointer to a struct ttm_lock

Takes the lock in suspend mode. Excludes read and write mode.

Definition at line 306 of file ttm_lock.c.

void ttm_suspend_unlock ( struct ttm_lock lock)

ttm_suspend_unlock

: Pointer to a struct ttm_lock

Releases a suspend lock

Definition at line 281 of file ttm_lock.c.

int ttm_vt_lock ( struct ttm_lock lock,
bool  interruptible,
struct ttm_object_file tfile 
)

ttm_vt_lock

: Pointer to a struct ttm_lock : Interruptible sleeping while waiting for a lock. : Pointer to a struct ttm_object_file to register the lock with.

Takes the lock in vt mode. Returns: -ERESTARTSYS If interrupted by a signal and interruptible is true. -ENOMEM: Out of memory when locking.

Definition at line 238 of file ttm_lock.c.

int ttm_vt_unlock ( struct ttm_lock lock)

ttm_vt_unlock

: Pointer to a struct ttm_lock

Releases a vt lock. Returns: -EINVAL If the lock was not held.

Definition at line 274 of file ttm_lock.c.

int ttm_write_lock ( struct ttm_lock lock,
bool  interruptible 
)

ttm_write_lock

: Pointer to a struct ttm_lock : Interruptible sleeping while waiting for a lock.

Takes the lock in write mode. Returns: -ERESTARTSYS If interrupted by a signal and interruptible is true.

Definition at line 169 of file ttm_lock.c.

void ttm_write_lock_downgrade ( struct ttm_lock lock)

Definition at line 189 of file ttm_lock.c.

void ttm_write_unlock ( struct ttm_lock lock)

ttm_write_unlock

: Pointer to a struct ttm_lock

Releases a write lock.

Definition at line 139 of file ttm_lock.c.