Skip to content

Commit

Permalink
drm: remove a bunch of typedefs on the userspace interface
Browse files Browse the repository at this point in the history
This moves a bunch of typedefs into a !defined __KERNEL__ to keep userspace
API compatiblity, it changes all internal usages to structs/enum/unions.

Signed-off-by: Dave Airlie <airlied@linux.ie>
  • Loading branch information
Dave Airlie committed Jul 11, 2007
1 parent c6c656b commit c60ce62
Show file tree
Hide file tree
Showing 25 changed files with 367 additions and 320 deletions.
329 changes: 187 additions & 142 deletions drivers/char/drm/drm.h

Large diffs are not rendered by default.

45 changes: 23 additions & 22 deletions drivers/char/drm/drmP.h
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ typedef struct drm_queue {
atomic_t total_flushed; /**< Total flushes statistic */
atomic_t total_locks; /**< Total locks statistics */
#endif
drm_ctx_flags_t flags; /**< Context preserving and 2D-only */
enum drm_ctx_flags flags; /**< Context preserving and 2D-only */
drm_waitlist_t waitlist; /**< Pending buffers */
wait_queue_head_t flush_queue; /**< Processes waiting until flush */
} drm_queue_t;
Expand All @@ -404,7 +404,7 @@ typedef struct drm_queue {
* Lock data.
*/
typedef struct drm_lock_data {
drm_hw_lock_t *hw_lock; /**< Hardware lock */
struct drm_hw_lock *hw_lock; /**< Hardware lock */
struct file *filp; /**< File descr of lock holder (0=kernel) */
wait_queue_head_t lock_queue; /**< Queue of blocked processes */
unsigned long lock_time; /**< Time of last lock in jiffies */
Expand Down Expand Up @@ -477,7 +477,7 @@ typedef struct drm_sg_mem {

typedef struct drm_sigdata {
int context;
drm_hw_lock_t *lock;
struct drm_hw_lock *lock;
} drm_sigdata_t;

/**
Expand All @@ -486,11 +486,11 @@ typedef struct drm_sigdata {
typedef struct drm_map_list {
struct list_head head; /**< list head */
drm_hash_item_t hash;
drm_map_t *map; /**< mapping */
struct drm_map *map; /**< mapping */
unsigned int user_token;
} drm_map_list_t;

typedef drm_map_t drm_local_map_t;
typedef struct drm_map drm_local_map_t;

/**
* Context handle list
Expand Down Expand Up @@ -594,9 +594,10 @@ struct drm_driver {
struct file *filp);
void (*reclaim_buffers_idlelocked) (struct drm_device *dev,
struct file * filp);
unsigned long (*get_map_ofs) (drm_map_t * map);
unsigned long (*get_map_ofs) (struct drm_map * map);
unsigned long (*get_reg_ofs) (struct drm_device * dev);
void (*set_version) (struct drm_device * dev, drm_set_version_t * sv);
void (*set_version) (struct drm_device * dev,
struct drm_set_version *sv);

int major;
int minor;
Expand Down Expand Up @@ -656,7 +657,7 @@ typedef struct drm_device {
/** \name Performance counters */
/*@{ */
unsigned long counters;
drm_stat_type_t types[15];
enum drm_stat_type types[15];
atomic_t counts[15];
/*@} */

Expand All @@ -679,7 +680,7 @@ typedef struct drm_device {
int ctx_count; /**< Number of context handles */
struct mutex ctxlist_mutex; /**< For ctxlist */

drm_map_t **context_sareas; /**< per-context SAREA's */
struct drm_map **context_sareas; /**< per-context SAREA's */
int max_context;

struct list_head vmalist; /**< List of vmas (for debugging) */
Expand Down Expand Up @@ -756,7 +757,7 @@ typedef struct drm_device {
unsigned int drw_bitfield_length;
u32 *drw_bitfield;
unsigned int drw_info_length;
drm_drawable_info_t **drw_info;
struct drm_drawable_info **drw_info;
/*@} */
} drm_device_t;

Expand Down Expand Up @@ -904,7 +905,7 @@ extern int drm_rmdraw(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_update_drawable_info(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern drm_drawable_info_t *drm_get_drawable_info(drm_device_t *dev,
extern struct drm_drawable_info *drm_get_drawable_info(drm_device_t *dev,
drm_drawable_t id);

/* Authentication IOCTL support (drm_auth.h) */
Expand Down Expand Up @@ -932,11 +933,11 @@ extern int drm_i_have_hw_lock(struct file *filp);
extern int drm_kernel_take_hw_lock(struct file *filp);

/* Buffer management support (drm_bufs.h) */
extern int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request);
extern int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request);
extern int drm_addbufs_agp(drm_device_t * dev, struct drm_buf_desc * request);
extern int drm_addbufs_pci(drm_device_t * dev, struct drm_buf_desc * request);
extern int drm_addmap(drm_device_t * dev, unsigned int offset,
unsigned int size, drm_map_type_t type,
drm_map_flags_t flags, drm_local_map_t ** map_ptr);
unsigned int size, enum drm_map_type type,
enum drm_map_flags flags, drm_local_map_t ** map_ptr);
extern int drm_addmap_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_rmmap(drm_device_t * dev, drm_local_map_t * map);
Expand Down Expand Up @@ -989,22 +990,22 @@ extern int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
extern int drm_agp_release(drm_device_t * dev);
extern int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode);
extern int drm_agp_enable(drm_device_t * dev, struct drm_agp_mode mode);
extern int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info);
extern int drm_agp_info(drm_device_t * dev, struct drm_agp_info * info);
extern int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request);
extern int drm_agp_alloc(drm_device_t *dev, struct drm_agp_buffer *request);
extern int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request);
extern int drm_agp_free(drm_device_t *dev, struct drm_agp_buffer *request);
extern int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request);
extern int drm_agp_unbind(drm_device_t *dev, struct drm_agp_binding *request);
extern int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request);
extern int drm_agp_bind(drm_device_t *dev, struct drm_agp_binding *request);
extern int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
extern DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge,
Expand Down Expand Up @@ -1137,7 +1138,7 @@ extern void *drm_calloc(size_t nmemb, size_t size, int area);

