summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2002-10-08 08:29:47 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2002-10-08 08:29:47 +0000
commita653224403a9c85b1406697e725226e0d477042a (patch)
tree5bd4246f78239f808e4ed25168a1bab20444c513
parent381e0fe7f8ee5a9500fdb91d83ce45915b64db5f (diff)
Call pci_enable_device() in DRM(irq_busid).
-rw-r--r--linux-core/drm_ioctl.c17
-rw-r--r--linux/drm_ioctl.h17
2 files changed, 30 insertions, 4 deletions
diff --git a/linux-core/drm_ioctl.c b/linux-core/drm_ioctl.c
index 0d8a1259a..945340c71 100644
--- a/linux-core/drm_ioctl.c
+++ b/linux-core/drm_ioctl.c
@@ -32,6 +32,7 @@
#define __NO_VERSION__
#include "drmP.h"
+
int DRM(irq_busid)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
@@ -41,8 +42,20 @@ int DRM(irq_busid)(struct inode *inode, struct file *filp,
if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p)))
return -EFAULT;
dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum));
- if (dev) p.irq = dev->irq;
- else p.irq = 0;
+ if (!dev) {
+ DRM_ERROR("pci_find_slot failed for %d:%d:%d\n",
+ p.busnum, p.devnum, p.funcnum);
+ p.irq = 0;
+ goto out;
+ }
+ if (!pci_enable_device(dev)) {
+ DRM_ERROR("pci_enable_device failed for %d:%d:%d\n",
+ p.busnum, p.devnum, p.funcnum);
+ p.irq = 0;
+ goto out;
+ }
+ p.irq = dev->irq;
+ out:
DRM_DEBUG("%d:%d:%d => IRQ %d\n",
p.busnum, p.devnum, p.funcnum, p.irq);
if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p)))
diff --git a/linux/drm_ioctl.h b/linux/drm_ioctl.h
index 0d8a1259a..945340c71 100644
--- a/linux/drm_ioctl.h
+++ b/linux/drm_ioctl.h
@@ -32,6 +32,7 @@
#define __NO_VERSION__
#include "drmP.h"
+
int DRM(irq_busid)(struct inode *inode, struct file *filp,
unsigned int cmd, unsigned long arg)
{
@@ -41,8 +42,20 @@ int DRM(irq_busid)(struct inode *inode, struct file *filp,
if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p)))
return -EFAULT;
dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum));
- if (dev) p.irq = dev->irq;
- else p.irq = 0;
+ if (!dev) {
+ DRM_ERROR("pci_find_slot failed for %d:%d:%d\n",
+ p.busnum, p.devnum, p.funcnum);
+ p.irq = 0;
+ goto out;
+ }
+ if (!pci_enable_device(dev)) {
+ DRM_ERROR("pci_enable_device failed for %d:%d:%d\n",
+ p.busnum, p.devnum, p.funcnum);
+ p.irq = 0;
+ goto out;
+ }
+ p.irq = dev->irq;
+ out:
DRM_DEBUG("%d:%d:%d => IRQ %d\n",
p.busnum, p.devnum, p.funcnum, p.irq);
if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p)))