drm: inline drm_pci_set_unique
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Sun, 3 Nov 2013 20:47:18 +0000 (21:47 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Wed, 23 Apr 2014 08:32:51 +0000 (10:32 +0200)
This is only used for drm versions 1.0, and kms drivers have never
been there. So we can appropriately restrict this to legacy and hence
pci devices and inline everything.

v2: Make the dummy function actually return something, caught by Wu
Fengguang's 0-day tester.

v3: Fix spelling in comment (Thierry)

Reviewed-by: Thierry Reding <treding@nvidia.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/drm_ioctl.c
drivers/gpu/drm/drm_pci.c
include/drm/drmP.h

index 93a42040bedb38a2bd21c4a8409a6ad83081674f..53560ef53f990233cc5db598c986d7fa169b9ce9 100644 (file)
@@ -93,7 +93,8 @@ drm_unset_busid(struct drm_device *dev,
  * 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
  * 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,
                  struct drm_file *file_priv)
@@ -108,10 +109,13 @@ int drm_setunique(struct drm_device *dev, void *data,
        if (!u->unique_len || u->unique_len > 1024)
                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;
 
-       ret = dev->driver->bus->set_unique(dev, master, u);
+       ret = drm_pci_set_unique(dev, master, u);
        if (ret)
                goto err;
 
index eff29e311f70b8c12a46388fb7e31b22ab1e11fc..c550b349f2024aef900ddf11fad2132279c87c46 100644 (file)
@@ -185,9 +185,9 @@ err:
        return ret;
 }
 
-static int drm_pci_set_unique(struct drm_device *dev,
-                             struct drm_master *master,
-                             struct drm_unique *u)
+int drm_pci_set_unique(struct drm_device *dev,
+                      struct drm_master *master,
+                      struct drm_unique *u)
 {
        int domain, bus, slot, func, ret;
        const char *bus_name;
@@ -314,7 +314,6 @@ void drm_pci_agp_destroy(struct drm_device *dev)
 static struct drm_bus drm_pci_bus = {
        .get_name = drm_pci_get_name,
        .set_busid = drm_pci_set_busid,
-       .set_unique = drm_pci_set_unique,
 };
 
 /**
@@ -481,6 +480,13 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
 {
        return -EINVAL;
 }
+
+int drm_pci_set_unique(struct drm_device *dev,
+                      struct drm_master *master,
+                      struct drm_unique *u)
+{
+       return -EINVAL;
+}
 #endif
 
 EXPORT_SYMBOL(drm_pci_init);
index f4d0eaa3da46577d82eb6071c27f6f30aa4d5e0c..1a9d509bef66d6ed0fdaa13507bbfcf0df457013 100644 (file)
@@ -728,8 +728,6 @@ struct drm_master {
 struct drm_bus {
        const char *(*get_name)(struct drm_device *dev);
        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);
 };
 
 /**
@@ -1511,6 +1509,9 @@ extern drm_dma_handle_t *drm_pci_alloc(struct drm_device *dev, size_t size,
                                       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 int drm_pci_set_unique(struct drm_device *dev,
+                             struct drm_master *master,
+                             struct drm_unique *u);
 
                               /* sysfs support (drm_sysfs.c) */
 struct drm_sysfs_class;