Take FPS driver compile error

Add check mechanism with kernel version, due to deleting gpio free api
with prefix 'devm_' on latest kernel version.

Change-Id: Idac00094e9e3d40ed806e95d37881399000a372b
Signed-off-by: Chunyu Fan <fancy3@motorola.com>
Reviewed-on: https://gerrit.mot.com/2781626
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Jichao Zou <zoujc@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
Chunyu Fan 2023-10-31 15:16:36 +08:00 • committed by Qiuliang Cheng
commit 2a79a93c1b
2 changed files with 12 additions and 0 deletions

View file

@ -8,6 +8,7 @@
* as published by the Free Software Foundation.
*/
#include <linux/version.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/gpio.h>
@ -28,6 +29,10 @@
#define RESET_HIGH_SLEEP2_MIN_US 5000
#define RESET_HIGH_SLEEP2_MAX_US (RESET_HIGH_SLEEP2_MIN_US + 100)
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 25))
#define devm_gpio_free(a, b) NULL
#endif
struct FPS_data {
unsigned int enabled;
unsigned int state;

View file

@ -13,6 +13,7 @@
* GNU General Public License for more details.
*
*/
#include <linux/version.h>
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/of_gpio.h>
@ -30,6 +31,10 @@
#include <linux/platform_device.h>
#endif
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(6, 1, 25))
#define devm_gpio_free(a, b) NULL
#endif
int gf_parse_dts(struct gf_dev *gf_dev)
{
int rc = 0;
@ -129,7 +134,9 @@ err_pwr:
void gf_cleanup(struct gf_dev *gf_dev)
{
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 25))
struct device *dev = &gf_dev->spi->dev;
#endif
pr_info("goodix: %s\n", __func__);
if (gpio_is_valid(gf_dev->irq_gpio)) {