aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/mga_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@starflyer.(none)>2005-11-10 06:16:34 -0500
committerDave Airlie <airlied@linux.ie>2005-11-10 06:16:34 -0500
commit22eae947bf76e236ba972f2f11cfd1b083b736ad (patch)
treee18a2cdfef9ac0f606eb249df4924fef5e7daebd /drivers/char/drm/mga_drv.c
parent3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff)
drm: rename driver hooks more understandably
Rename the driver hooks in the DRM to something a little more understandable: preinit -> load postinit -> (removed) presetup -> firstopen postsetup -> (removed) open_helper -> open prerelease -> preclose free_filp_priv -> postclose pretakedown -> lastclose postcleanup -> unload release -> reclaim_buffers_locked version -> (removed) postinit and version were replaced with generic code in the Linux DRM (drivers now set their version numbers and description in the driver structure, like on BSD). postsetup wasn't used at all. Fixes the savage hooks for initializing and tearing down mappings at the right times. Testing involved at least starting X, running glxgears, killing glxgears, exiting X, and repeating. Tested on: FreeBSD (g200, g400, r200, r128) Linux (r200, savage4) From: Eric Anholt <anholt@freebsd.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/mga_drv.c')
-rw-r--r--drivers/char/drm/mga_drv.c56
1 files changed, 13 insertions, 43 deletions
diff --git a/drivers/char/drm/mga_drv.c b/drivers/char/drm/mga_drv.c
index 0cc7c305a7f6..eae2f91994ec 100644
--- a/drivers/char/drm/mga_drv.c
+++ b/drivers/char/drm/mga_drv.c
@@ -38,41 +38,6 @@
38#include "drm_pciids.h" 38#include "drm_pciids.h"
39 39
40static int mga_driver_device_is_agp(drm_device_t * dev); 40static int mga_driver_device_is_agp(drm_device_t * dev);
41static int postinit(struct drm_device *dev, unsigned long flags)
42{
43 drm_mga_private_t *const dev_priv =
44 (drm_mga_private_t *) dev->dev_private;
45
46 dev_priv->mmio_base = pci_resource_start(dev->pdev, 1);
47 dev_priv->mmio_size = pci_resource_len(dev->pdev, 1);
48
49 dev->counters += 3;
50 dev->types[6] = _DRM_STAT_IRQ;
51 dev->types[7] = _DRM_STAT_PRIMARY;
52 dev->types[8] = _DRM_STAT_SECONDARY;
53
54 DRM_INFO("Initialized %s %d.%d.%d %s on minor %d: %s\n",
55 DRIVER_NAME,
56 DRIVER_MAJOR,
57 DRIVER_MINOR,
58 DRIVER_PATCHLEVEL,
59 DRIVER_DATE, dev->primary.minor, pci_pretty_name(dev->pdev)
60 );
61 return 0;
62}
63
64static int version(drm_version_t * version)
65{
66 int len;
67
68 version->version_major = DRIVER_MAJOR;
69 version->version_minor = DRIVER_MINOR;
70 version->version_patchlevel = DRIVER_PATCHLEVEL;
71 DRM_COPY(version->name, DRIVER_NAME);
72 DRM_COPY(version->date, DRIVER_DATE);
73 DRM_COPY(version->desc, DRIVER_DESC);
74 return 0;
75}
76 41
77static struct pci_device_id pciidlist[] = { 42static struct pci_device_id pciidlist[] = {
78 mga_PCI_IDS 43 mga_PCI_IDS
@@ -83,9 +48,9 @@ static struct drm_driver driver = {
83 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR | 48 DRIVER_USE_AGP | DRIVER_REQUIRE_AGP | DRIVER_USE_MTRR |
84 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | 49 DRIVER_HAVE_DMA | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED |
85 DRIVER_IRQ_VBL, 50 DRIVER_IRQ_VBL,
86 .preinit = mga_driver_preinit, 51 .load = mga_driver_load,
87 .postcleanup = mga_driver_postcleanup, 52 .unload = mga_driver_unload,
88 .pretakedown = mga_driver_pretakedown, 53 .lastclose = mga_driver_lastclose,
89 .dma_quiescent = mga_driver_dma_quiescent, 54 .dma_quiescent = mga_driver_dma_quiescent,
90 .device_is_agp = mga_driver_device_is_agp, 55 .device_is_agp = mga_driver_device_is_agp,
91 .vblank_wait = mga_driver_vblank_wait, 56 .vblank_wait = mga_driver_vblank_wait,
@@ -96,8 +61,6 @@ static struct drm_driver driver = {
96 .reclaim_buffers = drm_core_reclaim_buffers, 61 .reclaim_buffers = drm_core_reclaim_buffers,
97 .get_map_ofs = drm_core_get_map_ofs, 62 .get_map_ofs = drm_core_get_map_ofs,
98 .get_reg_ofs = drm_core_get_reg_ofs, 63 .get_reg_ofs = drm_core_get_reg_ofs,
99 .postinit = postinit,
100 .version = version,
101 .ioctls = mga_ioctls, 64 .ioctls = mga_ioctls,
102 .dma_ioctl = mga_dma_buffers, 65 .dma_ioctl = mga_dma_buffers,
103 .fops = { 66 .fops = {
@@ -113,9 +76,16 @@ static struct drm_driver driver = {
113#endif 76#endif
114 }, 77 },
115 .pci_driver = { 78 .pci_driver = {
116 .name = DRIVER_NAME, 79 .name = DRIVER_NAME,
117 .id_table = pciidlist, 80 .id_table = pciidlist,
118 } 81 },
82
83 .name = DRIVER_NAME,
84 .desc = DRIVER_DESC,
85 .date = DRIVER_DATE,
86 .major = DRIVER_MAJOR,
87 .minor = DRIVER_MINOR,
88 .patchlevel = DRIVER_PATCHLEVEL,
119}; 89};
120 90
121static int __init mga_init(void) 91static int __init mga_init(void)