From 77234413d3b2d9be39e6772e00c2f6d004c39925 Mon Sep 17 00:00:00 2001 From: Zhibin Huang Date: Wed, 2 Jul 2025 11:43:49 +0800 Subject: [PATCH] input: touchscreen: hyn: reduce logs Type: Function Redmine ID: #N/A Associated modifications: N/A Test: N/A Signed-off-by: Zhibin Huang Change-Id: I3bb19f2cfdd6bcfa4978818ba52ad4097a2d782b --- drivers/input/touchscreen/hyn/hyn_core.c | 17 +++++++++-------- drivers/input/touchscreen/hyn/hyn_core.h | 11 ++++++----- .../input/touchscreen/hyn/hyn_lib/hyn_fs_node.c | 2 +- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/drivers/input/touchscreen/hyn/hyn_core.c b/drivers/input/touchscreen/hyn/hyn_core.c index c36e6a201b93..a509c19841fa 100644 --- a/drivers/input/touchscreen/hyn/hyn_core.c +++ b/drivers/input/touchscreen/hyn/hyn_core.c @@ -17,6 +17,7 @@ #include "hyn_core.h" #define HYN_DRIVER_NAME "hyn_ts" +u8 hyn_log_level; static struct hyn_ts_data *hyn_data = NULL; static const struct hyn_ts_fuc* hyn_fun = NULL; static const struct of_device_id hyn_of_match_table[] = { @@ -88,14 +89,14 @@ static int hyn_parse_dt(struct hyn_ts_data *ts_data) if (IS_ERR(dt->reset_gpio)) { ret = PTR_ERR(dt->reset_gpio); HYN_ERROR("failed to request reset GPIO: %d\n", ret); - return -EPROBE_DEFER; + return ret; } dt->irq_gpio = devm_gpiod_get(dev, "irq", GPIOD_ASIS); if (IS_ERR(dt->irq_gpio)) { ret = PTR_ERR(dt->irq_gpio); HYN_ERROR("failed to request irq GPIO: %d\n", ret); - return -EPROBE_DEFER; + return ret; } //pin_ctl ret =-1; @@ -680,7 +681,7 @@ static int hyn_ts_probe(struct spi_device *client) ts_data->bus_type = bus_type; ts_data->rp_buf.key_id = 0xFF; ts_data->work_mode = NOMAL_MODE; - ts_data->log_level = 0; + hyn_log_level = 0; hyn_data = ts_data; ts_data->client = client; @@ -869,7 +870,7 @@ static int hyn_ts_remove(struct spi_device *client) hyn_esdcheck_switch(ts_data,DISABLE); destroy_workqueue(ts_data->hyn_workqueue); } - HYN_INFO("ts_remove1"); + HYN_INFO2("ts_remove1"); #if (HYN_APK_DEBUG_EN) hyn_tool_fs_exit(); #endif @@ -878,11 +879,11 @@ static int hyn_ts_remove(struct spi_device *client) hyn_gesture_exit(ts_data); #endif hyn_release_sysfs(ts_data); - HYN_INFO("ts_remove2"); + HYN_INFO2("ts_remove2"); if (!IS_ERR_OR_NULL(ts_data->input_dev)) { input_unregister_device(ts_data->input_dev); } - HYN_INFO("ts_remove3"); + HYN_INFO2("ts_remove3"); #if 0 #if defined(CONFIG_FB) fb_unregister_client(&ts_data->fb_notif); @@ -904,7 +905,7 @@ static int hyn_ts_remove(struct spi_device *client) if (!IS_ERR_OR_NULL(ts_data->plat_data.vdd_i2c)) { regulator_put(ts_data->plat_data.vdd_i2c); } - HYN_INFO("ts_remove4"); + HYN_INFO2("ts_remove4"); #if (I2C_USE_DMA==2) if (!IS_ERR_OR_NULL(ts_data->dma_buff_va)) { dma_free_coherent(NULL, 2048, ts_data->dma_buff_va, ts_data->dma_buff_pa); @@ -912,7 +913,7 @@ static int hyn_ts_remove(struct spi_device *client) #endif kfree(ts_data); hyn_data = NULL; - HYN_INFO("ts_remove5"); + HYN_INFO2("ts_remove5"); } #if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE return 0; diff --git a/drivers/input/touchscreen/hyn/hyn_core.h b/drivers/input/touchscreen/hyn/hyn_core.h index 153047d5aa59..99d509a03ae5 100644 --- a/drivers/input/touchscreen/hyn/hyn_core.h +++ b/drivers/input/touchscreen/hyn/hyn_core.h @@ -87,12 +87,13 @@ // #define __noscs __attribute__((__no_sanitize__("shadow-call-stack"))) +extern u8 hyn_log_level; #define HYN_INFO(fmt, args...) printk(KERN_INFO "[HYN]"fmt"\n", ##args) -#define HYN_INFO2(fmt, args...) if(hyn_data->log_level > 0)printk(KERN_INFO "[HYN]"fmt"\n", ##args) -#define HYN_INFO3(fmt, args...) if(hyn_data->log_level > 1)printk(KERN_INFO "[HYN]"fmt"\n", ##args) -#define HYN_INFO4(fmt, args...) if(hyn_data->log_level > 2)printk(KERN_INFO "[HYN]"fmt"\n", ##args) -#define HYN_ERROR(fmt, args...) printk(KERN_ERR "[HYN][Error]%s:"fmt"\n",__func__,##args) -#define HYN_ENTER() printk(KERN_ERR "[HYN][enter]%s\n",__func__) +#define HYN_INFO2(fmt, args...) if (hyn_log_level > 0) printk(KERN_INFO "[HYN]"fmt"\n", ##args) +#define HYN_INFO3(fmt, args...) if (hyn_log_level > 1) printk(KERN_INFO "[HYN]"fmt"\n", ##args) +#define HYN_INFO4(fmt, args...) if (hyn_log_level > 2) printk(KERN_INFO "[HYN]"fmt"\n", ##args) +#define HYN_ERROR(fmt, args...) printk(KERN_ERR "[HYN][Error]%s:"fmt"\n", __func__, ##args) +#define HYN_ENTER() HYN_INFO2("[enter]%s\n", __func__) #if HYN_GKI_VER // MODULE_IMPORT_NS(VFS_internal_I_am_really_a_filesystem_and_am_NOT_a_driver); diff --git a/drivers/input/touchscreen/hyn/hyn_lib/hyn_fs_node.c b/drivers/input/touchscreen/hyn/hyn_lib/hyn_fs_node.c index d83f57ac096b..76040ef2b2ef 100644 --- a/drivers/input/touchscreen/hyn/hyn_lib/hyn_fs_node.c +++ b/drivers/input/touchscreen/hyn/hyn_lib/hyn_fs_node.c @@ -160,7 +160,7 @@ static ssize_t hyn_dbg_store(struct device *dev,struct device_attribute *attr,c } else if(0 == strcmp(str,"log")){ hyn_get_word(&next_ptr,str); - hyn_fs_data->log_level = (u8)(str[0]-'0'); + hyn_log_level = (u8)(str[0]-'0'); } else if(0 == strcmp(str,"workmode")){ ret = hyn_get_word(&next_ptr,str);