提交 444c9a08 编写于 作者: D Dave Airlie

Merge branch 'drm-init-cleanup' of git://people.freedesktop.org/~danvet/drm into drm-next

Next pull request, this time more of the drm de-midlayering work. The big
thing is that his patch series here removes everything from drm_bus except
the set_busid callback. Thierry has a few more patches on top of this to
make that one optional to.

With that we can ditch all the non-pci drm_bus implementations, which
Thierry has already done for the fake tegra host1x drm_bus.

Reviewed by Thierry, Laurent and David and now also survived some testing
on my intel boxes to make sure the irq fumble is fixed correctly ;-) The
last minute rebase was just to add the r-b tags from Thierry for the 2
patches I've redone.

* 'drm-init-cleanup' of git://people.freedesktop.org/~danvet/drm:
  drm/<drivers>: don't set driver->dev_priv_size to 0
  drm: Remove dev->kdriver
  drm: remove drm_bus->get_name
  drm: rip out dev->devname
  drm: inline drm_pci_set_unique
  drm: remove bus->get_irq implementations
  drm: pass the irq explicitly to drm_irq_install
  drm/irq: Look up the pci irq directly in the drm_control ioctl
  drm/irq: track the irq installed in drm_irq_install in dev->irq
  drm: rename dev->count_lock to dev->buf_lock
  drm: Rip out totally bogus vga_switcheroo->can_switch locking
  drm: kill drm_bus->bus_type
  drm: remove drm_dev_to_irq from drivers
  drm/irq: remove cargo-culted locking from irq_install/uninstall
  drm/irq: drm_control is a legacy ioctl, so pci devices only
  drm/pci: fold in irq_by_busid support
  drm/irq: simplify irq checks in drm_wait_vblank
