From 56068ded4d8c904e1650e897872407205c9811c0 Mon Sep 17 00:00:00 2001 From: Jon Hunter Date: Sat, 6 Dec 2025 23:21:40 +0000 Subject: [PATCH] media: i2c: max967xx: Fix build for pre Linux v6.3 In Linux v6.3, commit 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") removed the ID parameter from the I2C probe function. The max96712 does not build for Linux kernels prior to Linux v6.3 because it assumes that the ID parameter has been removed. There is an existing conftest that checks to see if the probe function requires and ID parameter and so update the max967xx drivers accordingly to fix the build for kernels prior to Linux v6.3. Note we should avoid using explicit kernel version checks in out-of-tree drivers because this does not work for 3rd party kernels. Therefore, remove the kernel version.h because this is not used or needed. Bug 5277201 Change-Id: Idbc569d782a952ee9ea0a91aace54df20f50701d Signed-off-by: Jon Hunter Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3506342 Tested-by: Shawn Bai GVS: buildbot_gerritrpt Reviewed-by: Shawn Bai --- drivers/media/i2c/max96712_tpg.c | 9 +++++++-- drivers/media/i2c/max96726_tpg.c | 7 +++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/media/i2c/max96712_tpg.c b/drivers/media/i2c/max96712_tpg.c index 7c0d2a56..ce580634 100644 --- a/drivers/media/i2c/max96712_tpg.c +++ b/drivers/media/i2c/max96712_tpg.c @@ -21,8 +21,8 @@ * DEALINGS IN THE SOFTWARE. */ -/* Kernel version compatibility checks */ -#include +#include + #include #include #include @@ -605,7 +605,12 @@ static const struct v4l2_subdev_internal_ops max96712_subdev_internal_ops = { .open = max96712_open, }; +#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */ static int max96712_probe(struct i2c_client *client) +#else +static int max96712_probe(struct i2c_client *client, + const struct i2c_device_id *id) +#endif { struct device *dev = &client->dev; struct device_node *node = dev->of_node; diff --git a/drivers/media/i2c/max96726_tpg.c b/drivers/media/i2c/max96726_tpg.c index 805270ce..4a8c1fc1 100644 --- a/drivers/media/i2c/max96726_tpg.c +++ b/drivers/media/i2c/max96726_tpg.c @@ -21,6 +21,8 @@ * DEALINGS IN THE SOFTWARE. */ +#include + #include #include #include @@ -720,7 +722,12 @@ static const struct v4l2_subdev_internal_ops max96726_subdev_internal_ops = { .open = max96726_open, }; +#if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */ static int max96726_probe(struct i2c_client *client) +#else +static int max96726_probe(struct i2c_client *client, + const struct i2c_device_id *id) +#endif { struct device *dev = &client->dev; struct device_node *node = dev->of_node;