mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-06 18:09:56 +00:00
fbdev: Allow client to request a particular /dev/fbN node
Add a flag custom_fb_num to denote that the client has requested a specific fbdev node number via node. Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
This commit is contained in:
committed by
Dom Cobley
parent
1494472cc1
commit
c91c9f257d
@@ -33,6 +33,7 @@ struct class *fb_class;
|
|||||||
DEFINE_MUTEX(registration_lock);
|
DEFINE_MUTEX(registration_lock);
|
||||||
struct fb_info *registered_fb[FB_MAX] __read_mostly;
|
struct fb_info *registered_fb[FB_MAX] __read_mostly;
|
||||||
int num_registered_fb __read_mostly;
|
int num_registered_fb __read_mostly;
|
||||||
|
int min_dynamic_fb __read_mostly;
|
||||||
#define for_each_registered_fb(i) \
|
#define for_each_registered_fb(i) \
|
||||||
for (i = 0; i < FB_MAX; i++) \
|
for (i = 0; i < FB_MAX; i++) \
|
||||||
if (!registered_fb[i]) {} else
|
if (!registered_fb[i]) {} else
|
||||||
@@ -445,9 +446,11 @@ static int do_register_framebuffer(struct fb_info *fb_info)
|
|||||||
if (num_registered_fb == FB_MAX)
|
if (num_registered_fb == FB_MAX)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
||||||
for (i = 0 ; i < FB_MAX; i++)
|
if (!fb_info->custom_fb_num || fb_info->node >= FB_MAX || registered_fb[fb_info->node]) {
|
||||||
if (!registered_fb[i])
|
for (i = min_dynamic_fb ; i < FB_MAX; i++)
|
||||||
break;
|
if (!registered_fb[i])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (i >= FB_MAX)
|
if (i >= FB_MAX)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
@@ -460,7 +463,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
|
|||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
fb_info->node = i;
|
|
||||||
refcount_set(&fb_info->count, 1);
|
refcount_set(&fb_info->count, 1);
|
||||||
mutex_init(&fb_info->lock);
|
mutex_init(&fb_info->lock);
|
||||||
mutex_init(&fb_info->mm_lock);
|
mutex_init(&fb_info->mm_lock);
|
||||||
@@ -560,6 +562,12 @@ static void do_unregister_framebuffer(struct fb_info *fb_info)
|
|||||||
put_fb_info(fb_info);
|
put_fb_info(fb_info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fb_set_lowest_dynamic_fb(int min_fb_dev)
|
||||||
|
{
|
||||||
|
min_dynamic_fb = min_fb_dev;
|
||||||
|
}
|
||||||
|
EXPORT_SYMBOL(fb_set_lowest_dynamic_fb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* register_framebuffer - registers a frame buffer device
|
* register_framebuffer - registers a frame buffer device
|
||||||
* @fb_info: frame buffer info structure
|
* @fb_info: frame buffer info structure
|
||||||
|
|||||||
@@ -516,6 +516,7 @@ struct fb_info {
|
|||||||
|
|
||||||
bool skip_vt_switch; /* no VT switch on suspend/resume required */
|
bool skip_vt_switch; /* no VT switch on suspend/resume required */
|
||||||
bool skip_panic; /* Do not write to the fb after a panic */
|
bool skip_panic; /* Do not write to the fb after a panic */
|
||||||
|
bool custom_fb_num; /* Use value in node as the preferred node number */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* This will go away
|
/* This will go away
|
||||||
@@ -605,6 +606,7 @@ extern ssize_t fb_sys_write(struct fb_info *info, const char __user *buf,
|
|||||||
.fb_imageblit = sys_imageblit
|
.fb_imageblit = sys_imageblit
|
||||||
|
|
||||||
/* fbmem.c */
|
/* fbmem.c */
|
||||||
|
extern void fb_set_lowest_dynamic_fb(int min_fb_dev);
|
||||||
extern int register_framebuffer(struct fb_info *fb_info);
|
extern int register_framebuffer(struct fb_info *fb_info);
|
||||||
extern void unregister_framebuffer(struct fb_info *fb_info);
|
extern void unregister_framebuffer(struct fb_info *fb_info);
|
||||||
extern int devm_register_framebuffer(struct device *dev, struct fb_info *fb_info);
|
extern int devm_register_framebuffer(struct device *dev, struct fb_info *fb_info);
|
||||||
|
|||||||
Reference in New Issue
Block a user