Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 38055
b: refs/heads/master
c: 1a6600b
h: refs/heads/master
i:
  38053: 83fd819
  38051: 8e41071
  38047: 2b42231
v: v3
  • Loading branch information
Antonino A. Daplas authored and Linus Torvalds committed Oct 3, 2006
1 parent 774416e commit 9783419
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 928e964f262b522dad57483108f62d87c52ccf82
refs/heads/master: 1a6600be3e5dafe2ddcc5d969d931c2591eed896
35 changes: 28 additions & 7 deletions trunk/drivers/video/fbsysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -483,22 +485,41 @@ static struct class_device_attribute class_device_attrs[] = {

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;
}

void fb_cleanup_class_device(struct fb_info *fb_info)
{
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
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fb.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9783419

Please sign in to comment.