summaryrefslogtreecommitdiff
path: root/sys/dev/pci/drm/sis_drv.c
diff options
context:
space:
mode:
authorOwain Ainsworth <oga@cvs.openbsd.org>2008-11-22 21:26:49 +0000
committerOwain Ainsworth <oga@cvs.openbsd.org>2008-11-22 21:26:49 +0000
commitefaaf8fdb0ae277917aee89ce3717ef1fa793fa0 (patch)
tree1b5628ae32f72b00560a9f3eb1394e984b21d2e0 /sys/dev/pci/drm/sis_drv.c
parente352ee055ffd21c59021f5da76de929ac5cd366e (diff)
Move the drm drivers over from:
vga1 at pci0 inteldrm0 at vga1 to vga1 at pci0 inteldrm0 at vga1 drm0 at inteldrm0 i.e. a similar scheme to audio(4) where the interface attaches on top of the wildly different drivers. This helps to clean up the code a lot (more is coming) and help me start to move drm to being essentially bus independent, which will help in the future.
Diffstat (limited to 'sys/dev/pci/drm/sis_drv.c')
-rw-r--r--sys/dev/pci/drm/sis_drv.c28
1 files changed, 12 insertions, 16 deletions
diff --git a/sys/dev/pci/drm/sis_drv.c b/sys/dev/pci/drm/sis_drv.c
index f847a80ef19..91d8c2fda9b 100644
--- a/sys/dev/pci/drm/sis_drv.c
+++ b/sys/dev/pci/drm/sis_drv.c
@@ -65,38 +65,34 @@ static const struct drm_driver_info sis_driver = {
int
sisdrm_probe(struct device *parent, void *match, void *aux)
{
- return drm_probe((struct pci_attach_args *)aux, sis_pciidlist);
+ return drm_pciprobe((struct pci_attach_args *)aux, sis_pciidlist);
}
void
sisdrm_attach(struct device *parent, struct device *self, void *aux)
{
- struct pci_attach_args *pa = aux;
- struct drm_device *dev = (struct drm_device *)self;
- drm_sis_private_t *dev_priv = dev->dev_private;
+ drm_sis_private_t *dev_priv = (drm_sis_private_t *)self;
+ struct pci_attach_args *pa = aux;
- dev_priv = drm_calloc(1, sizeof(*dev_priv), DRM_MEM_DRIVER);
- dev->dev_private = dev_priv;
-
- dev->driver = &sis_driver;
- return drm_attach(parent, self, pa);
+ dev_priv->drmdev = drm_attach_mi(&sis_driver, pa, parent, self);
}
int
sisdrm_detach(struct device *self, int flags)
{
- struct drm_device *dev = (struct drm_device *)self;
- drm_sis_private_t *dev_priv = dev->dev_private;
+ drm_sis_private_t *dev_priv = (drm_sis_private_t *)self;
- drm_free(dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER);
- dev->dev_private = NULL;
+ if (dev_priv->drmdev != NULL) {
+ config_detach(dev_priv->drmdev, flags);
+ dev_priv->drmdev = NULL;
+ }
- return (drm_detach(self, flags));
+ return (0);
}
struct cfattach sisdrm_ca = {
- sizeof(struct drm_device), sisdrm_probe, sisdrm_attach,
- sisdrm_detach, drm_activate
+ sizeof(drm_sis_private_t), sisdrm_probe, sisdrm_attach,
+ sisdrm_detach
};
struct cfdriver sisdrm_cd = {