Browse Source

touch: fix compilation errors due to kernel upgrade

The value returned by an driver's remove function is ignored
in 6.1 kernel. Modify the function's while keeping backward
compatibility.

Change-Id: I211e7ef822d9febe434b3ab45cd0c711617d85ea
Signed-off-by: jianzhou <[email protected]>
Signed-off-by: Vara Reddy <[email protected]>
Signed-off-by: Kirill Shpin <[email protected]>
Vara Reddy 2 years ago
parent
commit
10ca119f57

+ 18 - 0
atmel_mxt/atmel_mxt_ts.c

@@ -37,6 +37,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/platform_device.h>
 #include <linux/gpio.h>
+#include <linux/version.h>
 
 #ifdef CONFIG_DRM
 #include <drm/drm_panel.h>
@@ -3881,6 +3882,22 @@ err_disable_regulator:
 	return error;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+static void mxt_remove(struct i2c_client *client)
+{
+	struct mxt_data *data = i2c_get_clientdata(client);
+
+#ifdef CONFIG_DRM
+	if (active_panel && data->notifier_cookie)
+		panel_event_notifier_unregister(data->notifier_cookie);
+#endif
+	disable_irq(data->irq);
+	mxt_regulator_disable(data);
+	sysfs_remove_group(&client->dev.kobj, &mxt_attr_group);
+	mxt_free_input_device(data);
+	mxt_free_object_table(data);
+}
+#else
 static int mxt_remove(struct i2c_client *client)
 {
 	struct mxt_data *data = i2c_get_clientdata(client);
@@ -3897,6 +3914,7 @@ static int mxt_remove(struct i2c_client *client)
 
 	return 0;
 }
+#endif
 
 static int __maybe_unused mxt_suspend(struct device *dev)
 {

+ 8 - 0
goodix_berlin_driver/goodix_brl_i2c.c

@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
+#include <linux/version.h>
 
 #include "goodix_ts_core.h"
 
@@ -218,11 +219,18 @@ err_pdev:
 	return ret;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+static void goodix_i2c_remove(struct i2c_client *client)
+{
+	platform_device_unregister(goodix_pdev);
+}
+#else
 static int goodix_i2c_remove(struct i2c_client *client)
 {
 	platform_device_unregister(goodix_pdev);
 	return 0;
 }
+#endif
 
 #ifdef CONFIG_OF
 static const struct of_device_id i2c_matchs[] = {

+ 8 - 1
nt36xxx/nt36xxx.c

@@ -28,6 +28,7 @@
 #include <linux/input/mt.h>
 #include <linux/of_gpio.h>
 #include <linux/of_irq.h>
+#include <linux/version.h>
 
 #if defined(CONFIG_DRM)
 #include <linux/soc/qcom/panel_event_notifier.h>
@@ -1605,7 +1606,11 @@ err_register_fb_notif_failed:
  * return:
  *     Executive outcomes. 0---succeed.
  *******************************************************/
-static int32_t nvt_ts_remove(struct i2c_client *client)
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+static void  nvt_ts_remove(struct i2c_client *client)
+#else
+static int32_t  nvt_ts_remove(struct i2c_client *client)
+#endif
 {
 	NVT_LOG("Removing driver...\n");
 
@@ -1672,7 +1677,9 @@ static int32_t nvt_ts_remove(struct i2c_client *client)
 		ts = NULL;
 	}
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 0))
 	return 0;
+#endif
 }
 
 static void nvt_ts_shutdown(struct i2c_client *client)

+ 10 - 0
synaptics_tcm/synaptics_tcm_i2c.c

@@ -32,6 +32,7 @@
 
 #include <linux/i2c.h>
 #include <linux/of_gpio.h>
+#include <linux/version.h>
 #include "synaptics_tcm_core.h"
 #include "linux/moduleparam.h"
 
@@ -466,6 +467,14 @@ static int syna_tcm_i2c_probe(struct i2c_client *i2c,
 	return 0;
 }
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0))
+static void syna_tcm_i2c_remove(struct i2c_client *i2c)
+{
+	syna_tcm_i2c_device->dev.platform_data = NULL;
+
+	platform_device_unregister(syna_tcm_i2c_device);
+}
+#else
 static int syna_tcm_i2c_remove(struct i2c_client *i2c)
 {
 	syna_tcm_i2c_device->dev.platform_data = NULL;
@@ -474,6 +483,7 @@ static int syna_tcm_i2c_remove(struct i2c_client *i2c)
 
 	return 0;
 }
+#endif
 
 static const struct i2c_device_id syna_tcm_id_table[] = {
 	{I2C_MODULE_NAME, 0},