From ca226dcb124b19caf19ae8ec31c8c00f7ec6f74b Mon Sep 17 00:00:00 2001 From: wangxiaofeng Date: Thu, 19 Oct 2023 15:31:43 +0800 Subject: [PATCH] modify wl2868c driver to adapt new return value -The '.remove' function return void on new kernel version -modify wl2868c driver to adapt this. Change-Id: I9c37607f4c0588b890c489e5f95054d559ce5233 Signed-off-by: wangxiaofeng Reviewed-on: https://gerrit.mot.com/2772224 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Reviewed-by: Zhichao Chen Reviewed-by: wangdp11 Reviewed-by: Pengfei Qiao Reviewed-by: Zhenxin Xi Submit-Approved: Jira Key --- drivers/regulator/wl2868c/wl2868c-regulator.c | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/regulator/wl2868c/wl2868c-regulator.c b/drivers/regulator/wl2868c/wl2868c-regulator.c index 2c7723352c8e..67709f8226ce 100644 --- a/drivers/regulator/wl2868c/wl2868c-regulator.c +++ b/drivers/regulator/wl2868c/wl2868c-regulator.c @@ -19,6 +19,7 @@ #include #include #include +#include #include "wl2868c-regulator.h" static int ldo_chipid = -1; enum slg51000_regulators { @@ -442,6 +443,24 @@ static void wl2868c_i2c_shutdown(struct i2c_client *client) } } +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 0)) +static void wl2868c_i2c_remove(struct i2c_client *client) +{ + struct wl2868c *chip = i2c_get_clientdata(client); + struct gpio_desc *desc; + + if (chip->chip_cs_pin > 0) { + desc = gpio_to_desc(chip->chip_cs_pin); + gpiod_direction_output_raw(desc, GPIOF_INIT_LOW); + } + + if (NULL != chip->vio_reg) { + regulator_disable(chip->vio_reg); + regulator_put(chip->vio_reg); + } + +} +#else static int wl2868c_i2c_remove(struct i2c_client *client) { struct wl2868c *chip = i2c_get_clientdata(client); @@ -460,6 +479,7 @@ static int wl2868c_i2c_remove(struct i2c_client *client) return ret; } +#endif static const struct i2c_device_id wl2868c_i2c_id[] = { {"wl2868c", 0},