Skip to content

FIXUP: "fbdev: Allow client to request a particular /dev/fbdevN node" #6893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions drivers/video/fbdev/core/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -446,12 +446,12 @@ static int do_register_framebuffer(struct fb_info *fb_info)
if (num_registered_fb == FB_MAX)
return -ENXIO;

i = fb_info->node;
if (!fb_info->custom_fb_num || fb_info->node >= FB_MAX || registered_fb[fb_info->node]) {
for (i = min_dynamic_fb ; i < FB_MAX; i++)
if (!registered_fb[i])
break;
}

if (!fb_info->modelist.prev || !fb_info->modelist.next)
INIT_LIST_HEAD(&fb_info->modelist);

Expand All @@ -460,7 +460,6 @@ static int do_register_framebuffer(struct fb_info *fb_info)
if (err < 0)
return err;

fb_info->node = i;
refcount_set(&fb_info->count, 1);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this deletion mean no one is ever setting fb_info->node?

Copy link
Contributor Author

@6by9 6by9 Jun 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the caller has set custom_fb_num then it is also expected to have set fb_info->node to the desired node number.

We search if:

if (!fb_info->custom_fb_num || fb_info->node >= FB_MAX || registered_fb[fb_info->node]) {

ie caller hasn't requested to use the desired number, it's too high, or already registered.

dfc8f67 is the one user of this, and sets both info->node and info->custom_fb_num.

mutex_init(&fb_info->lock);
mutex_init(&fb_info->mm_lock);
Expand Down