...@@ -341,14 +341,6 @@ char *date;</synopsis> ...@@ -341,14 +341,6 @@ char *date;</synopsis>
</para> </para>
<sect4> <sect4>
<title>Managed IRQ Registration</title> <title>Managed IRQ Registration</title>
<para>
Both the <function>drm_irq_install</function> and
<function>drm_irq_uninstall</function> functions get the device IRQ by
calling <function>drm_dev_to_irq</function>. This inline function will
call a bus-specific operation to retrieve the IRQ number. For platform
devices, <function>platform_get_irq</function>(..., 0) is used to
retrieve the IRQ number.
</para>
<para> <para>
<function>drm_irq_install</function> starts by calling the <function>drm_irq_install</function> starts by calling the
<methodname>irq_preinstall</methodname> driver operation. The operation <methodname>irq_preinstall</methodname> driver operation. The operation
...@@ -356,7 +348,7 @@ char *date;</synopsis> ...@@ -356,7 +348,7 @@ char *date;</synopsis>
clearing all pending interrupt flags or disabling the interrupt. clearing all pending interrupt flags or disabling the interrupt.
</para> </para>
<para> <para>
The IRQ will then be requested by a call to The passed-in IRQ will then be requested by a call to
<function>request_irq</function>. If the DRIVER_IRQ_SHARED driver <function>request_irq</function>. If the DRIVER_IRQ_SHARED driver
feature flag is set, a shared (IRQF_SHARED) IRQ handler will be feature flag is set, a shared (IRQF_SHARED) IRQ handler will be
requested. requested.
......
...@@ -173,7 +173,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -173,7 +173,7 @@ static int armada_drm_load(struct drm_device *dev, unsigned long flags)
if (ret) if (ret)
goto err_kms; goto err_kms;
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
if (ret) if (ret)
goto err_kms; goto err_kms;
......
...@@ -198,7 +198,6 @@ static const struct file_operations ast_fops = { ...@@ -198,7 +198,6 @@ static const struct file_operations ast_fops = {
static struct drm_driver driver = { static struct drm_driver driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM, .driver_features = DRIVER_MODESET | DRIVER_GEM,
.dev_priv_size = 0,
.load = ast_driver_load, .load = ast_driver_load,
.unload = ast_driver_unload, .unload = ast_driver_unload,
......
...@@ -656,13 +656,13 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) ...@@ -656,13 +656,13 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request)
DRM_DEBUG("zone invalid\n"); DRM_DEBUG("zone invalid\n");
return -EINVAL; return -EINVAL;
} }
spin_lock(&dev->count_lock); spin_lock(&dev->buf_lock);
if (dev->buf_use) { if (dev->buf_use) {
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
return -EBUSY; return -EBUSY;
} }
atomic_inc(&dev->buf_alloc); atomic_inc(&dev->buf_alloc);
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
entry = &dma->bufs[order]; entry = &dma->bufs[order];
...@@ -805,13 +805,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) ...@@ -805,13 +805,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request)
page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
total = PAGE_SIZE << page_order; total = PAGE_SIZE << page_order;
spin_lock(&dev->count_lock); spin_lock(&dev->buf_lock);
if (dev->buf_use) { if (dev->buf_use) {
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
return -EBUSY; return -EBUSY;
} }
atomic_inc(&dev->buf_alloc); atomic_inc(&dev->buf_alloc);
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
entry = &dma->bufs[order]; entry = &dma->bufs[order];
...@@ -1015,13 +1015,13 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request ...@@ -1015,13 +1015,13 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request
if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
return -EINVAL; return -EINVAL;
spin_lock(&dev->count_lock); spin_lock(&dev->buf_lock);
if (dev->buf_use) { if (dev->buf_use) {
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
return -EBUSY; return -EBUSY;
} }
atomic_inc(&dev->buf_alloc); atomic_inc(&dev->buf_alloc);
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
mutex_lock(&dev->struct_mutex); mutex_lock(&dev->struct_mutex);
entry = &dma->bufs[order]; entry = &dma->bufs[order];
...@@ -1175,7 +1175,7 @@ int drm_addbufs(struct drm_device *dev, void *data, ...@@ -1175,7 +1175,7 @@ int drm_addbufs(struct drm_device *dev, void *data,
* \param arg pointer to a drm_buf_info structure. * \param arg pointer to a drm_buf_info structure.
* \return zero on success or a negative number on failure. * \return zero on success or a negative number on failure.
* *
* Increments drm_device::buf_use while holding the drm_device::count_lock * Increments drm_device::buf_use while holding the drm_device::buf_lock
* lock, preventing of allocating more buffers after this call. Information * lock, preventing of allocating more buffers after this call. Information
* about each requested buffer is then copied into user space. * about each requested buffer is then copied into user space.
*/ */
...@@ -1196,13 +1196,13 @@ int drm_infobufs(struct drm_device *dev, void *data, ...@@ -1196,13 +1196,13 @@ int drm_infobufs(struct drm_device *dev, void *data,
if (!dma) if (!dma)
return -EINVAL; return -EINVAL;
spin_lock(&dev->count_lock); spin_lock(&dev->buf_lock);
if (atomic_read(&dev->buf_alloc)) { if (atomic_read(&dev->buf_alloc)) {
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
return -EBUSY; return -EBUSY;
} }
++dev->buf_use; /* Can't allocate more after this call */ ++dev->buf_use; /* Can't allocate more after this call */
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) { for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
if (dma->bufs[i].buf_count) if (dma->bufs[i].buf_count)
...@@ -1381,13 +1381,13 @@ int drm_mapbufs(struct drm_device *dev, void *data, ...@@ -1381,13 +1381,13 @@ int drm_mapbufs(struct drm_device *dev, void *data,
if (!dma) if (!dma)
return -EINVAL; return -EINVAL;
spin_lock(&dev->count_lock); spin_lock(&dev->buf_lock);
if (atomic_read(&dev->buf_alloc)) { if (atomic_read(&dev->buf_alloc)) {
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
return -EBUSY; return -EBUSY;
} }
dev->buf_use++; /* Can't allocate more after this call */ dev->buf_use++; /* Can't allocate more after this call */
spin_unlock(&dev->count_lock); spin_unlock(&dev->buf_lock);
if (request->count >= dma->buf_count) { if (request->count >= dma->buf_count) {
if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP)) if ((dev->agp && (dma->flags & _DRM_DMA_USE_AGP))
......
...@@ -47,18 +47,16 @@ int drm_name_info(struct seq_file *m, void *data) ...@@ -47,18 +47,16 @@ int drm_name_info(struct seq_file *m, void *data)
struct drm_minor *minor = node->minor; struct drm_minor *minor = node->minor;
struct drm_device *dev = minor->dev; struct drm_device *dev = minor->dev;
struct drm_master *master = minor->master; struct drm_master *master = minor->master;
const char *bus_name;
if (!master) if (!master)
return 0; return 0;
bus_name = dev->driver->bus->get_name(dev);
if (master->unique) { if (master->unique) {
seq_printf(m, "%s %s %s\n", seq_printf(m, "%s %s %s\n",
bus_name, dev->driver->name,
dev_name(dev->dev), master->unique); dev_name(dev->dev), master->unique);
} else { } else {
seq_printf(m, "%s %s\n", seq_printf(m, "%s %s\n",
bus_name, dev_name(dev->dev)); dev->driver->name, dev_name(dev->dev));
} }
return 0; return 0;
} }
......
...@@ -72,9 +72,6 @@ static void ...@@ -72,9 +72,6 @@ static void
drm_unset_busid(struct drm_device *dev, drm_unset_busid(struct drm_device *dev,
struct drm_master *master) struct drm_master *master)
{ {
kfree(dev->devname);
dev->devname = NULL;
kfree(master->unique); kfree(master->unique);
master->unique = NULL; master->unique = NULL;
master->unique_len = 0; master->unique_len = 0;
...@@ -93,7 +90,8 @@ drm_unset_busid(struct drm_device *dev, ...@@ -93,7 +90,8 @@ drm_unset_busid(struct drm_device *dev,
* Copies the bus id from userspace into drm_device::unique, and verifies that * Copies the bus id from userspace into drm_device::unique, and verifies that
* it matches the device this DRM is attached to (EINVAL otherwise). Deprecated * it matches the device this DRM is attached to (EINVAL otherwise). Deprecated
* in interface version 1.1 and will return EBUSY when setversion has requested * in interface version 1.1 and will return EBUSY when setversion has requested
* version 1.1 or greater. * version 1.1 or greater. Also note that KMS is all version 1.1 and later and
* UMS was only ever supported on pci devices.
*/ */
int drm_setunique(struct drm_device *dev, void *data, int drm_setunique(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
...@@ -108,10 +106,13 @@ int drm_setunique(struct drm_device *dev, void *data, ...@@ -108,10 +106,13 @@ int drm_setunique(struct drm_device *dev, void *data,
if (!u->unique_len || u->unique_len > 1024) if (!u->unique_len || u->unique_len > 1024)
return -EINVAL; return -EINVAL;
if (!dev->driver->bus->set_unique) if (drm_core_check_feature(dev, DRIVER_MODESET))
return 0;
if (WARN_ON(!dev->pdev))
return -EINVAL; return -EINVAL;
ret = dev->driver->bus->set_unique(dev, master, u); ret = drm_pci_set_unique(dev, master, u);
if (ret) if (ret)
goto err; goto err;
......
...@@ -56,33 +56,6 @@ ...@@ -56,33 +56,6 @@
*/ */
#define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000 #define DRM_REDUNDANT_VBLIRQ_THRESH_NS 1000000
/**
* Get interrupt from bus id.
*
* \param inode device inode.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure.
*
* Finds the PCI device with the specified bus id and gets its IRQ number.
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to.
*/
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_irq_busid *p = data;
if (!dev->driver->bus->irq_by_busid)
return -EINVAL;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL;
return dev->driver->bus->irq_by_busid(dev, p);
}
/* /*
* Clear vblank timestamp buffer for a crtc. * Clear vblank timestamp buffer for a crtc.
*/ */
...@@ -269,34 +242,26 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state) ...@@ -269,34 +242,26 @@ static void drm_irq_vgaarb_nokms(void *cookie, bool state)
* \c irq_preinstall() and \c irq_postinstall() functions * \c irq_preinstall() and \c irq_postinstall() functions
* before and after the installation. * before and after the installation.
*/ */
int drm_irq_install(struct drm_device *dev) int drm_irq_install(struct drm_device *dev, int irq)
{ {
int ret; int ret;
unsigned long sh_flags = 0; unsigned long sh_flags = 0;
char *irqname;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL; return -EINVAL;
if (drm_dev_to_irq(dev) == 0) if (irq == 0)
return -EINVAL; return -EINVAL;
mutex_lock(&dev->struct_mutex);
/* Driver must have been initialized */ /* Driver must have been initialized */
if (!dev->dev_private) { if (!dev->dev_private)
mutex_unlock(&dev->struct_mutex);
return -EINVAL; return -EINVAL;
}
if (dev->irq_enabled) { if (dev->irq_enabled)
mutex_unlock(&dev->struct_mutex);
return -EBUSY; return -EBUSY;
}
dev->irq_enabled = true; dev->irq_enabled = true;
mutex_unlock(&dev->struct_mutex);
DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev)); DRM_DEBUG("irq=%d\n", irq);
/* Before installing handler */ /* Before installing handler */
if (dev->driver->irq_preinstall) if (dev->driver->irq_preinstall)
...@@ -306,18 +271,11 @@ int drm_irq_install(struct drm_device *dev) ...@@ -306,18 +271,11 @@ int drm_irq_install(struct drm_device *dev)
if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
sh_flags = IRQF_SHARED; sh_flags = IRQF_SHARED;
if (dev->devname) ret = request_irq(irq, dev->driver->irq_handler,
irqname = dev->devname; sh_flags, dev->driver->name, dev);
else
irqname = dev->driver->name;
ret = request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler,
sh_flags, irqname, dev);
if (ret < 0) { if (ret < 0) {
mutex_lock(&dev->struct_mutex);
dev->irq_enabled = false; dev->irq_enabled = false;
mutex_unlock(&dev->struct_mutex);
return ret; return ret;
} }
...@@ -329,12 +287,12 @@ int drm_irq_install(struct drm_device *dev) ...@@ -329,12 +287,12 @@ int drm_irq_install(struct drm_device *dev)
ret = dev->driver->irq_postinstall(dev); ret = dev->driver->irq_postinstall(dev);
if (ret < 0) { if (ret < 0) {
mutex_lock(&dev->struct_mutex);
dev->irq_enabled = false; dev->irq_enabled = false;
mutex_unlock(&dev->struct_mutex);
if (!drm_core_check_feature(dev, DRIVER_MODESET)) if (!drm_core_check_feature(dev, DRIVER_MODESET))
vga_client_register(dev->pdev, NULL, NULL, NULL); vga_client_register(dev->pdev, NULL, NULL, NULL);
free_irq(drm_dev_to_irq(dev), dev); free_irq(irq, dev);
} else {
dev->irq = irq;
} }
return ret; return ret;
...@@ -357,10 +315,8 @@ int drm_irq_uninstall(struct drm_device *dev) ...@@ -357,10 +315,8 @@ int drm_irq_uninstall(struct drm_device *dev)
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL; return -EINVAL;
mutex_lock(&dev->struct_mutex);
irq_enabled = dev->irq_enabled; irq_enabled = dev->irq_enabled;
dev->irq_enabled = false; dev->irq_enabled = false;
mutex_unlock(&dev->struct_mutex);
/* /*
* Wake up any waiters so they don't hang. * Wake up any waiters so they don't hang.
...@@ -379,7 +335,7 @@ int drm_irq_uninstall(struct drm_device *dev) ...@@ -379,7 +335,7 @@ int drm_irq_uninstall(struct drm_device *dev)
if (!irq_enabled) if (!irq_enabled)
return -EINVAL; return -EINVAL;
DRM_DEBUG("irq=%d\n", drm_dev_to_irq(dev)); DRM_DEBUG("irq=%d\n", dev->irq);
if (!drm_core_check_feature(dev, DRIVER_MODESET)) if (!drm_core_check_feature(dev, DRIVER_MODESET))
vga_client_register(dev->pdev, NULL, NULL, NULL); vga_client_register(dev->pdev, NULL, NULL, NULL);
...@@ -387,7 +343,7 @@ int drm_irq_uninstall(struct drm_device *dev) ...@@ -387,7 +343,7 @@ int drm_irq_uninstall(struct drm_device *dev)
if (dev->driver->irq_uninstall) if (dev->driver->irq_uninstall)
dev->driver->irq_uninstall(dev); dev->driver->irq_uninstall(dev);
free_irq(drm_dev_to_irq(dev), dev); free_irq(dev->irq, dev);
return 0; return 0;
} }
...@@ -408,28 +364,38 @@ int drm_control(struct drm_device *dev, void *data, ...@@ -408,28 +364,38 @@ int drm_control(struct drm_device *dev, void *data,
struct drm_file *file_priv) struct drm_file *file_priv)
{ {
struct drm_control *ctl = data; struct drm_control *ctl = data;
int ret = 0, irq;
/* if we haven't irq we fallback for compatibility reasons - /* if we haven't irq we fallback for compatibility reasons -
* this used to be a separate function in drm_dma.h * this used to be a separate function in drm_dma.h
*/ */
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return 0;
if (drm_core_check_feature(dev, DRIVER_MODESET))
return 0;
/* UMS was only ever support on pci devices. */
if (WARN_ON(!dev->pdev))
return -EINVAL;
switch (ctl->func) { switch (ctl->func) {
case DRM_INST_HANDLER: case DRM_INST_HANDLER:
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) irq = dev->pdev->irq;
return 0;
if (drm_core_check_feature(dev, DRIVER_MODESET))
return 0;
if (dev->if_version < DRM_IF_VERSION(1, 2) && if (dev->if_version < DRM_IF_VERSION(1, 2) &&
ctl->irq != drm_dev_to_irq(dev)) ctl->irq != irq)
return -EINVAL; return -EINVAL;
return drm_irq_install(dev); mutex_lock(&dev->struct_mutex);
ret = drm_irq_install(dev, irq);
mutex_unlock(&dev->struct_mutex);
return ret;
case DRM_UNINST_HANDLER: case DRM_UNINST_HANDLER:
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) mutex_lock(&dev->struct_mutex);
return 0; ret = drm_irq_uninstall(dev);
if (drm_core_check_feature(dev, DRIVER_MODESET)) mutex_unlock(&dev->struct_mutex);
return 0;
return drm_irq_uninstall(dev); return ret;
default: default:
return -EINVAL; return -EINVAL;
} }
...@@ -1160,9 +1126,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data, ...@@ -1160,9 +1126,8 @@ int drm_wait_vblank(struct drm_device *dev, void *data,
int ret; int ret;
unsigned int flags, seq, crtc, high_crtc; unsigned int flags, seq, crtc, high_crtc;
if (drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) if (!dev->irq_enabled)
if ((!drm_dev_to_irq(dev)) || (!dev->irq_enabled)) return -EINVAL;
return -EINVAL;
if (vblwait->request.type & _DRM_VBLANK_SIGNAL) if (vblwait->request.type & _DRM_VBLANK_SIGNAL)
return -EINVAL; return -EINVAL;
......
...@@ -137,21 +137,9 @@ static int drm_get_pci_domain(struct drm_device *dev) ...@@ -137,21 +137,9 @@ static int drm_get_pci_domain(struct drm_device *dev)
return pci_domain_nr(dev->pdev->bus); return pci_domain_nr(dev->pdev->bus);
} }
static int drm_pci_get_irq(struct drm_device *dev)
{
return dev->pdev->irq;
}
static const char *drm_pci_get_name(struct drm_device *dev)
{
struct pci_driver *pdriver = dev->driver->kdriver.pci;
return pdriver->name;
}
static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
{ {
int len, ret; int len, ret;
struct pci_driver *pdriver = dev->driver->kdriver.pci;
master->unique_len = 40; master->unique_len = 40;
master->unique_size = master->unique_len; master->unique_size = master->unique_len;
master->unique = kmalloc(master->unique_size, GFP_KERNEL); master->unique = kmalloc(master->unique_size, GFP_KERNEL);
...@@ -173,29 +161,16 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master) ...@@ -173,29 +161,16 @@ static int drm_pci_set_busid(struct drm_device *dev, struct drm_master *master)
} else } else
master->unique_len = len; master->unique_len = len;
dev->devname =
kmalloc(strlen(pdriver->name) +
master->unique_len + 2, GFP_KERNEL);
if (dev->devname == NULL) {
ret = -ENOMEM;
goto err;
}
sprintf(dev->devname, "%s@%s", pdriver->name,
master->unique);
return 0; return 0;
err: err:
return ret; return ret;
} }
static int drm_pci_set_unique(struct drm_device *dev, int drm_pci_set_unique(struct drm_device *dev,
struct drm_master *master, struct drm_master *master,
struct drm_unique *u) struct drm_unique *u)
{ {
int domain, bus, slot, func, ret; int domain, bus, slot, func, ret;
const char *bus_name;
master->unique_len = u->unique_len; master->unique_len = u->unique_len;
master->unique_size = u->unique_len + 1; master->unique_size = u->unique_len + 1;
...@@ -212,17 +187,6 @@ static int drm_pci_set_unique(struct drm_device *dev, ...@@ -212,17 +187,6 @@ static int drm_pci_set_unique(struct drm_device *dev,
master->unique[master->unique_len] = '\0'; master->unique[master->unique_len] = '\0';
bus_name = dev->driver->bus->get_name(dev);
dev->devname = kmalloc(strlen(bus_name) +
strlen(master->unique) + 2, GFP_KERNEL);
if (!dev->devname) {
ret = -ENOMEM;
goto err;
}
sprintf(dev->devname, "%s@%s", bus_name,
master->unique);
/* Return error if the busid submitted doesn't match the device's actual /* Return error if the busid submitted doesn't match the device's actual
* busid. * busid.
*/ */
...@@ -247,7 +211,6 @@ static int drm_pci_set_unique(struct drm_device *dev, ...@@ -247,7 +211,6 @@ static int drm_pci_set_unique(struct drm_device *dev,
return ret; return ret;
} }
static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
{ {
if ((p->busnum >> 8) != drm_get_pci_domain(dev) || if ((p->busnum >> 8) != drm_get_pci_domain(dev) ||
...@@ -262,6 +225,37 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p) ...@@ -262,6 +225,37 @@ static int drm_pci_irq_by_busid(struct drm_device *dev, struct drm_irq_busid *p)
return 0; return 0;
} }
/**
* Get interrupt from bus id.
*
* \param inode device inode.
* \param file_priv DRM file private.
* \param cmd command.
* \param arg user argument, pointing to a drm_irq_busid structure.
* \return zero on success or a negative number on failure.
*
* Finds the PCI device with the specified bus id and gets its IRQ number.
* This IOCTL is deprecated, and will now return EINVAL for any busid not equal
* to that of the device that this DRM instance attached to.
*/
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
struct drm_irq_busid *p = data;
if (drm_core_check_feature(dev, DRIVER_MODESET))
return -EINVAL;
/* UMS was only ever support on PCI devices. */
if (WARN_ON(!dev->pdev))
return -EINVAL;
if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
return -EINVAL;
return drm_pci_irq_by_busid(dev, p);
}
static void drm_pci_agp_init(struct drm_device *dev) static void drm_pci_agp_init(struct drm_device *dev)
{ {
if (drm_core_check_feature(dev, DRIVER_USE_AGP)) { if (drm_core_check_feature(dev, DRIVER_USE_AGP)) {
...@@ -287,12 +281,7 @@ void drm_pci_agp_destroy(struct drm_device *dev) ...@@ -287,12 +281,7 @@ void drm_pci_agp_destroy(struct drm_device *dev)
} }
static struct drm_bus drm_pci_bus = { static struct drm_bus drm_pci_bus = {
.bus_type = DRIVER_BUS_PCI,
.get_irq = drm_pci_get_irq,
.get_name = drm_pci_get_name,
.set_busid = drm_pci_set_busid, .set_busid = drm_pci_set_busid,
.set_unique = drm_pci_set_unique,
.irq_by_busid = drm_pci_irq_by_busid,
}; };
/** /**
...@@ -375,7 +364,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) ...@@ -375,7 +364,6 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
DRM_DEBUG("\n"); DRM_DEBUG("\n");
driver->kdriver.pci = pdriver;
driver->bus = &drm_pci_bus; driver->bus = &drm_pci_bus;
if (driver->driver_features & DRIVER_MODESET) if (driver->driver_features & DRIVER_MODESET)
...@@ -453,6 +441,19 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver) ...@@ -453,6 +441,19 @@ int drm_pci_init(struct drm_driver *driver, struct pci_driver *pdriver)
} }
void drm_pci_agp_destroy(struct drm_device *dev) {} void drm_pci_agp_destroy(struct drm_device *dev) {}
int drm_irq_by_busid(struct drm_device *dev, void *data,
struct drm_file *file_priv)
{
return -EINVAL;
}
int drm_pci_set_unique(struct drm_device *dev,
struct drm_master *master,
struct drm_unique *u)
{
return -EINVAL;
}
#endif #endif
EXPORT_SYMBOL(drm_pci_init); EXPORT_SYMBOL(drm_pci_init);
......
...@@ -68,16 +68,6 @@ static int drm_get_platform_dev(struct platform_device *platdev, ...@@ -68,16 +68,6 @@ static int drm_get_platform_dev(struct platform_device *platdev,
return ret; return ret;
} }
static int drm_platform_get_irq(struct drm_device *dev)
{
return platform_get_irq(dev->platformdev, 0);
}
static const char *drm_platform_get_name(struct drm_device *dev)
{
return dev->platformdev->name;
}
static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master) static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master)
{ {
int len, ret, id; int len, ret, id;
...@@ -106,26 +96,12 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas ...@@ -106,26 +96,12 @@ static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *mas
goto err; goto err;
} }
dev->devname =
kmalloc(strlen(dev->platformdev->name) +
master->unique_len + 2, GFP_KERNEL);
if (dev->devname == NULL) {
ret = -ENOMEM;
goto err;
}
sprintf(dev->devname, "%s@%s", dev->platformdev->name,
master->unique);
return 0; return 0;
err: err:
return ret; return ret;
} }
static struct drm_bus drm_platform_bus = { static struct drm_bus drm_platform_bus = {
.bus_type = DRIVER_BUS_PLATFORM,
.get_irq = drm_platform_get_irq,
.get_name = drm_platform_get_name,
.set_busid = drm_platform_set_busid, .set_busid = drm_platform_set_busid,
}; };
...@@ -145,7 +121,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor ...@@ -145,7 +121,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor
{ {
DRM_DEBUG("\n"); DRM_DEBUG("\n");
driver->kdriver.platform_device = platform_device;
driver->bus = &drm_platform_bus; driver->bus = &drm_platform_bus;
return drm_get_platform_dev(platform_device, driver); return drm_get_platform_dev(platform_device, driver);
} }
......
...@@ -169,9 +169,6 @@ static void drm_master_destroy(struct kref *kref) ...@@ -169,9 +169,6 @@ static void drm_master_destroy(struct kref *kref)
master->unique_len = 0; master->unique_len = 0;
} }
kfree(dev->devname);
dev->devname = NULL;
list_for_each_entry_safe(pt, next, &master->magicfree, head) { list_for_each_entry_safe(pt, next, &master->magicfree, head) {
list_del(&pt->head); list_del(&pt->head);
drm_ht_remove_item(&master->magiclist, &pt->hash_item); drm_ht_remove_item(&master->magiclist, &pt->hash_item);
...@@ -572,7 +569,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver, ...@@ -572,7 +569,7 @@ struct drm_device *drm_dev_alloc(struct drm_driver *driver,
INIT_LIST_HEAD(&dev->maplist); INIT_LIST_HEAD(&dev->maplist);
INIT_LIST_HEAD(&dev->vblank_event_list); INIT_LIST_HEAD(&dev->vblank_event_list);
spin_lock_init(&dev->count_lock); spin_lock_init(&dev->buf_lock);
spin_lock_init(&dev->event_lock); spin_lock_init(&dev->event_lock);
mutex_init(&dev->struct_mutex); mutex_init(&dev->struct_mutex);
mutex_init(&dev->ctxlist_mutex); mutex_init(&dev->ctxlist_mutex);
...@@ -651,8 +648,6 @@ static void drm_dev_release(struct kref *ref) ...@@ -651,8 +648,6 @@ static void drm_dev_release(struct kref *ref)
drm_minor_free(dev, DRM_MINOR_RENDER); drm_minor_free(dev, DRM_MINOR_RENDER);
drm_minor_free(dev, DRM_MINOR_CONTROL); drm_minor_free(dev, DRM_MINOR_CONTROL);
kfree(dev->devname);
mutex_destroy(&dev->master_mutex); mutex_destroy(&dev->master_mutex);
kfree(dev); kfree(dev);
} }
......
...@@ -36,16 +36,6 @@ int drm_get_usb_dev(struct usb_interface *interface, ...@@ -36,16 +36,6 @@ int drm_get_usb_dev(struct usb_interface *interface,
} }
EXPORT_SYMBOL(drm_get_usb_dev); EXPORT_SYMBOL(drm_get_usb_dev);
static int drm_usb_get_irq(struct drm_device *dev)
{
return 0;
}
static const char *drm_usb_get_name(struct drm_device *dev)
{
return "USB";
}
static int drm_usb_set_busid(struct drm_device *dev, static int drm_usb_set_busid(struct drm_device *dev,
struct drm_master *master) struct drm_master *master)
{ {
...@@ -53,9 +43,6 @@ static int drm_usb_set_busid(struct drm_device *dev, ...@@ -53,9 +43,6 @@ static int drm_usb_set_busid(struct drm_device *dev,
} }
static struct drm_bus drm_usb_bus = { static struct drm_bus drm_usb_bus = {
.bus_type = DRIVER_BUS_USB,
.get_irq = drm_usb_get_irq,
.get_name = drm_usb_get_name,
.set_busid = drm_usb_set_busid, .set_busid = drm_usb_set_busid,
}; };
...@@ -64,7 +51,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver) ...@@ -64,7 +51,6 @@ int drm_usb_init(struct drm_driver *driver, struct usb_driver *udriver)
int res; int res;
DRM_DEBUG("\n"); DRM_DEBUG("\n");
driver->kdriver.usb = udriver;
driver->bus = &drm_usb_bus; driver->bus = &drm_usb_bus;
res = usb_register(udriver); res = usb_register(udriver);
......
...@@ -354,7 +354,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags) ...@@ -354,7 +354,7 @@ static int psb_driver_load(struct drm_device *dev, unsigned long flags)
PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R); PSB_WVDC32(0xFFFFFFFF, PSB_INT_MASK_R);
spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags); spin_unlock_irqrestore(&dev_priv->irqmask_lock, irqflags);
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
dev->vblank_disable_allowed = true; dev->vblank_disable_allowed = true;
dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */ dev->max_vblank_count = 0xffffff; /* only 24 bits of frame count */
......
...@@ -1280,12 +1280,13 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_ ...@@ -1280,12 +1280,13 @@ static void i915_switcheroo_set_state(struct pci_dev *pdev, enum vga_switcheroo_
static bool i915_switcheroo_can_switch(struct pci_dev *pdev) static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
{ {
struct drm_device *dev = pci_get_drvdata(pdev); struct drm_device *dev = pci_get_drvdata(pdev);
bool can_switch;
spin_lock(&dev->count_lock); /*
can_switch = (dev->open_count == 0); * FIXME: open_count is protected by drm_global_mutex but that would lead to
spin_unlock(&dev->count_lock); * locking inversion with the driver load path. And the access here is
return can_switch; * completely racy anyway. So don't bother with locking for now.
*/
return dev->open_count == 0;
} }
static const struct vga_switcheroo_client_ops i915_switcheroo_ops = { static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
...@@ -1329,7 +1330,7 @@ static int i915_load_modeset_init(struct drm_device *dev) ...@@ -1329,7 +1330,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
intel_power_domains_init_hw(dev_priv); intel_power_domains_init_hw(dev_priv);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret) if (ret)
goto cleanup_gem_stolen; goto cleanup_gem_stolen;
......
...@@ -574,7 +574,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings) ...@@ -574,7 +574,7 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
/* We need working interrupts for modeset enabling ... */ /* We need working interrupts for modeset enabling ... */
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
intel_modeset_init_hw(dev); intel_modeset_init_hw(dev);
...@@ -746,8 +746,13 @@ int i915_reset(struct drm_device *dev) ...@@ -746,8 +746,13 @@ int i915_reset(struct drm_device *dev)
return ret; return ret;
} }
/*
* FIXME: This is horribly race against concurrent pageflip and
* vblank wait ioctls since they can observe dev->irqs_disabled
* being false when they shouldn't be able to.
*/
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
drm_irq_install(dev); drm_irq_install(dev, dev->pdev->irq);
/* rps/rc6 re-init is necessary to restore state lost after the /* rps/rc6 re-init is necessary to restore state lost after the
* reset and the re-install of drm irq. Skip for ironlake per * reset and the re-install of drm irq. Skip for ironlake per
......
...@@ -4523,16 +4523,15 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data, ...@@ -4523,16 +4523,15 @@ i915_gem_entervt_ioctl(struct drm_device *dev, void *data,
} }
BUG_ON(!list_empty(&dev_priv->gtt.base.active_list)); BUG_ON(!list_empty(&dev_priv->gtt.base.active_list));
mutex_unlock(&dev->struct_mutex);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret) if (ret)
goto cleanup_ringbuffer; goto cleanup_ringbuffer;
mutex_unlock(&dev->struct_mutex);
return 0; return 0;
cleanup_ringbuffer: cleanup_ringbuffer:
mutex_lock(&dev->struct_mutex);
i915_gem_cleanup_ringbuffer(dev); i915_gem_cleanup_ringbuffer(dev);
dev_priv->ums.mm_suspended = 1; dev_priv->ums.mm_suspended = 1;
mutex_unlock(&dev->struct_mutex); mutex_unlock(&dev->struct_mutex);
...@@ -4547,7 +4546,9 @@ i915_gem_leavevt_ioctl(struct drm_device *dev, void *data, ...@@ -4547,7 +4546,9 @@ i915_gem_leavevt_ioctl(struct drm_device *dev, void *data,
if (drm_core_check_feature(dev, DRIVER_MODESET)) if (drm_core_check_feature(dev, DRIVER_MODESET))
return 0; return 0;
mutex_lock(&dev->struct_mutex);
drm_irq_uninstall(dev); drm_irq_uninstall(dev);
mutex_unlock(&dev->struct_mutex);
return i915_gem_suspend(dev); return i915_gem_suspend(dev);
} }
......
...@@ -1020,7 +1020,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *fil ...@@ -1020,7 +1020,7 @@ static int mga_getparam(struct drm_device *dev, void *data, struct drm_file *fil
switch (param->param) { switch (param->param) {
case MGA_PARAM_IRQ_NR: case MGA_PARAM_IRQ_NR:
value = drm_dev_to_irq(dev); value = dev->pdev->irq;
break; break;
case MGA_PARAM_CARD_TYPE: case MGA_PARAM_CARD_TYPE:
value = dev_priv->chipset; value = dev_priv->chipset;
......
...@@ -288,7 +288,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags) ...@@ -288,7 +288,7 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
} }
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, "failed to install IRQ handler\n"); dev_err(dev->dev, "failed to install IRQ handler\n");
......
...@@ -64,12 +64,13 @@ static bool ...@@ -64,12 +64,13 @@ static bool
nouveau_switcheroo_can_switch(struct pci_dev *pdev) nouveau_switcheroo_can_switch(struct pci_dev *pdev)
{ {
struct drm_device *dev = pci_get_drvdata(pdev); struct drm_device *dev = pci_get_drvdata(pdev);
bool can_switch;
spin_lock(&dev->count_lock); /*
can_switch = (dev->open_count == 0); * FIXME: open_count is protected by drm_global_mutex but that would lead to
spin_unlock(&dev->count_lock); * locking inversion with the driver load path. And the access here is
return can_switch; * completely racy anyway. So don't bother with locking for now.
*/
return dev->open_count == 0;
} }
static const struct vga_switcheroo_client_ops static const struct vga_switcheroo_client_ops
......
...@@ -214,7 +214,6 @@ static struct pci_driver qxl_pci_driver = { ...@@ -214,7 +214,6 @@ static struct pci_driver qxl_pci_driver = {
static struct drm_driver qxl_driver = { static struct drm_driver qxl_driver = {
.driver_features = DRIVER_GEM | DRIVER_MODESET | .driver_features = DRIVER_GEM | DRIVER_MODESET |
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED, DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED,
.dev_priv_size = 0,
.load = qxl_driver_load, .load = qxl_driver_load,
.unload = qxl_driver_unload, .unload = qxl_driver_unload,
......
...@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev) ...@@ -87,7 +87,7 @@ int qxl_irq_init(struct qxl_device *qdev)
atomic_set(&qdev->irq_received_cursor, 0); atomic_set(&qdev->irq_received_cursor, 0);
atomic_set(&qdev->irq_received_io_cmd, 0); atomic_set(&qdev->irq_received_io_cmd, 0);
qdev->irq_received_error = 0; qdev->irq_received_error = 0;
ret = drm_irq_install(qdev->ddev); ret = drm_irq_install(qdev->ddev, qdev->ddev->pdev->irq);
qdev->ram_header->int_mask = QXL_INTERRUPT_MASK; qdev->ram_header->int_mask = QXL_INTERRUPT_MASK;
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
DRM_ERROR("Failed installing irq: %d\n", ret); DRM_ERROR("Failed installing irq: %d\n", ret);
......
...@@ -1594,7 +1594,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi ...@@ -1594,7 +1594,7 @@ static int r128_getparam(struct drm_device *dev, void *data, struct drm_file *fi
switch (param->param) { switch (param->param) {
case R128_PARAM_IRQ_NR: case R128_PARAM_IRQ_NR:
value = drm_dev_to_irq(dev); value = dev->pdev->irq;
break; break;
default: default:
return -EINVAL; return -EINVAL;
......
...@@ -1125,12 +1125,13 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero ...@@ -1125,12 +1125,13 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
static bool radeon_switcheroo_can_switch(struct pci_dev *pdev) static bool radeon_switcheroo_can_switch(struct pci_dev *pdev)
{ {
struct drm_device *dev = pci_get_drvdata(pdev); struct drm_device *dev = pci_get_drvdata(pdev);
bool can_switch;
spin_lock(&dev->count_lock); /*
can_switch = (dev->open_count == 0); * FIXME: open_count is protected by drm_global_mutex but that would lead to
spin_unlock(&dev->count_lock); * locking inversion with the driver load path. And the access here is
return can_switch; * completely racy anyway. So don't bother with locking for now.
*/
return dev->open_count == 0;
} }
static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = { static const struct vga_switcheroo_client_ops radeon_switcheroo_ops = {
......
...@@ -519,7 +519,6 @@ static struct drm_driver kms_driver = { ...@@ -519,7 +519,6 @@ static struct drm_driver kms_driver = {
DRIVER_USE_AGP | DRIVER_USE_AGP |
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM |
DRIVER_PRIME | DRIVER_RENDER, DRIVER_PRIME | DRIVER_RENDER,
.dev_priv_size = 0,
.load = radeon_driver_load_kms, .load = radeon_driver_load_kms,
.open = radeon_driver_open_kms, .open = radeon_driver_open_kms,
.preclose = radeon_driver_preclose_kms, .preclose = radeon_driver_preclose_kms,
......
...@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev) ...@@ -287,7 +287,7 @@ int radeon_irq_kms_init(struct radeon_device *rdev)
INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func); INIT_WORK(&rdev->reset_work, radeon_irq_reset_work_func);
rdev->irq.installed = true; rdev->irq.installed = true;
r = drm_irq_install(rdev->ddev); r = drm_irq_install(rdev->ddev, rdev->ddev->pdev->irq);
if (r) { if (r) {
rdev->irq.installed = false; rdev->irq.installed = false;
flush_work(&rdev->hotplug_work); flush_work(&rdev->hotplug_work);
......
...@@ -3054,7 +3054,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil ...@@ -3054,7 +3054,7 @@ static int radeon_cp_getparam(struct drm_device *dev, void *data, struct drm_fil
if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
value = 0; value = 0;
else else
value = drm_dev_to_irq(dev); value = dev->pdev->irq;
break; break;
case RADEON_PARAM_GART_BASE: case RADEON_PARAM_GART_BASE:
value = dev_priv->gart_vm_start; value = dev_priv->gart_vm_start;
......
...@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags) ...@@ -185,7 +185,7 @@ static int shmob_drm_load(struct drm_device *dev, unsigned long flags)
goto done; goto done;
} }
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "failed to install IRQ handler\n"); dev_err(&pdev->dev, "failed to install IRQ handler\n");
goto done; goto done;
......
...@@ -12,9 +12,7 @@ static int drm_host1x_set_busid(struct drm_device *dev, ...@@ -12,9 +12,7 @@ static int drm_host1x_set_busid(struct drm_device *dev,
struct drm_master *master) struct drm_master *master)
{ {
const char *device = dev_name(dev->dev); const char *device = dev_name(dev->dev);
const char *driver = dev->driver->name;
const char *bus = dev->dev->bus->name; const char *bus = dev->dev->bus->name;
int length;
master->unique_len = strlen(bus) + 1 + strlen(device); master->unique_len = strlen(bus) + 1 + strlen(device);
master->unique_size = master->unique_len; master->unique_size = master->unique_len;
...@@ -25,19 +23,10 @@ static int drm_host1x_set_busid(struct drm_device *dev, ...@@ -25,19 +23,10 @@ static int drm_host1x_set_busid(struct drm_device *dev,
snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device); snprintf(master->unique, master->unique_len + 1, "%s:%s", bus, device);
length = strlen(driver) + 1 + master->unique_len;
dev->devname = kmalloc(length + 1, GFP_KERNEL);
if (!dev->devname)
return -ENOMEM;
snprintf(dev->devname, length + 1, "%s@%s", driver, master->unique);
return 0; return 0;
} }
static struct drm_bus drm_host1x_bus = { static struct drm_bus drm_host1x_bus = {
.bus_type = DRIVER_BUS_HOST1X,
.set_busid = drm_host1x_set_busid, .set_busid = drm_host1x_set_busid,
}; };
......
...@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags) ...@@ -268,7 +268,7 @@ static int tilcdc_load(struct drm_device *dev, unsigned long flags)
} }
pm_runtime_get_sync(dev->dev); pm_runtime_get_sync(dev->dev);
ret = drm_irq_install(dev); ret = drm_irq_install(dev, platform_get_irq(dev->platformdev, 0));
pm_runtime_put_sync(dev->dev); pm_runtime_put_sync(dev->dev);
if (ret < 0) { if (ret < 0) {
dev_err(dev->dev, "failed to install IRQ handler\n"); dev_err(dev->dev, "failed to install IRQ handler\n");
......
...@@ -806,7 +806,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset) ...@@ -806,7 +806,7 @@ static int vmw_driver_load(struct drm_device *dev, unsigned long chipset)
} }
if (dev_priv->capabilities & SVGA_CAP_IRQMASK) { if (dev_priv->capabilities & SVGA_CAP_IRQMASK) {
ret = drm_irq_install(dev); ret = drm_irq_install(dev, dev->pdev->irq);
if (ret != 0) { if (ret != 0) {
DRM_ERROR("Failed installing irq: %d\n", ret); DRM_ERROR("Failed installing irq: %d\n", ret);
goto out_no_irq; goto out_no_irq;
......
...@@ -143,11 +143,6 @@ int drm_err(const char *func, const char *format, ...); ...@@ -143,11 +143,6 @@ int drm_err(const char *func, const char *format, ...);
#define DRIVER_PRIME 0x4000 #define DRIVER_PRIME 0x4000
#define DRIVER_RENDER 0x8000 #define DRIVER_RENDER 0x8000
#define DRIVER_BUS_PCI 0x1
#define DRIVER_BUS_PLATFORM 0x2
#define DRIVER_BUS_USB 0x3
#define DRIVER_BUS_HOST1X 0x4
/***********************************************************************/ /***********************************************************************/
/** \name Begin the DRM... */ /** \name Begin the DRM... */
/*@{*/ /*@{*/
...@@ -731,13 +726,7 @@ struct drm_master { ...@@ -731,13 +726,7 @@ struct drm_master {
#define DRM_SCANOUTPOS_ACCURATE (1 << 2) #define DRM_SCANOUTPOS_ACCURATE (1 << 2)
struct drm_bus { struct drm_bus {
int bus_type;
int (*get_irq)(struct drm_device *dev);
const char *(*get_name)(struct drm_device *dev);
int (*set_busid)(struct drm_device *dev, struct drm_master *master); int (*set_busid)(struct drm_device *dev, struct drm_master *master);
int (*set_unique)(struct drm_device *dev, struct drm_master *master,
struct drm_unique *unique);
int (*irq_by_busid)(struct drm_device *dev, struct drm_irq_busid *p);
}; };
/** /**
...@@ -974,11 +963,6 @@ struct drm_driver { ...@@ -974,11 +963,6 @@ struct drm_driver {
const struct drm_ioctl_desc *ioctls; const struct drm_ioctl_desc *ioctls;
int num_ioctls; int num_ioctls;
const struct file_operations *fops; const struct file_operations *fops;
union {
struct pci_driver *pci;
struct platform_device *platform_device;
struct usb_driver *usb;
} kdriver;
struct drm_bus *bus; struct drm_bus *bus;
/* List of devices hanging off this driver with stealth attach. */ /* List of devices hanging off this driver with stealth attach. */
...@@ -1058,7 +1042,6 @@ struct drm_vblank_crtc { ...@@ -1058,7 +1042,6 @@ struct drm_vblank_crtc {
*/ */
struct drm_device { struct drm_device {
struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */ struct list_head legacy_dev_list;/**< list of devices per driver for stealth attach cleanup */
char *devname; /**< For /proc/interrupts */
int if_version; /**< Highest interface version set */ int if_version; /**< Highest interface version set */
/** \name Lifetime Management */ /** \name Lifetime Management */
...@@ -1076,14 +1059,14 @@ struct drm_device { ...@@ -1076,14 +1059,14 @@ struct drm_device {
/** \name Locks */ /** \name Locks */
/*@{ */ /*@{ */
spinlock_t count_lock; /**< For inuse, drm_device::open_count, drm_device::buf_use */
struct mutex struct_mutex; /**< For others */ struct mutex struct_mutex; /**< For others */
struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */ struct mutex master_mutex; /**< For drm_minor::master and drm_file::is_master */
/*@} */ /*@} */
/** \name Usage Counters */ /** \name Usage Counters */
/*@{ */ /*@{ */
int open_count; /**< Outstanding files open */ int open_count; /**< Outstanding files open, protected by drm_global_mutex. */
spinlock_t buf_lock; /**< For drm_device::buf_use and a few other things. */
int buf_use; /**< Buffers in use -- cannot alloc */ int buf_use; /**< Buffers in use -- cannot alloc */
atomic_t buf_alloc; /**< Buffer allocation in progress */ atomic_t buf_alloc; /**< Buffer allocation in progress */
/*@} */ /*@} */
...@@ -1114,6 +1097,8 @@ struct drm_device { ...@@ -1114,6 +1097,8 @@ struct drm_device {
/** \name Context support */ /** \name Context support */
/*@{ */ /*@{ */
bool irq_enabled; /**< True if irq handler is enabled */ bool irq_enabled; /**< True if irq handler is enabled */
int irq;
__volatile__ long context_flag; /**< Context swapping flag */ __volatile__ long context_flag; /**< Context swapping flag */
int last_context; /**< Last current context */ int last_context; /**< Last current context */
/*@} */ /*@} */
...@@ -1186,11 +1171,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev, ...@@ -1186,11 +1171,6 @@ static __inline__ int drm_core_check_feature(struct drm_device *dev,
return ((dev->driver->driver_features & feature) ? 1 : 0); return ((dev->driver->driver_features & feature) ? 1 : 0);
} }
static inline int drm_dev_to_irq(struct drm_device *dev)
{
return dev->driver->bus->get_irq(dev);
}
static inline void drm_device_set_unplugged(struct drm_device *dev) static inline void drm_device_set_unplugged(struct drm_device *dev)
{ {
smp_wmb(); smp_wmb();
...@@ -1363,7 +1343,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev, ...@@ -1363,7 +1343,7 @@ extern void drm_core_reclaim_buffers(struct drm_device *dev,
/* IRQ support (drm_irq.h) */ /* IRQ support (drm_irq.h) */
extern int drm_control(struct drm_device *dev, void *data, extern int drm_control(struct drm_device *dev, void *data,
struct drm_file *file_priv); struct drm_file *file_priv);
extern int drm_irq_install(struct drm_device *dev); extern int drm_irq_install(struct drm_device *dev, int irq);
extern int drm_irq_uninstall(struct drm_device *dev); extern int drm_irq_uninstall(struct drm_device *dev);
extern int drm_vblank_init(struct drm_device *dev, int num_crtcs); extern int drm_vblank_init(struct drm_device *dev, int num_crtcs);
...@@ -1522,6 +1502,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size, ...@@ -1522,6 +1502,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
size_t align); size_t align);
extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); extern void __drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah); extern void drm_pci_free(struct drm_device *dev, drm_dma_handle_t * dmah);
extern int drm_pci_set_unique(struct drm_device *dev,
struct drm_master *master,
struct drm_unique *u);
/* sysfs support (drm_sysfs.c) */ /* sysfs support (drm_sysfs.c) */
struct drm_sysfs_class; struct drm_sysfs_class;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册