Skip to content
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

Fix v6.8 renamed symbols #84

Merged
merged 1 commit into from
Mar 25, 2024
Merged

Conversation

iam-TJ
Copy link

@iam-TJ iam-TJ commented Mar 11, 2024

Commit 80c2b40a51393 upstream renamed min_buffers_needed to min_queued_buffers

Commit 80c2b40a51393 upstream renamed min_buffers_needed to min_queued_buffers
@hipersayanX
Copy link
Member

IMO it wound be better to provide the alternative code directly, for example, instead of defining V4L2_MIN_QUEUED_BUFFERS, do:

#if LINUX_VERSION_CODE < KERNEL_VERSION( 6, 8, 0)
self->queue.min_buffers_needed = AKVCAM_BUFFERS_MIN;
#else
self->queue.min_queued_buffers = AKVCAM_BUFFERS_MIN;
#endif

Because it looks weird to see a macro as a member of a structure, it breaks code styling, and it kinda prone to error.
Defining a macro would be ok if your are replacing another macro, for example:

// This is OK

// MISSING_MACRO is undefined

#ifndef MISSING_MACRO
#define MISSING_MACRO 
#endif

If a function changed its name but still preserve it parameters, i would prefer this:

#ifdef USE_NEW_FUNC
new_func(params);
#else
func(params);
#endif

Instead of

// NO NO NO

#ifdef USE_NEW_FUNC
#define func_name new_func
#else
#define func_name func
#endif

func_name(params);

Because with the frenetic development rhythm of the kernel, they can add or remove parameters at anytime, and with the first form it make the maintenance much easier.

@hipersayanX hipersayanX merged commit ae4bf4c into webcamoid:master Mar 25, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants