v4l2: v4l2_compat: Move `open*()` flag check into function

This commit moves the check that determines whether the mode argument of
`open*()` exists into a separate function.

With that, the check is fixed because previously it failed to account
for the fact that `O_TMPFILE` is not a power of two.

Furthermore, add `assert()`s in the fortified variants that ensure that
no mode is required by the specified flags.

Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
1 file changed