/*@}*/

extern unsigned long drm_core_get_map_ofs(drm_map_t * map);
extern unsigned long drm_core_get_map_ofs(struct drm_map * map);
extern unsigned long drm_core_get_reg_ofs(struct drm_device *dev);

#endif /* __KERNEL__ */
Expand Down
36 changes: 18 additions & 18 deletions drivers/char/drm/drm_agpsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
* Verifies the AGP device has been initialized and acquired and fills in the
* drm_agp_info structure with the information in drm_agp_head::agp_info.
*/
int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info)
int drm_agp_info(drm_device_t * dev, struct drm_agp_info * info)
{
DRM_AGP_KERN *kern;

Expand Down Expand Up @@ -76,14 +76,14 @@ int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_info_t info;
struct drm_agp_info info;
int err;

err = drm_agp_info(dev, &info);
if (err)
return err;

if (copy_to_user((drm_agp_info_t __user *) arg, &info, sizeof(info)))
if (copy_to_user((struct drm_agp_info __user *) arg, &info, sizeof(info)))
return -EFAULT;
return 0;
}
Expand Down Expand Up @@ -168,7 +168,7 @@ int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
* Verifies the AGP device has been acquired but not enabled, and calls
* \c agp_enable.
*/
int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode)
int drm_agp_enable(drm_device_t * dev, struct drm_agp_mode mode)
{
if (!dev->agp || !dev->agp->acquired)
return -EINVAL;
Expand All @@ -187,9 +187,9 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_mode_t mode;
struct drm_agp_mode mode;

if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode)))
if (copy_from_user(&mode, (struct drm_agp_mode __user *) arg, sizeof(mode)))
return -EFAULT;

return drm_agp_enable(dev, mode);
Expand All @@ -207,7 +207,7 @@ int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
* Verifies the AGP device is present and has been acquired, allocates the
* memory via alloc_agp() and creates a drm_agp_mem entry for it.
*/
int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
int drm_agp_alloc(drm_device_t *dev, struct drm_agp_buffer *request)
{
drm_agp_mem_t *entry;
DRM_AGP_MEM *memory;
Expand Down Expand Up @@ -246,8 +246,8 @@ int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_buffer_t request;
drm_agp_buffer_t __user *argp = (void __user *)arg;
struct drm_agp_buffer request;
struct drm_agp_buffer __user *argp = (void __user *)arg;
int err;

if (copy_from_user(&request, argp, sizeof(request)))
Expand Down Expand Up @@ -305,7 +305,7 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev,
* Verifies the AGP device is present and acquired, looks-up the AGP memory
* entry and passes it to the unbind_agp() function.
*/
int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request)
int drm_agp_unbind(drm_device_t *dev, struct drm_agp_binding *request)
{
drm_agp_mem_t *entry;
int ret;
Expand All @@ -328,10 +328,10 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_binding_t request;
struct drm_agp_binding request;

if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
(&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT;

return drm_agp_unbind(dev, &request);
Expand All @@ -350,7 +350,7 @@ int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
* is currently bound into the GATT. Looks-up the AGP memory entry and passes
* it to bind_agp() function.
*/
int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request)
int drm_agp_bind(drm_device_t *dev, struct drm_agp_binding *request)
{
drm_agp_mem_t *entry;
int retcode;
Expand All @@ -377,10 +377,10 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_binding_t request;
struct drm_agp_binding request;

if (copy_from_user
(&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
(&request, (struct drm_agp_binding __user *) arg, sizeof(request)))
return -EFAULT;

return drm_agp_bind(dev, &request);
Expand All @@ -400,7 +400,7 @@ int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
* unbind_agp(). Frees it via free_agp() as well as the entry itself
* and unlinks from the doubly linked list it's inserted in.
*/
int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
int drm_agp_free(drm_device_t *dev, struct drm_agp_buffer *request)
{
drm_agp_mem_t *entry;

Expand All @@ -424,10 +424,10 @@ int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_agp_buffer_t request;
struct drm_agp_buffer request;

if (copy_from_user
(&request, (drm_agp_buffer_t __user *) arg, sizeof(request)))
(&request, (struct drm_agp_buffer __user *) arg, sizeof(request)))
return -EFAULT;

return drm_agp_free(dev, &request);
Expand Down
8 changes: 4 additions & 4 deletions drivers/char/drm/drm_auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
static DEFINE_SPINLOCK(lock);
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_auth_t auth;
struct drm_auth auth;

/* Find unique magic */
if (priv->magic) {
Expand All @@ -162,7 +162,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
}

DRM_DEBUG("%u\n", auth.magic);
if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth)))
if (copy_to_user((struct drm_auth __user *) arg, &auth, sizeof(auth)))
return -EFAULT;
return 0;
}
Expand All @@ -183,10 +183,10 @@ int drm_authmagic(struct inode *inode, struct file *filp,
{
drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->head->dev;
drm_auth_t auth;
struct drm_auth auth;
drm_file_t *file;

if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth)))
if (copy_from_user(&auth, (struct drm_auth __user *) arg, sizeof(auth)))
return -EFAULT;
DRM_DEBUG("%u\n", auth.magic);
if ((file = drm_find_file(dev, auth.magic))) {
Expand Down
Loading

0 comments on commit c60ce62

Please sign in to comment.