Skip to content

Commit 7156b86

Browse files
authored
Merge pull request #39 from hungyuhang/master
Fix build failures with Linux v6.8+
2 parents d39b6ea + d6e9d4b commit 7156b86

File tree

2 files changed

+21
-8
lines changed

2 files changed

+21
-8
lines changed

fb.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include "fb.h"
99

1010
struct vcamfb_info {
11-
struct fb_info info;
11+
struct fb_info *info;
1212
void *addr;
1313
unsigned int offset;
1414
char name[FB_NAME_MAXLENGTH];
@@ -363,7 +363,10 @@ int vcamfb_init(struct vcam_device *dev)
363363
/* malloc vcamfb_info */
364364
fb_data = vmalloc(sizeof(struct vcamfb_info));
365365
dev->fb_priv = (void *) fb_data;
366-
info = &fb_data->info;
366+
367+
/* malloc fb_info */
368+
fb_data->info = framebuffer_alloc(0, &dev->vdev.dev);
369+
info = fb_data->info;
367370

368371
/* malloc framebuffer and init framebuffer */
369372
size = dev->input_format.sizeimage * 2;
@@ -402,8 +405,6 @@ int vcamfb_init(struct vcam_device *dev)
402405
info->fbops = &vcamfb_ops;
403406
info->par = dev;
404407
info->pseudo_palette = NULL;
405-
info->flags = FBINFO_FLAG_DEFAULT;
406-
info->device = &dev->vdev.dev;
407408
INIT_LIST_HEAD(&info->modelist);
408409

409410
/* set the fb_cmap */
@@ -428,25 +429,33 @@ int vcamfb_init(struct vcam_device *dev)
428429

429430
fb_alloc_failure:
430431
fb_dealloc_cmap(&info->cmap);
432+
framebuffer_release(info);
431433
return -EINVAL;
432434
}
433435

434436
void vcamfb_destroy(struct vcam_device *dev)
435437
{
436438
struct vcamfb_info *fb_data = (struct vcamfb_info *) dev->fb_priv;
437-
struct fb_info *info = &fb_data->info;
439+
struct fb_info *info;
440+
441+
if (!fb_data)
442+
return;
443+
444+
info = fb_data->info;
438445
if (info) {
439446
unregister_framebuffer(info);
440-
vfree(fb_data->addr);
441447
fb_dealloc_cmap(&info->cmap);
442-
vfree(dev->fb_priv);
448+
framebuffer_release(info);
443449
}
450+
451+
vfree(fb_data->addr);
452+
vfree(fb_data);
444453
}
445454

446455
void vcamfb_update(struct vcam_device *dev)
447456
{
448457
struct vcamfb_info *fb_data = (struct vcamfb_info *) dev->fb_priv;
449-
struct fb_info *info = &fb_data->info;
458+
struct fb_info *info = fb_data->info;
450459
struct vcam_in_queue *q = &dev->in_queue;
451460

452461
/* remalloc the framebuffer and vcam_in_queue */

videobuf.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ int vcam_out_videobuf2_setup(struct vcam_device *dev)
135135
q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
136136
q->ops = &vcam_vb2_ops;
137137
q->mem_ops = &vb2_vmalloc_memops;
138+
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 8, 0)
139+
q->min_queued_buffers = 2;
140+
#else
138141
q->min_buffers_needed = 2;
142+
#endif
139143
q->lock = &dev->vcam_mutex;
140144

141145
return vb2_queue_init(q);

0 commit comments

Comments
 (0)