- fbdev-honor-the-return-value-of-device_create_file.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled

     fbdev: Honor the return value of device_create_file

has been removed from the -mm tree.  Its filename is

     fbdev-honor-the-return-value-of-device_create_file.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
Subject: fbdev: Honor the return value of device_create_file
From: "Antonino A. Daplas" <adaplas@xxxxxxxxx>

Check the return value of device_create_file().  If return is 'fail', remove
attributes by calling device_remove_file().

Signed-off-by: Antonino Daplas <adaplas@xxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

 drivers/video/fbsysfs.c |   35 ++++++++++++++++++++++++++++-------
 include/linux/fb.h      |    1 +
 2 files changed, 29 insertions(+), 7 deletions(-)

diff -puN drivers/video/fbsysfs.c~fbdev-honor-the-return-value-of-device_create_file drivers/video/fbsysfs.c
--- a/drivers/video/fbsysfs.c~fbdev-honor-the-return-value-of-device_create_file
+++ a/drivers/video/fbsysfs.c
@@ -20,6 +20,8 @@
 #include <linux/console.h>
 #include <linux/module.h>
 
+#define FB_SYSFS_FLAG_ATTR 1
+
 /**
  * framebuffer_alloc - creates a new frame buffer info structure
  *
@@ -483,12 +485,27 @@ static struct class_device_attribute cla
 
 int fb_init_class_device(struct fb_info *fb_info)
 {
-	unsigned int i;
+	int i, error = 0;
+
 	class_set_devdata(fb_info->class_device, fb_info);
 
-	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_create_file(fb_info->class_device,
-					 &class_device_attrs[i]);
+	fb_info->class_flag |= FB_SYSFS_FLAG_ATTR;
+
+	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++) {
+		error = class_device_create_file(fb_info->class_device,
+						 &class_device_attrs[i]);
+
+		if (error)
+			break;
+	}
+
+	if (error) {
+		while (--i >= 0)
+			class_device_remove_file(fb_info->class_device,
+						 &class_device_attrs[i]);
+		fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
+	}
+
 	return 0;
 }
 
@@ -496,9 +513,13 @@ void fb_cleanup_class_device(struct fb_i
 {
 	unsigned int i;
 
-	for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
-		class_device_remove_file(fb_info->class_device,
-					 &class_device_attrs[i]);
+	if (fb_info->class_flag & FB_SYSFS_FLAG_ATTR) {
+		for (i = 0; i < ARRAY_SIZE(class_device_attrs); i++)
+			class_device_remove_file(fb_info->class_device,
+						 &class_device_attrs[i]);
+
+		fb_info->class_flag &= ~FB_SYSFS_FLAG_ATTR;
+	}
 }
 
 #ifdef CONFIG_FB_BACKLIGHT
diff -puN include/linux/fb.h~fbdev-honor-the-return-value-of-device_create_file include/linux/fb.h
--- a/include/linux/fb.h~fbdev-honor-the-return-value-of-device_create_file
+++ a/include/linux/fb.h
@@ -776,6 +776,7 @@ struct fb_info {
 	struct fb_ops *fbops;
 	struct device *device;
 	struct class_device *class_device; /* sysfs per device attrs */
+	int class_flag;                    /* private sysfs flags */
 #ifdef CONFIG_FB_TILEBLITTING
 	struct fb_tile_ops *tileops;    /* Tile Blitting */
 #endif
_

Patches currently in -mm which might be from adaplas@xxxxxxxxx are

origin.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Newbies FAQ]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Photo]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux