Commit 6b930915 authored by Dave Airlie's avatar Dave Airlie

Merge starflyer.(none):/foo/airlied/bitkeeper/drm-heads

into starflyer.(none):/foo/airlied/bitkeeper/drm-linus
parents 60ff5191 dfb01d37
...@@ -422,7 +422,7 @@ typedef struct drm_file { ...@@ -422,7 +422,7 @@ typedef struct drm_file {
unsigned long ioctl_count; unsigned long ioctl_count;
struct drm_file *next; struct drm_file *next;
struct drm_file *prev; struct drm_file *prev;
struct drm_device *dev; struct drm_head *head;
int remove_auth_on_close; int remove_auth_on_close;
unsigned long lock_count; unsigned long lock_count;
void *driver_priv; void *driver_priv;
...@@ -593,19 +593,31 @@ struct drm_driver { ...@@ -593,19 +593,31 @@ struct drm_driver {
struct file_operations fops; struct file_operations fops;
struct pci_driver pci_driver; struct pci_driver pci_driver;
}; };
/** /**
* DRM device structure. * DRM head structure. This structure represent a video head on a card
* that may contain multiple heads. Embed one per head of these in the
* private drm_device structure.
*/
typedef struct drm_head {
int minor; /**< Minor device number */
struct drm_device *dev;
struct proc_dir_entry *dev_root; /**< proc directory entry */
dev_t device; /**< Device number for mknod */
struct class_device *dev_class;
} drm_head_t;
/**
* DRM device structure. This structure represent a complete card that
* may contain multiple heads.
*/ */
typedef struct drm_device { typedef struct drm_device {
char *unique; /**< Unique identifier: e.g., busid */ char *unique; /**< Unique identifier: e.g., busid */
int unique_len; /**< Length of unique field */ int unique_len; /**< Length of unique field */
dev_t device; /**< Device number for mknod */
char *devname; /**< For /proc/interrupts */ char *devname; /**< For /proc/interrupts */
int minor; /**< Minor device number */
int if_version; /**< Highest interface version set */ int if_version; /**< Highest interface version set */
int blocked; /**< Blocked due to VC switch? */ int blocked; /**< Blocked due to VC switch? */
struct proc_dir_entry *root; /**< Root for this device's entries */
/** \name Locks */ /** \name Locks */
/*@{*/ /*@{*/
...@@ -721,17 +733,9 @@ typedef struct drm_device { ...@@ -721,17 +733,9 @@ typedef struct drm_device {
struct drm_driver *driver; struct drm_driver *driver;
drm_local_map_t *agp_buffer_map; drm_local_map_t *agp_buffer_map;
drm_head_t primary; /**< primary screen head */
} drm_device_t; } drm_device_t;
typedef struct drm_minor {
enum {
DRM_MINOR_FREE = 0,
DRM_MINOR_PRIMARY,
} type;
drm_device_t *dev;
struct proc_dir_entry *dev_root; /**< proc directory entry */
} drm_minor_t;
static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature) static __inline__ int drm_core_check_feature(struct drm_device *dev, int feature)
{ {
return ((dev->driver->driver_features & feature) ? 1 : 0); return ((dev->driver->driver_features & feature) ? 1 : 0);
...@@ -955,12 +959,14 @@ extern int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start); ...@@ -955,12 +959,14 @@ extern int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start);
extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle); extern int drm_agp_unbind_memory(DRM_AGP_MEM *handle);
/* Stub support (drm_stub.h) */ /* Stub support (drm_stub.h) */
extern int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver); extern int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver);
extern int drm_put_minor(drm_device_t *dev); extern int drm_put_dev(drm_device_t * dev);
extern int drm_get_head(drm_device_t * dev, drm_head_t *head);
extern int drm_put_head(drm_head_t * head);
extern unsigned int drm_debug; extern unsigned int drm_debug;
extern unsigned int drm_cards_limit; extern unsigned int drm_cards_limit;
extern drm_minor_t *drm_minors; extern drm_head_t **drm_heads;
extern struct drm_sysfs_class *drm_class; extern struct drm_sysfs_class *drm_class;
extern struct proc_dir_entry *drm_proc_root; extern struct proc_dir_entry *drm_proc_root;
......
...@@ -52,7 +52,7 @@ int drm_agp_info(struct inode *inode, struct file *filp, ...@@ -52,7 +52,7 @@ int drm_agp_info(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
DRM_AGP_KERN *kern; DRM_AGP_KERN *kern;
drm_agp_info_t info; drm_agp_info_t info;
...@@ -91,7 +91,7 @@ int drm_agp_acquire(struct inode *inode, struct file *filp, ...@@ -91,7 +91,7 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
if (!dev->agp) if (!dev->agp)
return -ENODEV; return -ENODEV;
...@@ -118,7 +118,7 @@ int drm_agp_release(struct inode *inode, struct file *filp, ...@@ -118,7 +118,7 @@ int drm_agp_release(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
return -EINVAL; return -EINVAL;
...@@ -154,7 +154,7 @@ int drm_agp_enable(struct inode *inode, struct file *filp, ...@@ -154,7 +154,7 @@ int drm_agp_enable(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_agp_mode_t mode; drm_agp_mode_t mode;
if (!dev->agp || !dev->agp->acquired) if (!dev->agp || !dev->agp->acquired)
...@@ -186,7 +186,7 @@ int drm_agp_alloc(struct inode *inode, struct file *filp, ...@@ -186,7 +186,7 @@ int drm_agp_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_agp_buffer_t request; drm_agp_buffer_t request;
drm_agp_mem_t *entry; drm_agp_mem_t *entry;
DRM_AGP_MEM *memory; DRM_AGP_MEM *memory;
...@@ -271,7 +271,7 @@ int drm_agp_unbind(struct inode *inode, struct file *filp, ...@@ -271,7 +271,7 @@ int drm_agp_unbind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_agp_binding_t request; drm_agp_binding_t request;
drm_agp_mem_t *entry; drm_agp_mem_t *entry;
int ret; int ret;
...@@ -307,7 +307,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp, ...@@ -307,7 +307,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_agp_binding_t request; drm_agp_binding_t request;
drm_agp_mem_t *entry; drm_agp_mem_t *entry;
int retcode; int retcode;
...@@ -348,7 +348,7 @@ int drm_agp_free(struct inode *inode, struct file *filp, ...@@ -348,7 +348,7 @@ int drm_agp_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_agp_buffer_t request; drm_agp_buffer_t request;
drm_agp_mem_t *entry; drm_agp_mem_t *entry;
......
...@@ -176,7 +176,7 @@ int drm_getmagic(struct inode *inode, struct file *filp, ...@@ -176,7 +176,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
static drm_magic_t sequence = 0; static drm_magic_t sequence = 0;
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_auth_t auth; drm_auth_t auth;
/* Find unique magic */ /* Find unique magic */
...@@ -214,7 +214,7 @@ int drm_authmagic(struct inode *inode, struct file *filp, ...@@ -214,7 +214,7 @@ int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_auth_t auth; drm_auth_t auth;
drm_file_t *file; drm_file_t *file;
......
...@@ -77,7 +77,7 @@ int drm_addmap( struct inode *inode, struct file *filp, ...@@ -77,7 +77,7 @@ int drm_addmap( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_map_t *map; drm_map_t *map;
drm_map_t __user *argp = (void __user *)arg; drm_map_t __user *argp = (void __user *)arg;
drm_map_list_t *list; drm_map_list_t *list;
...@@ -221,7 +221,7 @@ int drm_rmmap(struct inode *inode, struct file *filp, ...@@ -221,7 +221,7 @@ int drm_rmmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
struct list_head *list; struct list_head *list;
drm_map_list_t *r_list = NULL; drm_map_list_t *r_list = NULL;
drm_vma_entry_t *pt, *prev; drm_vma_entry_t *pt, *prev;
...@@ -349,7 +349,7 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp, ...@@ -349,7 +349,7 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_desc_t request; drm_buf_desc_t request;
drm_buf_entry_t *entry; drm_buf_entry_t *entry;
...@@ -514,7 +514,7 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp, ...@@ -514,7 +514,7 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_desc_t request; drm_buf_desc_t request;
int count; int count;
...@@ -744,7 +744,7 @@ int drm_addbufs_sg( struct inode *inode, struct file *filp, ...@@ -744,7 +744,7 @@ int drm_addbufs_sg( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_desc_t __user *argp = (void __user *)arg; drm_buf_desc_t __user *argp = (void __user *)arg;
drm_buf_desc_t request; drm_buf_desc_t request;
...@@ -925,7 +925,7 @@ int drm_addbufs( struct inode *inode, struct file *filp, ...@@ -925,7 +925,7 @@ int drm_addbufs( struct inode *inode, struct file *filp,
{ {
drm_buf_desc_t request; drm_buf_desc_t request;
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA)) if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
return -EINVAL; return -EINVAL;
...@@ -967,7 +967,7 @@ int drm_infobufs( struct inode *inode, struct file *filp, ...@@ -967,7 +967,7 @@ int drm_infobufs( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_info_t request; drm_buf_info_t request;
drm_buf_info_t __user *argp = (void __user *)arg; drm_buf_info_t __user *argp = (void __user *)arg;
...@@ -1052,7 +1052,7 @@ int drm_markbufs( struct inode *inode, struct file *filp, ...@@ -1052,7 +1052,7 @@ int drm_markbufs( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_desc_t request; drm_buf_desc_t request;
int order; int order;
...@@ -1101,7 +1101,7 @@ int drm_freebufs( struct inode *inode, struct file *filp, ...@@ -1101,7 +1101,7 @@ int drm_freebufs( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_free_t request; drm_buf_free_t request;
int i; int i;
...@@ -1158,7 +1158,7 @@ int drm_mapbufs( struct inode *inode, struct file *filp, ...@@ -1158,7 +1158,7 @@ int drm_mapbufs( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_buf_map_t __user *argp = (void __user *)arg; drm_buf_map_t __user *argp = (void __user *)arg;
int retcode = 0; int retcode = 0;
......
...@@ -208,7 +208,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp, ...@@ -208,7 +208,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_priv_map_t __user *argp = (void __user *)arg; drm_ctx_priv_map_t __user *argp = (void __user *)arg;
drm_ctx_priv_map_t request; drm_ctx_priv_map_t request;
drm_map_t *map; drm_map_t *map;
...@@ -247,7 +247,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp, ...@@ -247,7 +247,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_priv_map_t request; drm_ctx_priv_map_t request;
drm_map_t *map = NULL; drm_map_t *map = NULL;
drm_map_list_t *r_list = NULL; drm_map_list_t *r_list = NULL;
...@@ -395,7 +395,7 @@ int drm_addctx( struct inode *inode, struct file *filp, ...@@ -395,7 +395,7 @@ int drm_addctx( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_list_t * ctx_entry; drm_ctx_list_t * ctx_entry;
drm_ctx_t __user *argp = (void __user *)arg; drm_ctx_t __user *argp = (void __user *)arg;
drm_ctx_t ctx; drm_ctx_t ctx;
...@@ -489,7 +489,7 @@ int drm_switchctx( struct inode *inode, struct file *filp, ...@@ -489,7 +489,7 @@ int drm_switchctx( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx; drm_ctx_t ctx;
if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
...@@ -514,7 +514,7 @@ int drm_newctx( struct inode *inode, struct file *filp, ...@@ -514,7 +514,7 @@ int drm_newctx( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx; drm_ctx_t ctx;
if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
...@@ -541,7 +541,7 @@ int drm_rmctx( struct inode *inode, struct file *filp, ...@@ -541,7 +541,7 @@ int drm_rmctx( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx; drm_ctx_t ctx;
if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) ) if ( copy_from_user( &ctx, (drm_ctx_t __user *)arg, sizeof(ctx) ) )
......
...@@ -149,18 +149,6 @@ int drm_takedown( drm_device_t *dev ) ...@@ -149,18 +149,6 @@ int drm_takedown( drm_device_t *dev )
down( &dev->struct_sem ); down( &dev->struct_sem );
del_timer( &dev->timer ); del_timer( &dev->timer );
if ( dev->devname ) {
drm_free( dev->devname, strlen( dev->devname ) + 1,
DRM_MEM_DRIVER );
dev->devname = NULL;
}
if ( dev->unique ) {
drm_free( dev->unique, strlen( dev->unique ) + 1,
DRM_MEM_DRIVER );
dev->unique = NULL;
dev->unique_len = 0;
}
/* Clear pid list */ /* Clear pid list */
for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
for ( pt = dev->magiclist[i].head ; pt ; pt = next ) { for ( pt = dev->magiclist[i].head ; pt ; pt = next ) {
...@@ -307,7 +295,7 @@ int drm_init( struct drm_driver *driver ) ...@@ -307,7 +295,7 @@ int drm_init( struct drm_driver *driver )
while ((pdev = pci_get_subsys(pid->vendor, pid->device, pid->subvendor, pid->subdevice, pdev)) != NULL) { while ((pdev = pci_get_subsys(pid->vendor, pid->device, pid->subvendor, pid->subdevice, pdev)) != NULL) {
/* stealth mode requires a manual probe */ /* stealth mode requires a manual probe */
pci_dev_get(pdev); pci_dev_get(pdev);
drm_probe(pdev, pid, driver); drm_get_dev(pdev, pid, driver);
} }
} }
return 0; return 0;
...@@ -351,7 +339,8 @@ static void drm_cleanup( drm_device_t *dev ) ...@@ -351,7 +339,8 @@ static void drm_cleanup( drm_device_t *dev )
if (dev->driver->postcleanup) if (dev->driver->postcleanup)
dev->driver->postcleanup(dev); dev->driver->postcleanup(dev);
if ( drm_put_minor(dev) ) drm_put_head(&dev->primary);
if ( drm_put_dev(dev) )
DRM_ERROR( "Cannot unload module\n" ); DRM_ERROR( "Cannot unload module\n" );
} }
...@@ -359,19 +348,19 @@ void drm_exit (struct drm_driver *driver) ...@@ -359,19 +348,19 @@ void drm_exit (struct drm_driver *driver)
{ {
int i; int i;
drm_device_t *dev = NULL; drm_device_t *dev = NULL;
drm_minor_t *minor; drm_head_t *head;
DRM_DEBUG( "\n" ); DRM_DEBUG( "\n" );
for (i = 0; i < drm_cards_limit; i++) { for (i = 0; i < drm_cards_limit; i++) {
minor = &drm_minors[i]; head = drm_heads[i];
if (!minor->dev) if (!head)
continue; continue;
if (minor->dev->driver!=driver) if (!head->dev)
continue; continue;
if (head->dev->driver!=driver)
dev = minor->dev; continue;
dev=head->dev;
} }
if (dev) { if (dev) {
/* release the pci driver */ /* release the pci driver */
...@@ -379,7 +368,6 @@ void drm_exit (struct drm_driver *driver) ...@@ -379,7 +368,6 @@ void drm_exit (struct drm_driver *driver)
pci_dev_put(dev->pdev); pci_dev_put(dev->pdev);
drm_cleanup(dev); drm_cleanup(dev);
} }
DRM_INFO( "Module unloaded\n" ); DRM_INFO( "Module unloaded\n" );
} }
EXPORT_SYMBOL(drm_exit); EXPORT_SYMBOL(drm_exit);
...@@ -395,9 +383,9 @@ static int __init drm_core_init(void) ...@@ -395,9 +383,9 @@ static int __init drm_core_init(void)
int ret = -ENOMEM; int ret = -ENOMEM;
drm_cards_limit = (drm_cards_limit < DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1); drm_cards_limit = (drm_cards_limit < DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1);
drm_minors = drm_calloc(drm_cards_limit, drm_heads = drm_calloc(drm_cards_limit,
sizeof(*drm_minors), DRM_MEM_STUB); sizeof(*drm_heads), DRM_MEM_STUB);
if(!drm_minors) if(!drm_heads)
goto err_p1; goto err_p1;
if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops)) if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
...@@ -429,7 +417,7 @@ static int __init drm_core_init(void) ...@@ -429,7 +417,7 @@ static int __init drm_core_init(void)
drm_sysfs_destroy(drm_class); drm_sysfs_destroy(drm_class);
err_p2: err_p2:
unregister_chrdev(DRM_MAJOR, "drm"); unregister_chrdev(DRM_MAJOR, "drm");
drm_free(drm_minors, sizeof(*drm_minors) * drm_cards_limit, DRM_MEM_STUB); drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
err_p1: err_p1:
return ret; return ret;
} }
...@@ -441,7 +429,7 @@ static void __exit drm_core_exit (void) ...@@ -441,7 +429,7 @@ static void __exit drm_core_exit (void)
unregister_chrdev(DRM_MAJOR, "drm"); unregister_chrdev(DRM_MAJOR, "drm");
drm_free(drm_minors, sizeof(*drm_minors) * drm_free(drm_heads, sizeof(*drm_heads) *
drm_cards_limit, DRM_MEM_STUB); drm_cards_limit, DRM_MEM_STUB);
} }
...@@ -465,7 +453,7 @@ int drm_version( struct inode *inode, struct file *filp, ...@@ -465,7 +453,7 @@ int drm_version( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_version_t __user *argp = (void __user *)arg; drm_version_t __user *argp = (void __user *)arg;
drm_version_t version; drm_version_t version;
int ret; int ret;
...@@ -500,7 +488,7 @@ int drm_ioctl( struct inode *inode, struct file *filp, ...@@ -500,7 +488,7 @@ int drm_ioctl( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_ioctl_desc_t *ioctl; drm_ioctl_desc_t *ioctl;
drm_ioctl_t *func; drm_ioctl_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd); unsigned int nr = DRM_IOCTL_NR(cmd);
...@@ -511,7 +499,7 @@ int drm_ioctl( struct inode *inode, struct file *filp, ...@@ -511,7 +499,7 @@ int drm_ioctl( struct inode *inode, struct file *filp,
++priv->ioctl_count; ++priv->ioctl_count;
DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n", DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
current->pid, cmd, nr, (long)old_encode_dev(dev->device), current->pid, cmd, nr, (long)old_encode_dev(priv->head->device),
priv->authenticated ); priv->authenticated );
if (nr < DRIVER_IOCTL_COUNT) if (nr < DRIVER_IOCTL_COUNT)
......
...@@ -143,8 +143,10 @@ int drm_open( struct inode *inode, struct file *filp ) ...@@ -143,8 +143,10 @@ int drm_open( struct inode *inode, struct file *filp )
if (!((minor >= 0) && (minor < drm_cards_limit))) if (!((minor >= 0) && (minor < drm_cards_limit)))
return -ENODEV; return -ENODEV;
dev = drm_minors[minor].dev; if (!drm_heads[minor])
if (!dev) return -ENODEV;
if (!(dev = drm_heads[minor]->dev))
return -ENODEV; return -ENODEV;
retcode = drm_open_helper( inode, filp, dev ); retcode = drm_open_helper( inode, filp, dev );
...@@ -181,7 +183,7 @@ int drm_release( struct inode *inode, struct file *filp ) ...@@ -181,7 +183,7 @@ int drm_release( struct inode *inode, struct file *filp )
int retcode = 0; int retcode = 0;
lock_kernel(); lock_kernel();
dev = priv->dev; dev = priv->head->dev;
DRM_DEBUG( "open_count = %d\n", dev->open_count ); DRM_DEBUG( "open_count = %d\n", dev->open_count );
...@@ -193,7 +195,7 @@ int drm_release( struct inode *inode, struct file *filp ) ...@@ -193,7 +195,7 @@ int drm_release( struct inode *inode, struct file *filp )
*/ */
DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n", DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
current->pid, (long)old_encode_dev(dev->device), dev->open_count ); current->pid, (long)old_encode_dev(priv->head->device), dev->open_count );
if ( priv->lock_count && dev->lock.hw_lock && if ( priv->lock_count && dev->lock.hw_lock &&
_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
...@@ -358,7 +360,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) ...@@ -358,7 +360,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
priv->uid = current->euid; priv->uid = current->euid;
priv->pid = current->pid; priv->pid = current->pid;
priv->minor = minor; priv->minor = minor;
priv->dev = dev; priv->head = drm_heads[minor];
priv->ioctl_count = 0; priv->ioctl_count = 0;
priv->authenticated = capable(CAP_SYS_ADMIN); priv->authenticated = capable(CAP_SYS_ADMIN);
priv->lock_count = 0; priv->lock_count = 0;
...@@ -412,10 +414,10 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) ...@@ -412,10 +414,10 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
int drm_flush(struct file *filp) int drm_flush(struct file *filp)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n", DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
current->pid, (long)old_encode_dev(dev->device), dev->open_count); current->pid, (long)old_encode_dev(priv->head->device), dev->open_count);
return 0; return 0;
} }
EXPORT_SYMBOL(drm_flush); EXPORT_SYMBOL(drm_flush);
...@@ -424,10 +426,10 @@ EXPORT_SYMBOL(drm_flush); ...@@ -424,10 +426,10 @@ EXPORT_SYMBOL(drm_flush);
int drm_fasync(int fd, struct file *filp, int on) int drm_fasync(int fd, struct file *filp, int on)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
int retcode; int retcode;
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(dev->device)); DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->head->device));
retcode = fasync_helper(fd, filp, on, &dev->buf_async); retcode = fasync_helper(fd, filp, on, &dev->buf_async);
if (retcode < 0) return retcode; if (retcode < 0) return retcode;
return 0; return 0;
......
...@@ -53,7 +53,7 @@ int drm_getunique(struct inode *inode, struct file *filp, ...@@ -53,7 +53,7 @@ int drm_getunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_unique_t __user *argp = (void __user *)arg; drm_unique_t __user *argp = (void __user *)arg;
drm_unique_t u; drm_unique_t u;
...@@ -87,7 +87,7 @@ int drm_setunique(struct inode *inode, struct file *filp, ...@@ -87,7 +87,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_unique_t u; drm_unique_t u;
int domain, bus, slot, func, ret; int domain, bus, slot, func, ret;
...@@ -173,7 +173,7 @@ int drm_getmap( struct inode *inode, struct file *filp, ...@@ -173,7 +173,7 @@ int drm_getmap( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_map_t __user *argp = (void __user *)arg; drm_map_t __user *argp = (void __user *)arg;
drm_map_t map; drm_map_t map;
drm_map_list_t *r_list = NULL; drm_map_list_t *r_list = NULL;
...@@ -233,7 +233,7 @@ int drm_getclient( struct inode *inode, struct file *filp, ...@@ -233,7 +233,7 @@ int drm_getclient( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_client_t __user *argp = (void __user *)arg; drm_client_t __user *argp = (void __user *)arg;
drm_client_t client; drm_client_t client;
drm_file_t *pt; drm_file_t *pt;
...@@ -277,7 +277,7 @@ int drm_getstats( struct inode *inode, struct file *filp, ...@@ -277,7 +277,7 @@ int drm_getstats( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_stats_t stats; drm_stats_t stats;
int i; int i;
......
...@@ -54,7 +54,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp, ...@@ -54,7 +54,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_irq_busid_t __user *argp = (void __user *)arg; drm_irq_busid_t __user *argp = (void __user *)arg;
drm_irq_busid_t p; drm_irq_busid_t p;
...@@ -196,7 +196,7 @@ int drm_control( struct inode *inode, struct file *filp, ...@@ -196,7 +196,7 @@ int drm_control( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_control_t ctl; drm_control_t ctl;
/* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */ /* if we haven't irq we fallback for compatibility reasons - this used to be a separate function in drm_dma.h */
...@@ -243,7 +243,7 @@ int drm_control( struct inode *inode, struct file *filp, ...@@ -243,7 +243,7 @@ int drm_control( struct inode *inode, struct file *filp,
int drm_wait_vblank( DRM_IOCTL_ARGS ) int drm_wait_vblank( DRM_IOCTL_ARGS )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_wait_vblank_t __user *argp = (void __user *)data; drm_wait_vblank_t __user *argp = (void __user *)data;
drm_wait_vblank_t vblwait; drm_wait_vblank_t vblwait;
struct timeval now; struct timeval now;
......
...@@ -50,7 +50,7 @@ int drm_lock( struct inode *inode, struct file *filp, ...@@ -50,7 +50,7 @@ int drm_lock( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
DECLARE_WAITQUEUE( entry, current ); DECLARE_WAITQUEUE( entry, current );
drm_lock_t lock; drm_lock_t lock;
int ret = 0; int ret = 0;
...@@ -145,7 +145,7 @@ int drm_unlock( struct inode *inode, struct file *filp, ...@@ -145,7 +145,7 @@ int drm_unlock( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_lock_t lock; drm_lock_t lock;
if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) ) if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) )
......
...@@ -35,7 +35,7 @@ ...@@ -35,7 +35,7 @@
#define DRM_MEMORYBARRIER() mb() #define DRM_MEMORYBARRIER() mb()
/** DRM device local declaration */ /** DRM device local declaration */
#define DRM_DEVICE drm_file_t *priv = filp->private_data; \ #define DRM_DEVICE drm_file_t *priv = filp->private_data; \
drm_device_t *dev = priv->dev drm_device_t *dev = priv->head->dev
/** IRQ handler arguments and return type and values */ /** IRQ handler arguments and return type and values */
#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs #define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
......
...@@ -175,10 +175,10 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request, ...@@ -175,10 +175,10 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
*eof = 0; *eof = 0;
if (dev->unique) { if (dev->unique) {
DRM_PROC_PRINT("%s 0x%lx %s\n", DRM_PROC_PRINT("%s %s %s\n",
dev->driver->pci_driver.name, (long)old_encode_dev(dev->device), dev->unique); dev->driver->pci_driver.name, pci_name(dev->pdev), dev->unique);
} else { } else {
DRM_PROC_PRINT("%s 0x%lx\n", dev->driver->pci_driver.name, (long)old_encode_dev(dev->device)); DRM_PROC_PRINT("%s %s\n", dev->driver->pci_driver.name, pci_name(dev->pdev));
} }
if (len > request + offset) return request; if (len > request + offset) return request;
......
...@@ -65,7 +65,7 @@ int drm_sg_alloc( struct inode *inode, struct file *filp, ...@@ -65,7 +65,7 @@ int drm_sg_alloc( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_scatter_gather_t __user *argp = (void __user *)arg; drm_scatter_gather_t __user *argp = (void __user *)arg;
drm_scatter_gather_t request; drm_scatter_gather_t request;
drm_sg_mem_t *entry; drm_sg_mem_t *entry;
...@@ -205,7 +205,7 @@ int drm_sg_free( struct inode *inode, struct file *filp, ...@@ -205,7 +205,7 @@ int drm_sg_free( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_scatter_gather_t request; drm_scatter_gather_t request;
drm_sg_mem_t *entry; drm_sg_mem_t *entry;
......
...@@ -49,7 +49,7 @@ MODULE_PARM_DESC(drm_debug, "Enable debug output"); ...@@ -49,7 +49,7 @@ MODULE_PARM_DESC(drm_debug, "Enable debug output");
module_param_named(cards_limit, drm_cards_limit, int, 0444); module_param_named(cards_limit, drm_cards_limit, int, 0444);
module_param_named(debug, drm_debug, int, 0666); module_param_named(debug, drm_debug, int, 0666);
drm_minor_t *drm_minors; drm_head_t **drm_heads;
struct drm_sysfs_class *drm_class; struct drm_sysfs_class *drm_class;
struct proc_dir_entry *drm_proc_root; struct proc_dir_entry *drm_proc_root;
...@@ -112,12 +112,6 @@ static int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct ...@@ -112,12 +112,6 @@ static int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct
goto error_out_unreg; goto error_out_unreg;
} }
dev->device = MKDEV(DRM_MAJOR, dev->minor );
/* postinit is a required function to display the signon banner */
if ((retcode = dev->driver->postinit(dev, ent->driver_data)))
goto error_out_unreg;
return 0; return 0;
error_out_unreg: error_out_unreg:
...@@ -146,8 +140,10 @@ int drm_stub_open(struct inode *inode, struct file *filp) ...@@ -146,8 +140,10 @@ int drm_stub_open(struct inode *inode, struct file *filp)
if (!((minor >= 0) && (minor < drm_cards_limit))) if (!((minor >= 0) && (minor < drm_cards_limit)))
return -ENODEV; return -ENODEV;
dev = drm_minors[minor].dev; if (!drm_heads[minor])
if (!dev) return -ENODEV;
if (!(dev = drm_heads[minor]->dev))
return -ENODEV; return -ENODEV;
old_fops = filp->f_op; old_fops = filp->f_op;
...@@ -161,10 +157,11 @@ int drm_stub_open(struct inode *inode, struct file *filp) ...@@ -161,10 +157,11 @@ int drm_stub_open(struct inode *inode, struct file *filp)
return err; return err;
} }
/** /**
* Get a device minor number. * Register.
* *
* \param pdev PCI device structure * \param pdev - PCI device structure
* \param ent entry from the PCI ID table with device type flags * \param ent entry from the PCI ID table with device type flags
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
...@@ -172,49 +169,85 @@ int drm_stub_open(struct inode *inode, struct file *filp) ...@@ -172,49 +169,85 @@ int drm_stub_open(struct inode *inode, struct file *filp)
* then register the character device and inter module information. * then register the character device and inter module information.
* Try and register, if we fail to register, backout previous work. * Try and register, if we fail to register, backout previous work.
*/ */
int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver) int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
struct drm_driver *driver)
{ {
struct class_device *dev_class;
drm_device_t *dev; drm_device_t *dev;
int ret; int ret;
int minor;
drm_minor_t *minors = &drm_minors[0];
DRM_DEBUG("\n"); DRM_DEBUG("\n");
for (minor = 0; minor < drm_cards_limit; minor++, minors++) {
if (minors->type == DRM_MINOR_FREE) {
DRM_DEBUG("assigning minor %d\n", minor);
dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB); dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
if (!dev) if (!dev)
return -ENOMEM; return -ENOMEM;
*minors = (drm_minor_t){.dev = dev, .type=DRM_MINOR_PRIMARY};
dev->minor = minor;
pci_enable_device(pdev); pci_enable_device(pdev);
if ((ret=drm_fill_in_dev(dev, pdev, ent, driver))) { if ((ret = drm_fill_in_dev(dev, pdev, ent, driver))) {
printk(KERN_ERR "DRM: Fill_in_dev failed.\n"); printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
goto err_g1; goto err_g1;
} }
if ((ret = drm_proc_init(dev, minor, drm_proc_root, &minors->dev_root))) { if ((ret = drm_get_head(dev, &dev->primary)))
goto err_g1;
/* postinit is a required function to display the signon banner */
/* drivers add secondary heads here if needed */
if ((ret = dev->driver->postinit(dev, ent->driver_data)))
goto err_g1;
return 0;
err_g1:
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return ret;
}
EXPORT_SYMBOL(drm_get_dev);
/**
* Get a secondary minor number.
*
* \param dev device data structure
* \param sec-minor structure to hold the assigned minor
* \return negative number on failure.
*
* Search an empty entry and initialize it to the given parameters, and
* create the proc init entry via proc_init(). This routines assigns
* minor numbers to secondary heads of multi-headed cards
*/
int drm_get_head(drm_device_t *dev, drm_head_t *head)
{
drm_head_t **heads = drm_heads;
int ret;
int minor;
DRM_DEBUG("\n");
for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
if (!*heads) {
*head = (drm_head_t) {
.dev = dev,
.device = MKDEV(DRM_MAJOR, minor),
.minor = minor,
};
if ((ret = drm_proc_init(dev, minor, drm_proc_root, &head->dev_root))) {
printk (KERN_ERR "DRM: Failed to initialize /proc/dri.\n"); printk (KERN_ERR "DRM: Failed to initialize /proc/dri.\n");
goto err_g1; goto err_g1;
} }
dev_class = drm_sysfs_device_add(drm_class, head->dev_class = drm_sysfs_device_add(drm_class,
MKDEV(DRM_MAJOR, MKDEV(DRM_MAJOR,
minor), minor),
&pdev->dev, &dev->pdev->dev,
"card%d", minor); "card%d", minor);
if (IS_ERR(dev_class)) { if (IS_ERR(head->dev_class)) {
printk(KERN_ERR "DRM: Error sysfs_device_add.\n"); printk(KERN_ERR "DRM: Error sysfs_device_add.\n");
ret = PTR_ERR(dev_class); ret = PTR_ERR(head->dev_class);
goto err_g2; goto err_g2;
} }
*heads = head;
DRM_DEBUG("new minor assigned %d\n", minor); DRM_DEBUG("new minor assigned %d\n", minor);
return 0; return 0;
...@@ -223,36 +256,63 @@ int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_ ...@@ -223,36 +256,63 @@ int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_
DRM_ERROR("out of minors\n"); DRM_ERROR("out of minors\n");
return -ENOMEM; return -ENOMEM;
err_g2: err_g2:
drm_proc_cleanup(minor, drm_proc_root, minors->dev_root); drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
err_g1: err_g1:
*minors = (drm_minor_t){.dev = NULL, .type = DRM_MINOR_FREE}; *head = (drm_head_t) {.dev = NULL};
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return ret; return ret;
} }
EXPORT_SYMBOL(drm_probe);
/** /**
* Put a device minor number. * Put a device minor number.
* *
* \param minor minor number. * \param dev device data structure
* \return always zero. * \return always zero
* *
* Cleans up the proc resources. If a minor is zero then release the foreign * Cleans up the proc resources. If it is the last minor then release the foreign
* "drm" data, otherwise unregisters the "drm" data, frees the stub list and * "drm" data, otherwise unregisters the "drm" data, frees the dev list and
* unregisters the character device. * unregisters the character device.
*/ */
int drm_put_minor(drm_device_t *dev) int drm_put_dev(drm_device_t * dev)
{ {
drm_minor_t *minors = &drm_minors[dev->minor]; DRM_DEBUG("release primary %s\n", dev->driver->pci_driver.name);
DRM_DEBUG("release minor %d\n", dev->minor); if (dev->unique) {
drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER);
dev->unique = NULL;
dev->unique_len = 0;
}
if (dev->devname) {
drm_free(dev->devname, strlen(dev->devname) + 1,
DRM_MEM_DRIVER);
dev->devname = NULL;
}
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return 0;
}
/**
* Put a secondary minor number.
*
* \param sec_minor - structure to be released
* \return always zero
*
* Cleans up the proc resources. Not legal for this to be the
* last minor released.
*
*/
int drm_put_head(drm_head_t *head)
{
int minor = head->minor;
drm_proc_cleanup(dev->minor, drm_proc_root, minors->dev_root); DRM_DEBUG("release secondary minor %d\n", minor);
drm_sysfs_device_remove(MKDEV(DRM_MAJOR, dev->minor));
*minors = (drm_minor_t){.dev = NULL, .type = DRM_MINOR_FREE}; drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
drm_free(dev, sizeof(*dev), DRM_MEM_STUB); drm_sysfs_device_remove(MKDEV(DRM_MAJOR, head->minor));
*head = (drm_head_t){.dev = NULL};
drm_heads[minor] = NULL;
return 0; return 0;
} }
......
...@@ -54,7 +54,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma, ...@@ -54,7 +54,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_map_t *map = NULL; drm_map_t *map = NULL;
drm_map_list_t *r_list; drm_map_list_t *r_list;
struct list_head *list; struct list_head *list;
...@@ -166,7 +166,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma, ...@@ -166,7 +166,7 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
void drm_vm_shm_close(struct vm_area_struct *vma) void drm_vm_shm_close(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_vma_entry_t *pt, *prev, *next; drm_vma_entry_t *pt, *prev, *next;
drm_map_t *map; drm_map_t *map;
drm_map_list_t *r_list; drm_map_list_t *r_list;
...@@ -246,7 +246,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma, ...@@ -246,7 +246,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long address) unsigned long address)
{ {
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
unsigned long offset; unsigned long offset;
unsigned long page_nr; unsigned long page_nr;
...@@ -281,7 +281,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma, ...@@ -281,7 +281,7 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
{ {
drm_map_t *map = (drm_map_t *)vma->vm_private_data; drm_map_t *map = (drm_map_t *)vma->vm_private_data;
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_sg_mem_t *entry = dev->sg; drm_sg_mem_t *entry = dev->sg;
unsigned long offset; unsigned long offset;
unsigned long map_offset; unsigned long map_offset;
...@@ -402,7 +402,7 @@ static struct vm_operations_struct drm_vm_sg_ops = { ...@@ -402,7 +402,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
void drm_vm_open(struct vm_area_struct *vma) void drm_vm_open(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_vma_entry_t *vma_entry; drm_vma_entry_t *vma_entry;
DRM_DEBUG("0x%08lx,0x%08lx\n", DRM_DEBUG("0x%08lx,0x%08lx\n",
...@@ -431,7 +431,7 @@ void drm_vm_open(struct vm_area_struct *vma) ...@@ -431,7 +431,7 @@ void drm_vm_open(struct vm_area_struct *vma)
void drm_vm_close(struct vm_area_struct *vma) void drm_vm_close(struct vm_area_struct *vma)
{ {
drm_file_t *priv = vma->vm_file->private_data; drm_file_t *priv = vma->vm_file->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_vma_entry_t *pt, *prev; drm_vma_entry_t *pt, *prev;
DRM_DEBUG("0x%08lx,0x%08lx\n", DRM_DEBUG("0x%08lx,0x%08lx\n",
...@@ -471,7 +471,7 @@ int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) ...@@ -471,7 +471,7 @@ int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
unsigned long length = vma->vm_end - vma->vm_start; unsigned long length = vma->vm_end - vma->vm_start;
lock_kernel(); lock_kernel();
dev = priv->dev; dev = priv->head->dev;
dma = dev->dma; dma = dev->dma;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
vma->vm_start, vma->vm_end, VM_OFFSET(vma)); vma->vm_start, vma->vm_end, VM_OFFSET(vma));
...@@ -528,7 +528,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs); ...@@ -528,7 +528,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
int drm_mmap(struct file *filp, struct vm_area_struct *vma) int drm_mmap(struct file *filp, struct vm_area_struct *vma)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_map_t *map = NULL; drm_map_t *map = NULL;
drm_map_list_t *r_list; drm_map_list_t *r_list;
unsigned long offset = 0; unsigned long offset = 0;
......
...@@ -108,7 +108,7 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -108,7 +108,7 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
drm_i810_buf_priv_t *buf_priv; drm_i810_buf_priv_t *buf_priv;
lock_kernel(); lock_kernel();
dev = priv->dev; dev = priv->head->dev;
dev_priv = dev->dev_private; dev_priv = dev->dev_private;
buf = dev_priv->mmap_buffer; buf = dev_priv->mmap_buffer;
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
...@@ -129,7 +129,7 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -129,7 +129,7 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
static int i810_map_buffer(drm_buf_t *buf, struct file *filp) static int i810_map_buffer(drm_buf_t *buf, struct file *filp)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_buf_priv_t *buf_priv = buf->dev_private; drm_i810_buf_priv_t *buf_priv = buf->dev_private;
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
struct file_operations *old_fops; struct file_operations *old_fops;
...@@ -471,7 +471,7 @@ static int i810_dma_init(struct inode *inode, struct file *filp, ...@@ -471,7 +471,7 @@ static int i810_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv; drm_i810_private_t *dev_priv;
drm_i810_init_t init; drm_i810_init_t init;
int retcode = 0; int retcode = 0;
...@@ -1007,7 +1007,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp, ...@@ -1007,7 +1007,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, filp);
...@@ -1020,7 +1020,7 @@ static int i810_dma_vertex(struct inode *inode, struct file *filp, ...@@ -1020,7 +1020,7 @@ static int i810_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page; u32 *hw_status = dev_priv->hw_status_page;
...@@ -1057,7 +1057,7 @@ static int i810_clear_bufs(struct inode *inode, struct file *filp, ...@@ -1057,7 +1057,7 @@ static int i810_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_clear_t clear; drm_i810_clear_t clear;
if (copy_from_user(&clear, (drm_i810_clear_t __user *)arg, sizeof(clear))) if (copy_from_user(&clear, (drm_i810_clear_t __user *)arg, sizeof(clear)))
...@@ -1080,7 +1080,7 @@ static int i810_swap_bufs(struct inode *inode, struct file *filp, ...@@ -1080,7 +1080,7 @@ static int i810_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
DRM_DEBUG("i810_swap_bufs\n"); DRM_DEBUG("i810_swap_bufs\n");
...@@ -1094,7 +1094,7 @@ static int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1094,7 +1094,7 @@ static int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page; u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
...@@ -1108,7 +1108,7 @@ static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1108,7 +1108,7 @@ static int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
int retcode = 0; int retcode = 0;
drm_i810_dma_t d; drm_i810_dma_t d;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
...@@ -1216,7 +1216,7 @@ static int i810_dma_mc(struct inode *inode, struct file *filp, ...@@ -1216,7 +1216,7 @@ static int i810_dma_mc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page; u32 *hw_status = dev_priv->hw_status_page;
...@@ -1247,7 +1247,7 @@ static int i810_rstatus(struct inode *inode, struct file *filp, ...@@ -1247,7 +1247,7 @@ static int i810_rstatus(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
return (int)(((u32 *)(dev_priv->hw_status_page))[4]); return (int)(((u32 *)(dev_priv->hw_status_page))[4]);
...@@ -1257,7 +1257,7 @@ static int i810_ov0_info(struct inode *inode, struct file *filp, ...@@ -1257,7 +1257,7 @@ static int i810_ov0_info(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
drm_i810_overlay_t data; drm_i810_overlay_t data;
...@@ -1272,7 +1272,7 @@ static int i810_fstatus(struct inode *inode, struct file *filp, ...@@ -1272,7 +1272,7 @@ static int i810_fstatus(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, filp);
...@@ -1284,7 +1284,7 @@ static int i810_ov0_flip(struct inode *inode, struct file *filp, ...@@ -1284,7 +1284,7 @@ static int i810_ov0_flip(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, filp);
...@@ -1324,7 +1324,7 @@ static int i810_flip_bufs(struct inode *inode, struct file *filp, ...@@ -1324,7 +1324,7 @@ static int i810_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("%s\n", __FUNCTION__);
......
...@@ -53,7 +53,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -53,7 +53,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -110,7 +110,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -110,7 +110,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
drm_i830_buf_priv_t *buf_priv; drm_i830_buf_priv_t *buf_priv;
lock_kernel(); lock_kernel();
dev = priv->dev; dev = priv->head->dev;
dev_priv = dev->dev_private; dev_priv = dev->dev_private;
buf = dev_priv->mmap_buffer; buf = dev_priv->mmap_buffer;
buf_priv = buf->dev_private; buf_priv = buf->dev_private;
...@@ -131,7 +131,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma) ...@@ -131,7 +131,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
static int i830_map_buffer(drm_buf_t *buf, struct file *filp) static int i830_map_buffer(drm_buf_t *buf, struct file *filp)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_buf_priv_t *buf_priv = buf->dev_private; drm_i830_buf_priv_t *buf_priv = buf->dev_private;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
struct file_operations *old_fops; struct file_operations *old_fops;
...@@ -447,7 +447,7 @@ static int i830_dma_init(struct inode *inode, struct file *filp, ...@@ -447,7 +447,7 @@ static int i830_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv; drm_i830_private_t *dev_priv;
drm_i830_init_t init; drm_i830_init_t init;
int retcode = 0; int retcode = 0;
...@@ -1297,7 +1297,7 @@ static int i830_flush_ioctl(struct inode *inode, struct file *filp, ...@@ -1297,7 +1297,7 @@ static int i830_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
LOCK_TEST_WITH_RETURN(dev, filp); LOCK_TEST_WITH_RETURN(dev, filp);
...@@ -1309,7 +1309,7 @@ static int i830_dma_vertex(struct inode *inode, struct file *filp, ...@@ -1309,7 +1309,7 @@ static int i830_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_device_dma_t *dma = dev->dma; drm_device_dma_t *dma = dev->dma;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page; u32 *hw_status = dev_priv->hw_status_page;
...@@ -1341,7 +1341,7 @@ static int i830_clear_bufs(struct inode *inode, struct file *filp, ...@@ -1341,7 +1341,7 @@ static int i830_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_clear_t clear; drm_i830_clear_t clear;
if (copy_from_user(&clear, (drm_i830_clear_t __user *)arg, sizeof(clear))) if (copy_from_user(&clear, (drm_i830_clear_t __user *)arg, sizeof(clear)))
...@@ -1365,7 +1365,7 @@ static int i830_swap_bufs(struct inode *inode, struct file *filp, ...@@ -1365,7 +1365,7 @@ static int i830_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
DRM_DEBUG("i830_swap_bufs\n"); DRM_DEBUG("i830_swap_bufs\n");
...@@ -1405,7 +1405,7 @@ static int i830_flip_bufs(struct inode *inode, struct file *filp, ...@@ -1405,7 +1405,7 @@ static int i830_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
DRM_DEBUG("%s\n", __FUNCTION__); DRM_DEBUG("%s\n", __FUNCTION__);
...@@ -1423,7 +1423,7 @@ static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1423,7 +1423,7 @@ static int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page; u32 *hw_status = dev_priv->hw_status_page;
drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *) drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
...@@ -1437,7 +1437,7 @@ static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -1437,7 +1437,7 @@ static int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
int retcode = 0; int retcode = 0;
drm_i830_dma_t d; drm_i830_dma_t d;
drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private; drm_i830_private_t *dev_priv = (drm_i830_private_t *)dev->dev_private;
...@@ -1484,7 +1484,7 @@ static int i830_getparam( struct inode *inode, struct file *filp, ...@@ -1484,7 +1484,7 @@ static int i830_getparam( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_getparam_t param; drm_i830_getparam_t param;
int value; int value;
...@@ -1518,7 +1518,7 @@ static int i830_setparam( struct inode *inode, struct file *filp, ...@@ -1518,7 +1518,7 @@ static int i830_setparam( struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg ) unsigned int cmd, unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_setparam_t param; drm_i830_setparam_t param;
......
...@@ -54,7 +54,7 @@ int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -54,7 +54,7 @@ int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -123,7 +123,7 @@ int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -123,7 +123,7 @@ int i830_irq_emit( struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg ) unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_emit_t emit; drm_i830_irq_emit_t emit;
int result; int result;
...@@ -155,7 +155,7 @@ int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd, ...@@ -155,7 +155,7 @@ int i830_irq_wait( struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg ) unsigned long arg )
{ {
drm_file_t *priv = filp->private_data; drm_file_t *priv = filp->private_data;
drm_device_t *dev = priv->dev; drm_device_t *dev = priv->head->dev;
drm_i830_private_t *dev_priv = dev->dev_private; drm_i830_private_t *dev_priv = dev->dev_private;
drm_i830_irq_wait_t irqwait; drm_i830_irq_wait_t irqwait;
......
...@@ -29,7 +29,7 @@ int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -29,7 +29,7 @@ int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -51,7 +51,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -51,7 +51,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -45,7 +45,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -45,7 +45,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -46,7 +46,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -46,7 +46,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -40,7 +40,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -40,7 +40,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
...@@ -44,7 +44,7 @@ static int postinit( struct drm_device *dev, unsigned long flags ) ...@@ -44,7 +44,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR, DRIVER_MINOR,
DRIVER_PATCHLEVEL, DRIVER_PATCHLEVEL,
DRIVER_DATE, DRIVER_DATE,
dev->minor, dev->primary.minor,
pci_pretty_name(dev->pdev) pci_pretty_name(dev->pdev)
); );
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment