From efaaf8fdb0ae277917aee89ce3717ef1fa793fa0 Mon Sep 17 00:00:00 2001 From: Owain Ainsworth Date: Sat, 22 Nov 2008 21:26:49 +0000 Subject: 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. --- sys/dev/pci/drm/sis_drv.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) (limited to 'sys/dev/pci/drm/sis_drv.c') 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 = { -- cgit v1.2.3