[02/10] drm: Use dev->name as fallback for dev->unique
diff mbox

Message ID 1459331120-27864-3-git-send-email-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter March 30, 2016, 9:45 a.m. UTC
Lots of arm drivers get this wrong and for most arm boards this is the
right thing actually. And anyway with most loaders you want to chase
sysfs links anyway to figure out which dri device you want.

This will fix dmesg noise for rockchip and sti.

Cc: Ilia Mirkin <imirkin@alum.mit.edu>
Reported-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c     | 12 +++++-------
 drivers/gpu/drm/vgem/vgem_drv.c |  2 --
 2 files changed, 5 insertions(+), 9 deletions(-)

Comments

Emil Velikov March 30, 2016, 10:43 a.m. UTC | #1
On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Lots of arm drivers get this wrong and for most arm boards this is the
> right thing actually. And anyway with most loaders you want to chase
> sysfs links anyway to figure out which dri device you want.
>
> This will fix dmesg noise for rockchip and sti.
>
Fwiw I still hope to finish libdrm-2 (hint importing kernel headers),
which will remove the biggest user of these legacy ioctls. This way we
might even nuke all these lovelies from the kernel. I doubt you'll
object against the idea, will you ?

-Emil
Daniel Vetter April 26, 2016, 11:12 a.m. UTC | #2
On Wed, Mar 30, 2016 at 11:43:52AM +0100, Emil Velikov wrote:
> On 30 March 2016 at 10:45, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Lots of arm drivers get this wrong and for most arm boards this is the
> > right thing actually. And anyway with most loaders you want to chase
> > sysfs links anyway to figure out which dri device you want.
> >
> > This will fix dmesg noise for rockchip and sti.
> >
> Fwiw I still hope to finish libdrm-2 (hint importing kernel headers),
> which will remove the biggest user of these legacy ioctls. This way we
> might even nuke all these lovelies from the kernel. I doubt you'll
> object against the idea, will you ?

We can't nuke this lovelies from the kernel for another 5-10 years since
old userspace needs to keep working :(

Feel like r-b-stamping this patch?
-Daniel

Patch
diff mbox

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 8ce2a0c59116..3ecd1368c23a 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -134,16 +134,14 @@  static int drm_set_busid(struct drm_device *dev, struct drm_file *file_priv)
 			drm_unset_busid(dev, master);
 			return ret;
 		}
-	} else {
-		if (WARN(dev->unique == NULL,
-			 "No drm_driver.set_busid() implementation provided by "
-			 "%ps. Use drm_dev_set_unique() to set the unique "
-			 "name explicitly.", dev->driver))
-			return -EINVAL;
-
+	} else if (dev->unique) {
 		master->unique = kstrdup(dev->unique, GFP_KERNEL);
 		if (master->unique)
 			master->unique_len = strlen(dev->unique);
+	} else {
+		master->unique = kstrdup(dev->driver->name, GFP_KERNEL);
+		if (master->unique)
+			master->unique_len = strlen(dev->driver->name);
 	}
 
 	return 0;
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index ae4de36d1d83..d61a547fa3c9 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -260,8 +260,6 @@  static int __init vgem_init(void)
 		goto out;
 	}
 
-	drm_dev_set_unique(vgem_device, "vgem");
-
 	ret  = drm_dev_register(vgem_device, 0);
 
 	if (ret)