aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Smirl <jonsmirl@yahoo.com>2004-10-12 03:59:17 +0000
committerJon Smirl <jonsmirl@yahoo.com>2004-10-12 03:59:17 +0000
commitad70dc676ebf8f2f86d171dccb873a04a3e5b87b (patch)
tree1ee7e58021f8348bff535b1301c3c50d99572f48
parentad549c5ae62fd75aa2bdb8bf5efc4913c476cb02 (diff)
Breakout heads into their own data structures.
-rw-r--r--linux-core/drmP.h55
-rw-r--r--linux-core/drm_agpsupport.c16
-rw-r--r--linux-core/drm_auth.c4
-rw-r--r--linux-core/drm_bufs.c20
-rw-r--r--linux-core/drm_context.c12
-rw-r--r--linux-core/drm_dma.c2
-rw-r--r--linux-core/drm_drv.c64
-rw-r--r--linux-core/drm_fops.c22
-rw-r--r--linux-core/drm_ioctl.c10
-rw-r--r--linux-core/drm_irq.c6
-rw-r--r--linux-core/drm_lock.c4
-rw-r--r--linux-core/drm_os_linux.h2
-rw-r--r--linux-core/drm_proc.c8
-rw-r--r--linux-core/drm_scatter.c4
-rw-r--r--linux-core/drm_stub.c159
-rw-r--r--linux-core/drm_vm.c16
-rw-r--r--linux-core/i810_dma.c32
-rw-r--r--linux-core/i810_drv.c37
-rw-r--r--linux-core/i830_dma.c26
-rw-r--r--linux-core/i830_drv.c36
-rw-r--r--linux-core/i830_irq.c4
-rw-r--r--linux-core/i915_drv.c36
-rw-r--r--linux-core/mach64_drv.c35
-rw-r--r--linux-core/mga_drv.c35
-rw-r--r--linux-core/r128_drv.c36
-rw-r--r--linux-core/radeon_drv.c37
-rw-r--r--linux-core/savage_drv.c22
-rw-r--r--linux-core/sis_drv.c36
-rw-r--r--linux-core/tdfx_drv.c35
-rw-r--r--shared-core/via_drv.c36
30 files changed, 406 insertions, 441 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h
index 011ab911..583ead0f 100644
--- a/linux-core/drmP.h
+++ b/linux-core/drmP.h
@@ -378,7 +378,7 @@ typedef struct drm_file {
unsigned long ioctl_count;
struct drm_file *next;
struct drm_file *prev;
- struct drm_device *dev;
+ struct drm_head *head;
int remove_auth_on_close;
unsigned long lock_count;
void *driver_priv;
@@ -504,10 +504,11 @@ typedef struct drm_vbl_sig {
} drm_vbl_sig_t;
/**
- * DRM device functions structure
+ * DRM driver structure. This structure represent the common code for
+ * a family of cards. There will one drm_device for each card present
+ * in this family
*/
struct drm_device;
-
struct drm_driver {
int (*preinit) (struct drm_device *, unsigned long flags);
void (*prerelease) (struct drm_device *, struct file * filp);
@@ -547,17 +548,30 @@ struct drm_driver {
drm_ioctl_desc_t *ioctls;
int num_ioctls;
struct file_operations fops;
+ 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 {
char *unique; /**< Unique identifier: e.g., busid */
int unique_len; /**< Length of unique field */
- dev_t device; /**< Device number for mknod */
char *devname; /**< For /proc/interrupts */
- int minor; /**< Minor device number */
int if_version; /**< Highest interface version set */
int blocked; /**< Blocked due to VC switch? */
@@ -680,18 +694,9 @@ typedef struct drm_device {
struct drm_driver *driver;
drm_local_map_t *agp_buffer_map;
+ drm_head_t primary; /**< primary screen head */
} drm_device_t;
-typedef struct drm_minor {
- enum {
- DRM_MINOR_FREE = 0,
- DRM_MINOR_PRIMARY,
- DRM_MINOR_SECONDARY,
- } class;
- 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)
{
@@ -727,10 +732,9 @@ extern int drm_cpu_valid(void);
/* Driver support (drm_drv.h) */
extern int drm_fb_loaded;
-extern int __devinit drm_init(struct pci_driver *pci_driver,
- struct pci_device_id *pciidlist,
- struct drm_driver *driver);
-extern void __exit drm_exit(struct pci_driver *pci_driver);
+extern int __devinit drm_init(struct drm_driver *driver,
+ struct pci_device_id *pciidlist);
+extern void __exit drm_exit(struct drm_driver *driver);
extern void __exit drm_cleanup_pci(struct pci_dev *pdev);
extern int drm_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg);
@@ -909,14 +913,13 @@ extern int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start);
extern int drm_agp_unbind_memory(DRM_AGP_MEM * handle);
/* Stub support (drm_stub.h) */
-extern int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent,
+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_get_secondary_minor(drm_device_t * dev,
- drm_minor_t ** sec_minor);
-extern int drm_put_secondary_minor(drm_minor_t * sec_minor);
+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 cards_limit;
-extern drm_minor_t *drm_minors;
+extern drm_head_t **drm_heads;
extern struct drm_sysfs_class *drm_class;
extern struct proc_dir_entry *drm_proc_root;
diff --git a/linux-core/drm_agpsupport.c b/linux-core/drm_agpsupport.c
index d43d82d8..b9113143 100644
--- a/linux-core/drm_agpsupport.c
+++ b/linux-core/drm_agpsupport.c
@@ -57,7 +57,7 @@ int drm_agp_info(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_info_t info;
@@ -96,7 +96,7 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
int retcode;
if (!dev->agp)
@@ -130,7 +130,7 @@ int drm_agp_release(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 || !drm_agp->release)
return -EINVAL;
@@ -167,7 +167,7 @@ int drm_agp_enable(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
if (!dev->agp || !dev->agp->acquired || !drm_agp->enable)
@@ -199,7 +199,7 @@ int drm_agp_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_mem_t *entry;
DRM_AGP_MEM *memory;
@@ -284,7 +284,7 @@ int drm_agp_unbind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_mem_t *entry;
int ret;
@@ -321,7 +321,7 @@ int drm_agp_bind(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_mem_t *entry;
int retcode;
@@ -363,7 +363,7 @@ int drm_agp_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_mem_t *entry;
diff --git a/linux-core/drm_auth.c b/linux-core/drm_auth.c
index a949500f..0a723c04 100644
--- a/linux-core/drm_auth.c
+++ b/linux-core/drm_auth.c
@@ -176,7 +176,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
static drm_magic_t sequence = 0;
static spinlock_t lock = SPIN_LOCK_UNLOCKED;
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_auth_t auth;
/* Find unique magic */
@@ -215,7 +215,7 @@ int drm_authmagic(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_file_t *file;
diff --git a/linux-core/drm_bufs.c b/linux-core/drm_bufs.c
index 03afff01..bb74e70d 100644
--- a/linux-core/drm_bufs.c
+++ b/linux-core/drm_bufs.c
@@ -114,7 +114,7 @@ int drm_addmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 __user *argp = (void __user *)arg;
drm_map_list_t *list;
@@ -292,7 +292,7 @@ int drm_rmmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
struct list_head *list;
drm_map_list_t *r_list = NULL;
drm_vma_entry_t *pt, *prev;
@@ -415,7 +415,7 @@ int drm_addbufs_agp(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_desc_t request;
drm_buf_entry_t *entry;
@@ -579,7 +579,7 @@ int drm_addbufs_pci(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_desc_t request;
int count;
@@ -807,7 +807,7 @@ int drm_addbufs_sg(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_desc_t __user *argp = (void __user *)arg;
drm_buf_desc_t request;
@@ -990,7 +990,7 @@ int drm_addbufs(struct inode *inode, struct file *filp,
{
drm_buf_desc_t request;
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))
return -EINVAL;
@@ -1031,7 +1031,7 @@ int drm_infobufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_info_t request;
drm_buf_info_t __user *argp = (void __user *)arg;
@@ -1119,7 +1119,7 @@ int drm_markbufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_desc_t request;
int order;
@@ -1169,7 +1169,7 @@ int drm_freebufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_free_t request;
int i;
@@ -1224,7 +1224,7 @@ int drm_mapbufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_buf_map_t __user *argp = (void __user *)arg;
int retcode = 0;
diff --git a/linux-core/drm_context.c b/linux-core/drm_context.c
index feb4c07a..46fcfa1c 100644
--- a/linux-core/drm_context.c
+++ b/linux-core/drm_context.c
@@ -213,7 +213,7 @@ int drm_getsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 request;
drm_map_t *map;
@@ -253,7 +253,7 @@ int drm_setsareactx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_map_t *map = NULL;
drm_map_list_t *r_list = NULL;
@@ -398,7 +398,7 @@ int drm_addctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_t __user *argp = (void __user *)arg;
drm_ctx_t ctx;
@@ -491,7 +491,7 @@ int drm_switchctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
@@ -516,7 +516,7 @@ int drm_newctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
@@ -543,7 +543,7 @@ int drm_rmctx(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_ctx_t ctx;
if (copy_from_user(&ctx, (drm_ctx_t __user *) arg, sizeof(ctx)))
diff --git a/linux-core/drm_dma.c b/linux-core/drm_dma.c
index 66886309..035dd35b 100644
--- a/linux-core/drm_dma.c
+++ b/linux-core/drm_dma.c
@@ -157,7 +157,7 @@ void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf)
void drm_core_reclaim_buffers(struct file *filp)
{
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;
int i;
diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index c91011dc..79c0229c 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -172,17 +172,6 @@ int drm_takedown(drm_device_t * dev)
down(&dev->struct_sem);
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 */
for (i = 0; i < DRM_HASH_SIZE; i++) {
for (pt = dev->magiclist[i].head; pt; pt = next) {
@@ -318,9 +307,8 @@ MODULE_PARM(drm_opts, "s");
* Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and
* after the initialization for driver customization.
*/
-int drm_init(struct pci_driver *pci_driver,
- struct pci_device_id *pciidlist,
- struct drm_driver *driver)
+int drm_init(struct drm_driver *driver,
+ struct pci_device_id *pciidlist)
{
struct pci_dev *pdev;
struct pci_device_id *pid;
@@ -357,7 +345,7 @@ int drm_init(struct pci_driver *pci_driver,
}
if (drm_fb_loaded == 0)
- pci_register_driver(pci_driver);
+ pci_register_driver(&driver->pci_driver);
else {
for (i = 0; pciidlist[i].vendor != 0; i++) {
pid = &pciidlist[i];
@@ -370,7 +358,7 @@ int drm_init(struct pci_driver *pci_driver,
pdev))) {
/* stealth mode requires a manual probe */
pci_dev_get(pdev);
- drm_probe(pdev, &pciidlist[i], driver);
+ drm_get_dev(pdev, &pciidlist[i], driver);
}
}
DRM_INFO("Used old pci detect: framebuffer loaded\n");
@@ -462,31 +450,33 @@ static void __exit drm_cleanup(drm_device_t * dev)
if (dev->driver->postcleanup)
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");
}
-void __exit drm_exit(struct pci_driver *pci_driver)
+void __exit drm_exit(struct drm_driver *driver)
{
int i;
- drm_device_t *dev;
- drm_minor_t *minor;
+ drm_device_t *dev = NULL;
+ drm_head_t *head;
DRM_DEBUG("\n");
if (drm_fb_loaded) {
for (i = 0; i < cards_limit; i++) {
- minor = &drm_minors[i];
- dev = minor->dev;
- DRM_DEBUG("fb loaded release minor %d\n", dev->minor);
- if (minor->class == DRM_MINOR_PRIMARY) {
- /* release the pci driver */
- if (dev->pdev)
- pci_dev_put(dev->pdev);
- drm_cleanup(dev);
- }
+ head = drm_heads[i];
+ if (head->dev->driver != driver)
+ continue;
+ dev = head->dev;
+ }
+ if (dev) {
+ /* release the pci driver */
+ if (dev->pdev)
+ pci_dev_put(dev->pdev);
+ drm_cleanup(dev);
}
} else
- pci_unregister_driver(pci_driver);
+ pci_unregister_driver(&driver->pci_driver);
DRM_INFO("Module unloaded\n");
}
EXPORT_SYMBOL(drm_exit);
@@ -503,8 +493,8 @@ static int __init drm_core_init(void)
cards_limit =
(cards_limit < DRM_MAX_MINOR + 1 ? cards_limit : DRM_MAX_MINOR + 1);
- drm_minors = drm_calloc(cards_limit, sizeof(*drm_minors), DRM_MEM_STUB);
- if (!drm_minors)
+ drm_heads = drm_calloc(cards_limit, sizeof(*drm_heads), DRM_MEM_STUB);
+ if (!drm_heads)
goto err_p1;
if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
@@ -533,7 +523,7 @@ static int __init drm_core_init(void)
drm_sysfs_destroy(drm_class);
err_p2:
unregister_chrdev(DRM_MAJOR, "drm");
- drm_free(drm_minors, sizeof(*drm_minors) * cards_limit, DRM_MEM_STUB);
+ drm_free(drm_heads, sizeof(*drm_heads) * cards_limit, DRM_MEM_STUB);
err_p1:
return ret;
}
@@ -548,7 +538,7 @@ static void __exit drm_core_exit(void)
unregister_chrdev(DRM_MAJOR, "drm");
- drm_free(drm_minors, sizeof(*drm_minors) * cards_limit, DRM_MEM_STUB);
+ drm_free(drm_heads, sizeof(*drm_heads) * cards_limit, DRM_MEM_STUB);
}
module_init(drm_core_init);
@@ -569,7 +559,7 @@ int drm_version(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 version;
int ret;
@@ -602,7 +592,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_t *func;
unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -613,7 +603,7 @@ int drm_ioctl(struct inode *inode, struct file *filp,
++priv->ioctl_count;
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);
if (nr < DRIVER_IOCTL_COUNT)
diff --git a/linux-core/drm_fops.c b/linux-core/drm_fops.c
index 0ae1be9b..0c62a1d0 100644
--- a/linux-core/drm_fops.c
+++ b/linux-core/drm_fops.c
@@ -131,8 +131,10 @@ int drm_open(struct inode *inode, struct file *filp)
if (!((minor >= 0) && (minor < cards_limit)))
return -ENODEV;
- dev = drm_minors[minor].dev;
- if (!dev)
+ if (!drm_heads[minor])
+ return -ENODEV;
+
+ if (!(dev = drm_heads[minor]->dev))
return -ENODEV;
retcode = drm_open_helper(inode, filp, dev);
@@ -171,8 +173,10 @@ int drm_stub_open(struct inode *inode, struct file *filp)
if (!((minor >= 0) && (minor < cards_limit)))
return -ENODEV;
- dev = drm_minors[minor].dev;
- if (!dev)
+ if (!drm_heads[minor])
+ return -ENODEV;
+
+ if (!(dev = drm_heads[minor]->dev))
return -ENODEV;
old_fops = filp->f_op;
@@ -219,7 +223,7 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t * dev)
priv->uid = current->euid;
priv->pid = current->pid;
priv->minor = minor;
- priv->dev = dev;
+ priv->head = drm_heads[minor];
priv->ioctl_count = 0;
priv->authenticated = capable(CAP_SYS_ADMIN);
priv->lock_count = 0;
@@ -272,11 +276,11 @@ int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t * dev)
int drm_fasync(int fd, struct file *filp, int on)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
int retcode;
DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
- (long)old_encode_dev(dev->device));
+ (long)old_encode_dev(priv->head->device));
retcode = fasync_helper(fd, filp, on, &dev->buf_async);
if (retcode < 0)
return retcode;
@@ -303,7 +307,7 @@ int drm_release(struct inode *inode, struct file *filp)
int retcode = 0;
lock_kernel();
- dev = priv->dev;
+ dev = priv->head->dev;
DRM_DEBUG("open_count = %d\n", dev->open_count);
@@ -315,7 +319,7 @@ int drm_release(struct inode *inode, struct file *filp)
*/
DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
- current->pid, (long)old_encode_dev(dev->device),
+ current->pid, (long)old_encode_dev(priv->head->device),
dev->open_count);
if (priv->lock_count && dev->lock.hw_lock &&
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index 831cdf7b..cc177d97 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -53,7 +53,7 @@ int drm_getunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 u;
@@ -87,7 +87,7 @@ int drm_setunique(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_unique_t u;
int domain, bus, slot, func, ret;
@@ -173,7 +173,7 @@ int drm_getmap(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 map;
drm_map_list_t *r_list = NULL;
@@ -234,7 +234,7 @@ int drm_getclient(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 client;
drm_file_t *pt;
@@ -277,7 +277,7 @@ int drm_getstats(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_stats_t stats;
int i;
diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c
index 759c0a9c..8d79d8e6 100644
--- a/linux-core/drm_irq.c
+++ b/linux-core/drm_irq.c
@@ -54,7 +54,7 @@ int drm_irq_by_busid(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 p;
@@ -193,7 +193,7 @@ int drm_control(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
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 */
@@ -240,7 +240,7 @@ int drm_control(struct inode *inode, struct file *filp,
int drm_wait_vblank(DRM_IOCTL_ARGS)
{
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 vblwait;
struct timeval now;
diff --git a/linux-core/drm_lock.c b/linux-core/drm_lock.c
index 63253bfe..655333cf 100644
--- a/linux-core/drm_lock.c
+++ b/linux-core/drm_lock.c
@@ -50,7 +50,7 @@ int drm_lock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
DECLARE_WAITQUEUE(entry, current);
drm_lock_t lock;
int ret = 0;
@@ -140,7 +140,7 @@ int drm_unlock(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
drm_lock_t lock;
if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock)))
diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h
index 836144d1..fba894f1 100644
--- a/linux-core/drm_os_linux.h
+++ b/linux-core/drm_os_linux.h
@@ -49,7 +49,7 @@
#define DRM_MEMORYBARRIER() mb()
/** DRM device local declaration */
#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 */
#define DRM_IRQ_ARGS int irq, void *arg, struct pt_regs *regs
diff --git a/linux-core/drm_proc.c b/linux-core/drm_proc.c
index 0684da16..297d5d43 100644
--- a/linux-core/drm_proc.c
+++ b/linux-core/drm_proc.c
@@ -174,12 +174,12 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
*eof = 0;
if (dev->unique) {
- DRM_PROC_PRINT("%s 0x%lx %s\n",
- dev->pdev->driver->name, (long)old_encode_dev(dev->device),
+ DRM_PROC_PRINT("%s %s %s\n",
+ dev->pdev->driver->name, pci_name(dev->pdev),
dev->unique);
} else {
- DRM_PROC_PRINT("%s 0x%lx\n", dev->pdev->driver->name,
- (long)old_encode_dev(dev->device));
+ DRM_PROC_PRINT("%s %s\n", dev->pdev->driver->name,
+ pci_name(dev->pdev));
}
if (len > request + offset)
diff --git a/linux-core/drm_scatter.c b/linux-core/drm_scatter.c
index c5b1aee4..7dc0e92f 100644
--- a/linux-core/drm_scatter.c
+++ b/linux-core/drm_scatter.c
@@ -62,7 +62,7 @@ int drm_sg_alloc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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 request;
drm_sg_mem_t *entry;
@@ -197,7 +197,7 @@ int drm_sg_free(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_sg_mem_t *entry;
diff --git a/linux-core/drm_stub.c b/linux-core/drm_stub.c
index 03327839..95ecd2d4 100644
--- a/linux-core/drm_stub.c
+++ b/linux-core/drm_stub.c
@@ -48,7 +48,7 @@ MODULE_PARM_DESC(debug, "Enable debug output");
module_param(cards_limit, int, 0444);
module_param(debug, int, 0666);
-drm_minor_t *drm_minors;
+drm_head_t **drm_heads;
struct drm_sysfs_class *drm_class;
struct proc_dir_entry *drm_proc_root;
@@ -120,16 +120,9 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
goto error_out_unreg;
}
- dev->device = MKDEV(DRM_MAJOR, dev->minor);
-
- /* postinit is a required function to display the signon banner */
- /* drivers add secondary heads here if needed */
- if ((retcode = dev->driver->postinit(dev, ent->driver_data)))
- goto error_out_unreg;
-
return 0;
- error_out_unreg:
+error_out_unreg:
drm_takedown(dev);
return retcode;
}
@@ -145,76 +138,47 @@ static int fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
* then register the character device and inter module information.
* Try and register, if we fail to register, backout previous work.
*/
-int drm_probe(struct pci_dev *pdev, const struct pci_device_id *ent,
+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;
int ret;
- int minor;
- drm_minor_t *minors = &drm_minors[0];
DRM_DEBUG("\n");
- for (minor = 0; minor < cards_limit; minor++, minors++) {
- if (minors->class == DRM_MINOR_FREE) {
-
- DRM_DEBUG("assigning minor %d\n", minor);
- dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
- if (!dev)
- return -ENOMEM;
-
- *minors = (drm_minor_t) {
- .dev = dev,.class = DRM_MINOR_PRIMARY};
- dev->minor = minor;
- if (!drm_fb_loaded) {
- pci_set_drvdata(pdev, dev);
- pci_request_regions(pdev, DRIVER_NAME);
- pci_enable_device(pdev);
- }
- if ((ret = fill_in_dev(dev, pdev, ent, driver))) {
- printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
- goto err_g1;
- }
- if ((ret =
- drm_proc_init(dev, minor, drm_proc_root,
- &minors->dev_root))) {
- printk(KERN_ERR
- "DRM: Failed to initialize /proc/dri.\n");
- goto err_g1;
- }
- dev_class = drm_sysfs_device_add(drm_class,
- MKDEV(DRM_MAJOR,
- minor),
- DRM_PCI_DEV(pdev),
- "card%d", minor);
- if (IS_ERR(dev_class)) {
- printk(KERN_ERR
- "DRM: Error sysfs_device_add.\n");
- ret = PTR_ERR(dev_class);
- goto err_g2;
- }
+ dev = drm_calloc(1, sizeof(*dev), DRM_MEM_STUB);
+ if (!dev)
+ return -ENOMEM;
- DRM_DEBUG("new primary minor assigned %d\n", minor);
- return 0;
- }
+ if (!drm_fb_loaded) {
+ pci_set_drvdata(pdev, dev);
+ pci_request_regions(pdev, DRIVER_NAME);
+ pci_enable_device(pdev);
}
- DRM_ERROR("out of minors\n");
- return -ENOMEM;
-err_g2:
- drm_proc_cleanup(minor, drm_proc_root, minors->dev_root);
+ if ((ret = fill_in_dev(dev, pdev, ent, driver))) {
+ printk(KERN_ERR "DRM: Fill_in_dev failed.\n");
+ goto err_g1;
+ }
+ 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:
if (!drm_fb_loaded) {
pci_set_drvdata(pdev, NULL);
pci_release_regions(pdev);
pci_disable_device(pdev);
}
- *minors = (drm_minor_t) {
- .dev = NULL,.class = DRM_MINOR_FREE};
drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
return ret;
}
-EXPORT_SYMBOL(drm_probe);
+EXPORT_SYMBOL(drm_get_dev);
/**
* Get a secondary minor number.
@@ -227,53 +191,54 @@ EXPORT_SYMBOL(drm_probe);
* create the proc init entry via proc_init(). This routines assigns
* minor numbers to secondary heads of multi-headed cards
*/
-int drm_get_secondary_minor(drm_device_t * dev, drm_minor_t ** sec_minor)
+int drm_get_head(drm_device_t * dev, drm_head_t * head)
{
- drm_minor_t *minors = &drm_minors[0];
- struct class_device *dev_class;
+ drm_head_t **heads = drm_heads;
int ret;
int minor;
DRM_DEBUG("\n");
- for (minor = 0; minor < cards_limit; minor++, minors++) {
- if (minors->class == DRM_MINOR_FREE) {
+ for (minor = 0; minor < cards_limit; minor++, heads++) {
+ if (!*heads) {
- *minors = (drm_minor_t) {
- .dev = dev,.class = DRM_MINOR_SECONDARY};
+ *head = (drm_head_t) {
+ .dev = dev,
+ .device = MKDEV(DRM_MAJOR, minor),
+ .minor = minor,
+ };
if ((ret =
drm_proc_init(dev, minor, drm_proc_root,
- &minors->dev_root))) {
+ &head->dev_root))) {
printk(KERN_ERR
"DRM: Failed to initialize /proc/dri.\n");
goto err_g1;
}
- dev_class = drm_sysfs_device_add(drm_class,
+ head->dev_class = drm_sysfs_device_add(drm_class,
MKDEV(DRM_MAJOR,
minor),
DRM_PCI_DEV(dev->pdev),
"card%d", minor);
- if (IS_ERR(dev_class)) {
+ if (IS_ERR(head->dev_class)) {
printk(KERN_ERR
"DRM: Error sysfs_device_add.\n");
- ret = PTR_ERR(dev_class);
+ ret = PTR_ERR(head->dev_class);
goto err_g2;
}
- *sec_minor = minors;
+ *heads = head;
- DRM_DEBUG("new secondary minor assigned %d\n", minor);
+ DRM_DEBUG("new minor assigned %d\n", minor);
return 0;
}
}
DRM_ERROR("out of minors\n");
return -ENOMEM;
- err_g2:
- drm_proc_cleanup(minor, drm_proc_root, minors->dev_root);
- err_g1:
- *minors = (drm_minor_t) {
- .dev = NULL,.class = DRM_MINOR_FREE};
- drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
+err_g2:
+ drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
+err_g1:
+ *head = (drm_head_t) {
+ .dev = NULL};
return ret;
}
@@ -287,19 +252,21 @@ int drm_get_secondary_minor(drm_device_t * dev, drm_minor_t ** sec_minor)
* "drm" data, otherwise unregisters the "drm" data, frees the dev list and
* 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->pdev->driver->name);
- DRM_DEBUG("release primary minor %d\n", dev->minor);
-
- drm_proc_cleanup(dev->minor, drm_proc_root, minors->dev_root);
- drm_sysfs_device_remove(MKDEV(DRM_MAJOR, dev->minor));
-
- *minors = (drm_minor_t) {
- .dev = NULL,.class = DRM_MINOR_FREE};
+ 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;
}
@@ -313,17 +280,17 @@ int drm_put_minor(drm_device_t * dev)
* last minor released.
*
*/
-int drm_put_secondary_minor(drm_minor_t * sec_minor)
+int drm_put_head(drm_head_t * head)
{
- int minor = sec_minor - &drm_minors[0];
+ int minor = head->minor;
DRM_DEBUG("release secondary minor %d\n", minor);
- drm_proc_cleanup(minor, drm_proc_root, sec_minor->dev_root);
- drm_sysfs_device_remove(MKDEV(DRM_MAJOR, minor));
+ drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
+ drm_sysfs_device_remove(MKDEV(DRM_MAJOR, head->minor));
- *sec_minor = (drm_minor_t) {
- .dev = NULL,.class = DRM_MINOR_FREE};
+ *head = (drm_head_t){.dev = NULL};
+ drm_heads[minor] = NULL;
return 0;
}
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 70737a3c..47466754 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -50,7 +50,7 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
unsigned long address)
{
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_list_t *r_list;
struct list_head *list;
@@ -171,7 +171,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)
{
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_map_t *map;
drm_map_list_t *r_list;
@@ -252,7 +252,7 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
unsigned long address)
{
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;
unsigned long offset;
unsigned long page_nr;
@@ -289,7 +289,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_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;
unsigned long offset;
unsigned long map_offset;
@@ -413,7 +413,7 @@ static struct vm_operations_struct drm_vm_sg_ops = {
void drm_vm_open(struct vm_area_struct *vma)
{
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_DEBUG("0x%08lx,0x%08lx\n",
@@ -442,7 +442,7 @@ void drm_vm_open(struct vm_area_struct *vma)
void drm_vm_close(struct vm_area_struct *vma)
{
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_DEBUG("0x%08lx,0x%08lx\n",
@@ -482,7 +482,7 @@ int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
unsigned long length = vma->vm_end - vma->vm_start;
lock_kernel();
- dev = priv->dev;
+ dev = priv->head->dev;
dma = dev->dma;
DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
vma->vm_start, vma->vm_end, VM_OFFSET(vma));
@@ -539,7 +539,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
int drm_mmap(struct file *filp, struct vm_area_struct *vma)
{
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_list_t *r_list;
unsigned long offset = 0;
diff --git a/linux-core/i810_dma.c b/linux-core/i810_dma.c
index 0f1f4400..166ac5a7 100644
--- a/linux-core/i810_dma.c
+++ b/linux-core/i810_dma.c
@@ -119,7 +119,7 @@ int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
drm_i810_buf_priv_t *buf_priv;
lock_kernel();
- dev = priv->dev;
+ dev = priv->head->dev;
dev_priv = dev->dev_private;
buf = dev_priv->mmap_buffer;
buf_priv = buf->dev_private;
@@ -140,7 +140,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)
{
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_private_t *dev_priv = dev->dev_private;
int retcode = 0;
@@ -480,7 +480,7 @@ int i810_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_init_t init;
int retcode = 0;
@@ -974,7 +974,7 @@ static int i810_flush_queue(drm_device_t * dev)
void i810_reclaim_buffers(struct file *filp)
{
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;
int i;
@@ -1007,7 +1007,7 @@ int i810_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i810_flush_ioctl called without lock held\n");
@@ -1022,7 +1022,7 @@ int i810_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page;
@@ -1061,7 +1061,7 @@ int i810_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
if (copy_from_user
@@ -1087,7 +1087,7 @@ int i810_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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");
@@ -1104,7 +1104,7 @@ int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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;
u32 *hw_status = dev_priv->hw_status_page;
drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *)
@@ -1118,7 +1118,7 @@ int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
int retcode = 0;
drm_i810_dma_t d;
drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
@@ -1226,7 +1226,7 @@ int i810_dma_mc(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page;
@@ -1260,7 +1260,7 @@ int i810_rstatus(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
return (int)(((u32 *) (dev_priv->hw_status_page))[4]);
@@ -1270,7 +1270,7 @@ int i810_ov0_info(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_overlay_t data;
@@ -1286,7 +1286,7 @@ int i810_fstatus(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1300,7 +1300,7 @@ int i810_ov0_flip(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
@@ -1341,7 +1341,7 @@ int i810_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_DEBUG("%s\n", __FUNCTION__);
diff --git a/linux-core/i810_drv.c b/linux-core/i810_drv.c
index df48ebcf..bfeb35a8 100644
--- a/linux-core/i810_drv.c
+++ b/linux-core/i810_drv.c
@@ -52,7 +52,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -92,6 +92,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_I810_FLIP)] = {i810_flip_bufs, 1, 0}
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -108,36 +109,34 @@ static struct drm_driver driver = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = i810_mmap_buffers,
- .fasync = drm_fasync,
- }
- ,
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i810_mmap_buffers,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init i810_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit i810_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(i810_init);
diff --git a/linux-core/i830_dma.c b/linux-core/i830_dma.c
index f7f136e4..d09f3b36 100644
--- a/linux-core/i830_dma.c
+++ b/linux-core/i830_dma.c
@@ -120,7 +120,7 @@ int i830_mmap_buffers(struct file *filp, struct vm_area_struct *vma)
drm_i830_buf_priv_t *buf_priv;
lock_kernel();
- dev = priv->dev;
+ dev = priv->head->dev;
dev_priv = dev->dev_private;
buf = dev_priv->mmap_buffer;
buf_priv = buf->dev_private;
@@ -141,7 +141,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)
{
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_private_t *dev_priv = dev->dev_private;
unsigned long virtual;
@@ -458,7 +458,7 @@ int i830_dma_init(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_init_t init;
int retcode = 0;
@@ -1254,7 +1254,7 @@ static int i830_flush_queue(drm_device_t * dev)
void i830_reclaim_buffers(struct file *filp)
{
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;
int i;
@@ -1287,7 +1287,7 @@ int i830_flush_ioctl(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) {
DRM_ERROR("i830_flush_ioctl called without lock held\n");
@@ -1302,7 +1302,7 @@ int i830_dma_vertex(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
u32 *hw_status = dev_priv->hw_status_page;
@@ -1339,7 +1339,7 @@ int i830_clear_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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;
if (copy_from_user
@@ -1366,7 +1366,7 @@ int i830_swap_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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");
@@ -1407,7 +1407,7 @@ int i830_flip_bufs(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
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_DEBUG("%s\n", __FUNCTION__);
@@ -1428,7 +1428,7 @@ int i830_getage(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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;
u32 *hw_status = dev_priv->hw_status_page;
drm_i830_sarea_t *sarea_priv = (drm_i830_sarea_t *)
@@ -1442,7 +1442,7 @@ int i830_getbuf(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
drm_file_t *priv = filp->private_data;
- drm_device_t *dev = priv->dev;
+ drm_device_t *dev = priv->head->dev;
int retcode = 0;
drm_i830_dma_t d;
drm_i830_private_t *dev_priv = (drm_i830_private_t *) dev->dev_private;
@@ -1490,7 +1490,7 @@ int i830_getparam(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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_getparam_t param;
int value;
@@ -1524,7 +1524,7 @@ int i830_setparam(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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_setparam_t param;
diff --git a/linux-core/i830_drv.c b/linux-core/i830_drv.c
index bbf48886..e7c00a80 100644
--- a/linux-core/i830_drv.c
+++ b/linux-core/i830_drv.c
@@ -54,7 +54,7 @@ int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -93,6 +93,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_I830_SETPARAM)] = {i830_setparam, 1, 0}
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -118,36 +119,35 @@ static struct drm_driver driver = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = i830_mmap_buffers,
- .fasync = drm_fasync,
- }
- ,
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = i830_mmap_buffers,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
static int __init i830_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit i830_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(i830_init);
diff --git a/linux-core/i830_irq.c b/linux-core/i830_irq.c
index 7c709738..586ceae2 100644
--- a/linux-core/i830_irq.c
+++ b/linux-core/i830_irq.c
@@ -119,7 +119,7 @@ int i830_irq_emit(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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_irq_emit_t emit;
int result;
@@ -154,7 +154,7 @@ int i830_irq_wait(struct inode *inode, struct file *filp, unsigned int cmd,
unsigned long arg)
{
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_irq_wait_t irqwait;
diff --git a/linux-core/i915_drv.c b/linux-core/i915_drv.c
index 007c9b94..6cb27743 100644
--- a/linux-core/i915_drv.c
+++ b/linux-core/i915_drv.c
@@ -28,7 +28,7 @@ int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -65,6 +65,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_I915_CMDBUFFER)] = {i915_cmdbuffer, 1, 0}
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -83,35 +84,34 @@ static struct drm_driver driver = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init i915_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit i915_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(i915_init);
diff --git a/linux-core/mach64_drv.c b/linux-core/mach64_drv.c
index c70ce061..e1be1fa8 100644
--- a/linux-core/mach64_drv.c
+++ b/linux-core/mach64_drv.c
@@ -42,7 +42,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -81,6 +81,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_MACH64_GETPARAM)] = {mach64_get_param, 1, 0},
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_HAVE_DMA
@@ -100,35 +101,35 @@ static struct drm_driver driver = {
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = mach64_dma_buffers,
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
static int __init mach64_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit mach64_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(mach64_init);
diff --git a/linux-core/mga_drv.c b/linux-core/mga_drv.c
index 415619c9..6e90e5dc 100644
--- a/linux-core/mga_drv.c
+++ b/linux-core/mga_drv.c
@@ -49,7 +49,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -84,6 +84,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_MGA_GETPARAM)] = {mga_getparam, 1, 0},
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
@@ -105,35 +106,35 @@ static struct drm_driver driver = {
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = mga_dma_buffers,
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
static int __init mga_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit mga_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(mga_init);
diff --git a/linux-core/r128_drv.c b/linux-core/r128_drv.c
index 741e6990..31ee1aaa 100644
--- a/linux-core/r128_drv.c
+++ b/linux-core/r128_drv.c
@@ -45,7 +45,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -93,6 +93,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_R128_GETPARAM)] = {r128_getparam, 1, 0},
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -115,36 +116,35 @@ static struct drm_driver driver = {
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = r128_cce_buffers,
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- }
- ,
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
static int __init r128_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit r128_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(r128_init);
diff --git a/linux-core/radeon_drv.c b/linux-core/radeon_drv.c
index 978ba1de..dbf530f6 100644
--- a/linux-core/radeon_drv.c
+++ b/linux-core/radeon_drv.c
@@ -45,7 +45,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -128,6 +128,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_RADEON_SETPARAM)] = {radeon_cp_setparam, 1, 0},
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_PCI_DMA | DRIVER_SG |
@@ -155,36 +156,34 @@ static struct drm_driver driver = {
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.dma_ioctl = radeon_cp_buffers,
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- }
- ,
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init radeon_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit radeon_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(radeon_init);
diff --git a/linux-core/savage_drv.c b/linux-core/savage_drv.c
index 833812f9..ffec6e73 100644
--- a/linux-core/savage_drv.c
+++ b/linux-core/savage_drv.c
@@ -251,7 +251,7 @@ static int postinit( struct drm_device *dev, unsigned long flags )
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
DRIVER_DATE,
- dev->minor,
+ dev->primary.minor,
pci_pretty_name(dev->pdev)
);
return 0;
@@ -282,6 +282,7 @@ static drm_ioctl_desc_t ioctls[] = {
#endif
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
.reclaim_buffers = drm_core_reclaim_buffers,
@@ -300,28 +301,27 @@ static struct drm_driver driver = {
.mmap = drm_mmap,
.fasync = drm_fasync,
},
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init savage_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit savage_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(savage_init);
diff --git a/linux-core/sis_drv.c b/linux-core/sis_drv.c
index 69ca3929..f5168473 100644
--- a/linux-core/sis_drv.c
+++ b/linux-core/sis_drv.c
@@ -39,7 +39,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -70,6 +70,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_SIS_FB_INIT)] = {sis_fb_init, 1, 1}
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features = DRIVER_USE_AGP | DRIVER_USE_MTRR,
.context_ctor = sis_init_context,
@@ -82,35 +83,34 @@ static struct drm_driver driver = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init sis_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit sis_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(sis_init);
diff --git a/linux-core/tdfx_drv.c b/linux-core/tdfx_drv.c
index 488bbcb4..66d57284 100644
--- a/linux-core/tdfx_drv.c
+++ b/linux-core/tdfx_drv.c
@@ -43,7 +43,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -65,6 +65,7 @@ static struct pci_device_id pciidlist[] = {
tdfx_PCI_IDS
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features = DRIVER_USE_MTRR,
.reclaim_buffers = drm_core_reclaim_buffers,
@@ -73,35 +74,35 @@ static struct drm_driver driver = {
.postinit = postinit,
.version = version,
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
static int __init tdfx_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit tdfx_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(tdfx_init);
diff --git a/shared-core/via_drv.c b/shared-core/via_drv.c
index 994e9959..d22932ec 100644
--- a/shared-core/via_drv.c
+++ b/shared-core/via_drv.c
@@ -36,7 +36,7 @@ static int postinit(struct drm_device *dev, unsigned long flags)
DRIVER_MAJOR,
DRIVER_MINOR,
DRIVER_PATCHLEVEL,
- DRIVER_DATE, dev->minor, pci_pretty_name(dev->pdev)
+ DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
);
return 0;
}
@@ -71,6 +71,7 @@ static drm_ioctl_desc_t ioctls[] = {
[DRM_IOCTL_NR(DRM_VIA_PCICMD)] = {via_pci_cmdbuffer, 1, 0}
};
+static int probe(struct pci_dev *pdev, const struct pci_device_id *ent);
static struct drm_driver driver = {
.driver_features =
DRIVER_USE_AGP | DRIVER_USE_MTRR | DRIVER_HAVE_IRQ |
@@ -90,35 +91,34 @@ static struct drm_driver driver = {
.ioctls = ioctls,
.num_ioctls = DRM_ARRAY_SIZE(ioctls),
.fops = {
- .owner = THIS_MODULE,
- .open = drm_open,
- .release = drm_release,
- .ioctl = drm_ioctl,
- .mmap = drm_mmap,
- .fasync = drm_fasync,
- },
+ .owner = THIS_MODULE,
+ .open = drm_open,
+ .release = drm_release,
+ .ioctl = drm_ioctl,
+ .mmap = drm_mmap,
+ .fasync = drm_fasync,
+ },
+ .pci_driver = {
+ .name = DRIVER_NAME,
+ .id_table = pciidlist,
+ .probe = probe,
+ .remove = __devexit_p(drm_cleanup_pci),
+ }
};
static int probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{
- return drm_probe(pdev, ent, &driver);
+ return drm_get_dev(pdev, ent, &driver);
}
-static struct pci_driver pci_driver = {
- .name = DRIVER_NAME,
- .id_table = pciidlist,
- .probe = probe,
- .remove = __devexit_p(drm_cleanup_pci),
-};
-
static int __init via_init(void)
{
- return drm_init(&pci_driver, pciidlist, &driver);
+ return drm_init(&driver, pciidlist);
}
static void __exit via_exit(void)
{
- drm_exit(&pci_driver);
+ drm_exit(&driver);
}
module_init(via_init);