i2c: Use conftest to find return type of .remove of i2c_driver struct

Use conftest to determine the return type of .remove() of
struct i2c_driver is int or void type instead of kernel version.

The return type got changed with commmit ed5c2f5fd10d ("i2c:
Make remove callback return void")

Bug 4387902

Change-Id: Id64466613156e0efaf6cce7492d70cab1c1d1af7
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3036799
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Laxman Dewangan
2023-12-18 09:44:26 +00:00
committed by mobile promotions
parent 2ce1e851bb
commit 1eab65044c
26 changed files with 99 additions and 81 deletions

View File

@@ -1216,7 +1216,7 @@ destroy_lock:
return status; return status;
} }
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int f75308_remove(struct i2c_client *client) static int f75308_remove(struct i2c_client *client)
#else #else
static void f75308_remove(struct i2c_client *client) static void f75308_remove(struct i2c_client *client)
@@ -1225,7 +1225,7 @@ static void f75308_remove(struct i2c_client *client)
struct f75308_priv *priv = dev_get_drvdata(&client->dev); struct f75308_priv *priv = dev_get_drvdata(&client->dev);
mutex_destroy(&priv->locker); mutex_destroy(&priv->locker);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -310,7 +310,7 @@ exit:
return ret; return ret;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if !defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void nvvrs11_remove(struct i2c_client *client) static void nvvrs11_remove(struct i2c_client *client)
{ {
nvvrs11_delete_sys_files(&client->dev); nvvrs11_delete_sys_files(&client->dev);

View File

@@ -2785,7 +2785,7 @@ exit:
devm_kfree(dev, ptr); \ devm_kfree(dev, ptr); \
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int cam_remove(struct i2c_client *client) static int cam_remove(struct i2c_client *client)
#else #else
static void cam_remove(struct i2c_client *client) static void cam_remove(struct i2c_client *client)
@@ -2799,7 +2799,7 @@ static void cam_remove(struct i2c_client *client)
if (!s_data) { if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n"); dev_err(&client->dev, "camera common data is NULL\n");
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -2811,7 +2811,7 @@ static void cam_remove(struct i2c_client *client)
reset_gpio = of_get_named_gpio(node, "reset-gpios", 0); reset_gpio = of_get_named_gpio(node, "reset-gpios", 0);
if (reset_gpio < 0) { if (reset_gpio < 0) {
dev_err(&client->dev, "Unable to get reset GPIO\n"); dev_err(&client->dev, "Unable to get reset GPIO\n");
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;

View File

@@ -733,7 +733,7 @@ static int lt6911uxc_probe(struct i2c_client *client,
return 0; return 0;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int lt6911uxc_remove(struct i2c_client *client) static int lt6911uxc_remove(struct i2c_client *client)
#else #else
static void lt6911uxc_remove(struct i2c_client *client) static void lt6911uxc_remove(struct i2c_client *client)
@@ -743,7 +743,7 @@ static void lt6911uxc_remove(struct i2c_client *client)
struct lt6911uxc *priv; struct lt6911uxc *priv;
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -753,7 +753,7 @@ static void lt6911uxc_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -514,7 +514,7 @@ static int max9295_probe(struct i2c_client *client,
return err; return err;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max9295_remove(struct i2c_client *client) static int max9295_remove(struct i2c_client *client)
#else #else
static void max9295_remove(struct i2c_client *client) static void max9295_remove(struct i2c_client *client)
@@ -528,7 +528,7 @@ static void max9295_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
client = NULL; client = NULL;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -894,7 +894,7 @@ static int max9296_probe(struct i2c_client *client,
return 0; return 0;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max9296_remove(struct i2c_client *client) static int max9296_remove(struct i2c_client *client)
#else #else
static void max9296_remove(struct i2c_client *client) static void max9296_remove(struct i2c_client *client)
@@ -908,7 +908,7 @@ static void max9296_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
client = NULL; client = NULL;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -268,7 +268,7 @@ static int max96712_probe(struct i2c_client *client,
return err; return err;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int max96712_remove(struct i2c_client *client) static int max96712_remove(struct i2c_client *client)
#else #else
static void max96712_remove(struct i2c_client *client) static void max96712_remove(struct i2c_client *client)
@@ -279,7 +279,7 @@ static void max96712_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
client = NULL; client = NULL;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1151,7 +1151,7 @@ static int ar0234_probe(struct i2c_client *client,
return 0; return 0;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int ar0234_remove(struct i2c_client *client) static int ar0234_remove(struct i2c_client *client)
#else #else
static void ar0234_remove(struct i2c_client *client) static void ar0234_remove(struct i2c_client *client)
@@ -1161,7 +1161,7 @@ static void ar0234_remove(struct i2c_client *client)
struct ar0234 *priv; struct ar0234 *priv;
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -1171,7 +1171,7 @@ static void ar0234_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
ar0234_eeprom_device_release(priv); ar0234_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1575,7 +1575,7 @@ un_register:
return err; return err;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int ar0234_remove(struct i2c_client *client) static int ar0234_remove(struct i2c_client *client)
#else #else
static void ar0234_remove(struct i2c_client *client) static void ar0234_remove(struct i2c_client *client)
@@ -1585,7 +1585,7 @@ static void ar0234_remove(struct i2c_client *client)
struct ar0234 *priv = (struct ar0234 *)s_data->priv; struct ar0234 *priv = (struct ar0234 *)s_data->priv;
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -1593,7 +1593,7 @@ static void ar0234_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
ar0234_eeprom_device_release(priv); ar0234_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -840,11 +840,11 @@ static int imx185_probe(struct i2c_client *client,
return 0; return 0;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void static int
imx185_remove(struct i2c_client *client) imx185_remove(struct i2c_client *client)
#else #else
static int static void
imx185_remove(struct i2c_client *client) imx185_remove(struct i2c_client *client)
#endif #endif
{ {
@@ -852,17 +852,17 @@ imx185_remove(struct i2c_client *client)
struct imx185 *priv; struct imx185 *priv;
if (!s_data) if (!s_data)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return;
#else
return -EINVAL; return -EINVAL;
#else
return;
#endif #endif
priv = (struct imx185 *)s_data->priv; priv = (struct imx185 *)s_data->priv;
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -756,10 +756,10 @@ static int imx219_probe(struct i2c_client *client,
return 0; return 0;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void imx219_remove(struct i2c_client *client)
#else
static int imx219_remove(struct i2c_client *client) static int imx219_remove(struct i2c_client *client)
#else
static void imx219_remove(struct i2c_client *client)
#endif #endif
{ {
struct camera_common_data *s_data = to_camera_common_data(&client->dev); struct camera_common_data *s_data = to_camera_common_data(&client->dev);
@@ -767,7 +767,7 @@ static int imx219_remove(struct i2c_client *client)
if (!s_data) { if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n"); dev_err(&client->dev, "camera common data is NULL\n");
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -778,7 +778,7 @@ static int imx219_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1335,20 +1335,20 @@ static int imx274_probe(struct i2c_client *client,
return 0; return 0;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void imx274_remove(struct i2c_client *client)
#else
static int imx274_remove(struct i2c_client *client) static int imx274_remove(struct i2c_client *client)
#else
static void imx274_remove(struct i2c_client *client)
#endif #endif
{ {
struct camera_common_data *s_data = to_camera_common_data(&client->dev); struct camera_common_data *s_data = to_camera_common_data(&client->dev);
struct imx274 *priv; struct imx274 *priv;
if (!s_data) if (!s_data)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return;
#else
return -EINVAL; return -EINVAL;
#else
return;
#endif #endif
priv = (struct imx274 *)s_data->priv; priv = (struct imx274 *)s_data->priv;
@@ -1360,7 +1360,7 @@ static int imx274_remove(struct i2c_client *client)
imx274_eeprom_device_release(priv); imx274_eeprom_device_release(priv);
mutex_destroy(&priv->streaming_lock); mutex_destroy(&priv->streaming_lock);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -761,7 +761,7 @@ static int imx318_probe(struct i2c_client *client,
return 0; return 0;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx318_remove(struct i2c_client *client) static int imx318_remove(struct i2c_client *client)
#else #else
static void imx318_remove(struct i2c_client *client) static void imx318_remove(struct i2c_client *client)
@@ -771,7 +771,7 @@ static void imx318_remove(struct i2c_client *client)
struct imx318 *priv; struct imx318 *priv;
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -782,7 +782,7 @@ static void imx318_remove(struct i2c_client *client)
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
imx318_eeprom_device_release(priv); imx318_eeprom_device_release(priv);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -856,7 +856,7 @@ static int imx390_probe(struct i2c_client *client,
return 0; return 0;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int imx390_remove(struct i2c_client *client) static int imx390_remove(struct i2c_client *client)
#else #else
static void imx390_remove(struct i2c_client *client) static void imx390_remove(struct i2c_client *client)
@@ -866,7 +866,7 @@ static void imx390_remove(struct i2c_client *client)
struct imx390 *priv; struct imx390 *priv;
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -880,7 +880,7 @@ static void imx390_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -782,10 +782,10 @@ static int imx477_probe(struct i2c_client *client,
return 0; return 0;
} }
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void imx477_remove(struct i2c_client *client)
#else
static int imx477_remove(struct i2c_client *client) static int imx477_remove(struct i2c_client *client)
#else
static void imx477_remove(struct i2c_client *client)
#endif #endif
{ {
struct camera_common_data *s_data = to_camera_common_data(&client->dev); struct camera_common_data *s_data = to_camera_common_data(&client->dev);
@@ -793,7 +793,7 @@ static int imx477_remove(struct i2c_client *client)
if (!s_data) { if (!s_data) {
dev_err(&client->dev, "camera common data is NULL\n"); dev_err(&client->dev, "camera common data is NULL\n");
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -803,7 +803,7 @@ static int imx477_remove(struct i2c_client *client)
tegracam_v4l2subdev_unregister(priv->tc_dev); tegracam_v4l2subdev_unregister(priv->tc_dev);
tegracam_device_unregister(priv->tc_dev); tegracam_device_unregister(priv->tc_dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1238,7 +1238,7 @@ fail:
return err; return err;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int static int
ov5693_remove(struct i2c_client *client) ov5693_remove(struct i2c_client *client)
#else #else
@@ -1250,7 +1250,7 @@ ov5693_remove(struct i2c_client *client)
struct camera_common_data *s_data = to_camera_common_data(&client->dev); struct camera_common_data *s_data = to_camera_common_data(&client->dev);
if (!s_data) if (!s_data)
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return -EINVAL; return -EINVAL;
#else #else
return; return;
@@ -1266,7 +1266,7 @@ ov5693_remove(struct i2c_client *client)
ov5693_eeprom_device_release(priv); ov5693_eeprom_device_release(priv);
mutex_destroy(&priv->streaming_lock); mutex_destroy(&priv->streaming_lock);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -310,7 +310,7 @@ static int pca9570_probe(struct i2c_client *client,
return err; return err;
} }
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int pca9570_remove(struct i2c_client *client) static int pca9570_remove(struct i2c_client *client)
#else #else
static void pca9570_remove(struct i2c_client *client) static void pca9570_remove(struct i2c_client *client)
@@ -321,7 +321,7 @@ static void pca9570_remove(struct i2c_client *client)
client = NULL; client = NULL;
} }
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -106,7 +106,7 @@ err_parent:
return ret; return ret;
} }
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int virtual_i2c_mux_remove(struct i2c_client *client) static int virtual_i2c_mux_remove(struct i2c_client *client)
#else #else
static void virtual_i2c_mux_remove(struct i2c_client *client) static void virtual_i2c_mux_remove(struct i2c_client *client)
@@ -116,7 +116,7 @@ static void virtual_i2c_mux_remove(struct i2c_client *client)
i2c_mux_del_adapters(muxc); i2c_mux_del_adapters(muxc);
i2c_put_adapter(muxc->parent); i2c_put_adapter(muxc->parent);
#if (KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE) #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -807,7 +807,7 @@ static int cdi_dev_probe(struct i2c_client *client,
return 0; return 0;
} }
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int cdi_dev_remove(struct i2c_client *client) static int cdi_dev_remove(struct i2c_client *client)
#else #else
static void cdi_dev_remove(struct i2c_client *client) static void cdi_dev_remove(struct i2c_client *client)
@@ -828,7 +828,7 @@ static void cdi_dev_remove(struct i2c_client *client)
if (info->cdev.dev) if (info->cdev.dev)
cdev_del(&info->cdev); cdev_del(&info->cdev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -514,7 +514,7 @@ static int isc_dev_probe(struct i2c_client *client,
return 0; return 0;
} }
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static int isc_dev_remove(struct i2c_client *client) static int isc_dev_remove(struct i2c_client *client)
#else #else
static void isc_dev_remove(struct i2c_client *client) static void isc_dev_remove(struct i2c_client *client)
@@ -535,7 +535,7 @@ static void isc_dev_remove(struct i2c_client *client)
if (info->cdev.dev) if (info->cdev.dev)
cdev_del(&info->cdev); cdev_del(&info->cdev);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1476,27 +1476,27 @@ destroy_workqueue:
return ret; return ret;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void fusb301_remove(struct i2c_client *client)
#else
static int fusb301_remove(struct i2c_client *client) static int fusb301_remove(struct i2c_client *client)
#else
static void fusb301_remove(struct i2c_client *client)
#endif #endif
{ {
struct fusb301_chip *chip = i2c_get_clientdata(client); struct fusb301_chip *chip = i2c_get_clientdata(client);
struct device *cdev = &client->dev; struct device *cdev = &client->dev;
if (!chip) if (!chip)
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return;
#else
return -ENODEV; return -ENODEV;
#else
return;
#endif #endif
sysfs_remove_group(&cdev->kobj, &fusb_sysfs_group); sysfs_remove_group(&cdev->kobj, &fusb_sysfs_group);
destroy_workqueue(chip->cc_wq); destroy_workqueue(chip->cc_wq);
mutex_destroy(&chip->mlock); mutex_destroy(&chip->mlock);
wakeup_source_unregister(chip->wlock); wakeup_source_unregister(chip->wlock);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1310,10 +1310,10 @@ static int max_gmsl_dp_ser_probe(struct i2c_client *client)
return ret; return ret;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void max_gmsl_dp_ser_remove(struct i2c_client *client)
#else
static int max_gmsl_dp_ser_remove(struct i2c_client *client) static int max_gmsl_dp_ser_remove(struct i2c_client *client)
#else
static void max_gmsl_dp_ser_remove(struct i2c_client *client)
#endif #endif
{ {
struct max_gmsl_dp_ser_priv *priv = i2c_get_clientdata(client); struct max_gmsl_dp_ser_priv *priv = i2c_get_clientdata(client);
@@ -1321,7 +1321,7 @@ static int max_gmsl_dp_ser_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
gpiod_set_value_cansleep(priv->gpiod_pwrdn, 0); gpiod_set_value_cansleep(priv->gpiod_pwrdn, 0);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -300,10 +300,10 @@ static int maxim_gmsl_hdmi_ser_probe(struct i2c_client *client)
return 0; return 0;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void maxim_gmsl_hdmi_ser_remove(struct i2c_client *client)
#else
static int maxim_gmsl_hdmi_ser_remove(struct i2c_client *client) static int maxim_gmsl_hdmi_ser_remove(struct i2c_client *client)
#else
static void maxim_gmsl_hdmi_ser_remove(struct i2c_client *client)
#endif #endif
{ {
struct maxim_gmsl_hdmi_ser_priv *priv = i2c_get_clientdata(client); struct maxim_gmsl_hdmi_ser_priv *priv = i2c_get_clientdata(client);
@@ -311,7 +311,7 @@ static int maxim_gmsl_hdmi_ser_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
gpio_set_value(priv->ser_pwrdn, 0); gpio_set_value(priv->ser_pwrdn, 0);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -1014,10 +1014,10 @@ static int ti_fpdlink_dp_ser_probe(struct i2c_client *client)
return ret; return ret;
} }
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
static void ti_fpdlink_dp_ser_remove(struct i2c_client *client)
#else
static int ti_fpdlink_dp_ser_remove(struct i2c_client *client) static int ti_fpdlink_dp_ser_remove(struct i2c_client *client)
#else
static void ti_fpdlink_dp_ser_remove(struct i2c_client *client)
#endif #endif
{ {
struct ti_fpdlink_dp_ser_priv *priv = i2c_get_clientdata(client); struct ti_fpdlink_dp_ser_priv *priv = i2c_get_clientdata(client);
@@ -1025,7 +1025,7 @@ static int ti_fpdlink_dp_ser_remove(struct i2c_client *client)
i2c_unregister_device(client); i2c_unregister_device(client);
gpiod_set_value_cansleep(priv->gpiod_pwrdn, 0); gpiod_set_value_cansleep(priv->gpiod_pwrdn, 0);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE #if defined(NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT) /* Linux 6.1 */
return 0; return 0;
#endif #endif
} }

View File

@@ -121,6 +121,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_file_rcu_has_double_ptr_file_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages NV_CONFTEST_FUNCTION_COMPILE_TESTS += get_user_pages
NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_probe_without_i2c_device_id_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_probe_without_i2c_device_id_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_has_probe_new NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_has_probe_new
NV_CONFTEST_FUNCTION_COMPILE_TESTS += i2c_driver_struct_remove_return_type_int
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock NV_CONFTEST_FUNCTION_COMPILE_TESTS += iio_dev_opaque_has_mlock
NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg NV_CONFTEST_FUNCTION_COMPILE_TESTS += iommu_map_has_gfp_arg
NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit NV_CONFTEST_FUNCTION_COMPILE_TESTS += kthread_complete_and_exit

View File

@@ -5434,6 +5434,23 @@ compile_test() {
compile_check_conftest "$CODE" "NV_I2C_DRIVER_STRUCT_HAS_PROBE_NEW" "" "types" compile_check_conftest "$CODE" "NV_I2C_DRIVER_STRUCT_HAS_PROBE_NEW" "" "types"
;; ;;
i2c_driver_struct_remove_return_type_int)
#
# Determine if return type of .remove function of struct i2c_driver is int or void.
#
# The return type of .remove is changed with commit ed5c2f5fd10dda ("i2c: Make
# remove callback return void") in Linux 6.1.
#
CODE="
#define _LINUX_EFI_H
#include <linux/i2c.h>
int conftest_i2c_i2c_driver_struct_remove_return_type_int(struct i2c_driver *i2cd) {
return i2cd->remove(NULL);
}"
compile_check_conftest "$CODE" "NV_I2C_DRIVER_STRUCT_REMOVE_RETURN_TYPE_INT" "" "types"
;;
of_get_named_gpio) of_get_named_gpio)
# #
# Determine if of_get_named_gpio() function is present # Determine if of_get_named_gpio() function is present