File add-simple_dname.diff of Package drm

---
 drivers/gpu/drm/drm_drv.c |   23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -491,8 +491,29 @@ EXPORT_SYMBOL(drm_unplug_dev);
 static int drm_fs_cnt;
 static struct vfsmount *drm_fs_mnt;
 
+static int prepend(char **buffer, int *buflen, const char *str, int namelen)
+{
+	*buflen -= namelen;
+	if (*buflen < 0)
+		return -ENAMETOOLONG;
+	*buffer -= namelen;
+	memcpy(*buffer, str, namelen);
+	return 0;
+}
+
+static char *_simple_dname(struct dentry *dentry, char *buffer, int buflen)
+{
+	char *end = buffer + buflen;
+	/* these dentries are never renamed, so d_lock is not needed */
+	if (prepend(&end, &buflen, " (deleted)", 11) ||
+	    prepend(&end, &buflen, dentry->d_name.name, dentry->d_name.len) ||
+	    prepend(&end, &buflen, "/", 1))  
+		end = ERR_PTR(-ENAMETOOLONG);
+	return end;
+}
+
 static const struct dentry_operations drm_fs_dops = {
-	.d_dname	= simple_dname,
+	.d_dname	= _simple_dname,
 };
 
 static const struct super_operations drm_fs_sops = {