Merge tag 'mac80211-next-for-john-2014-11-04' of git://git.kernel.org/pub/scm/linux...
[cascardo/linux.git] / drivers / gpu / drm / drm_platform.c
index d5b76f1..5314c9d 100644 (file)
@@ -68,42 +68,23 @@ err_free:
        return ret;
 }
 
-static int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master)
+int drm_platform_set_busid(struct drm_device *dev, struct drm_master *master)
 {
-       int len, ret, id;
-
-       master->unique_len = 13 + strlen(dev->platformdev->name);
-       master->unique_size = master->unique_len;
-       master->unique = kmalloc(master->unique_len + 1, GFP_KERNEL);
-
-       if (master->unique == NULL)
-               return -ENOMEM;
+       int id;
 
        id = dev->platformdev->id;
-
-       /* if only a single instance of the platform device, id will be
-        * set to -1.. use 0 instead to avoid a funny looking bus-id:
-        */
-       if (id == -1)
+       if (id < 0)
                id = 0;
 
-       len = snprintf(master->unique, master->unique_len,
-                       "platform:%s:%02d", dev->platformdev->name, id);
-
-       if (len > master->unique_len) {
-               DRM_ERROR("Unique buffer overflowed\n");
-               ret = -EINVAL;
-               goto err;
-       }
+       master->unique = kasprintf(GFP_KERNEL, "platform:%s:%02d",
+                                               dev->platformdev->name, id);
+       if (!master->unique)
+               return -ENOMEM;
 
+       master->unique_len = strlen(master->unique);
        return 0;
-err:
-       return ret;
 }
-
-static struct drm_bus drm_platform_bus = {
-       .set_busid = drm_platform_set_busid,
-};
+EXPORT_SYMBOL(drm_platform_set_busid);
 
 /**
  * drm_platform_init - Register a platform device with the DRM subsystem
@@ -120,7 +101,6 @@ int drm_platform_init(struct drm_driver *driver, struct platform_device *platfor
 {
        DRM_DEBUG("\n");
 
-       driver->bus = &drm_platform_bus;
        return drm_get_platform_dev(platform_device, driver);
 }
 EXPORT_SYMBOL(drm_platform_init);