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
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 b0a2e7383c
commit 891d093a76
3 changed files with 7 additions and 8 deletions

View File

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

View File

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

View File

@@ -6651,7 +6651,7 @@ compile_test() {
# Determine if the 'class' structure devnode function pointer # Determine if the 'class' structure devnode function pointer
# has const 'struct dev' argument. # 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 # take a const *") updated the class_register function to take a
# const class structure in Linux v6.2. # const class structure in Linux v6.2.
# #