media: camera: Use conftest for devnode

Use confest in the camera CDI and ISC drivers to determine if the
'devnode' function pointer under the class structure to take a const
device struct.

Also fix the commit in conftest that introduced the change to the
'devnode' function pointer.

Bug 4346767

Change-Id: I66de39e079c13219e0ff3e7154c0e7ceb609a29d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3034763
(cherry picked from commit 891d093a76)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037031
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Jon Hunter
2023-12-14 11:46:19 +00:00
committed by mobile promotions
parent e1471516b0
commit 020bdeded8
3 changed files with 7 additions and 8 deletions

View File

@@ -1487,10 +1487,10 @@ static struct cdi_mgr_platform_data *of_cdi_mgr_pdata(struct platform_device
return pd;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0)
static char *cdi_mgr_devnode(struct device *dev, umode_t *mode)
#else
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */
static char *cdi_mgr_devnode(const struct device *dev, umode_t *mode)
#else
static char *cdi_mgr_devnode(struct device *dev, umode_t *mode)
#endif
{
if (!mode)

View File

@@ -18,7 +18,6 @@
#include <asm/siginfo.h>
#include <linux/rcupdate.h>
#include <linux/sched.h>
#include <linux/version.h>
#include <linux/sched/signal.h>
#include <linux/uaccess.h>
#include <linux/atomic.h>
@@ -957,10 +956,10 @@ static struct isc_mgr_platform_data *of_isc_mgr_pdata(struct platform_device
return pd;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 2, 0))
static char *isc_mgr_devnode(struct device *dev, umode_t *mode)
#else
#if defined(NV_CLASS_STRUCT_DEVNODE_HAS_CONST_DEV_ARG) /* Linux v6.2 */
static char *isc_mgr_devnode(const struct device *dev, umode_t *mode)
#else
static char *isc_mgr_devnode(struct device *dev, umode_t *mode)
#endif
{
if (!mode)

View File

@@ -6521,7 +6521,7 @@ compile_test() {
# Determine if the 'class' structure devnode function pointer
# has const 'struct dev' argument.
#
# Commit 43a7206b0963 ("driver core: class: make class_register()
# Commit ff62b8e6588f ("driver core: make struct class.devnode()
# take a const *") updated the class_register function to take a
# const class structure in Linux v6.2.
#