diff --git a/drivers/staging/hievent/Kconfig b/drivers/staging/hievent/Kconfig index 07834c32ba12ec02e70e4585c4e714b14bab75dd..b445a2b90a0745f91d10d6d6c1ee5c0e811b7c5c 100644 --- a/drivers/staging/hievent/Kconfig +++ b/drivers/staging/hievent/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 config HIEVENT tristate "Enable hievent" help diff --git a/drivers/staging/hievent/Makefile b/drivers/staging/hievent/Makefile index 3d3ff445f5c903203dba6732ad0d1ca0408bdba1..5b2adc23affc87a4d187c2372da6327cd54a5a2d 100644 --- a/drivers/staging/hievent/Makefile +++ b/drivers/staging/hievent/Makefile @@ -1 +1,2 @@ +# SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_HIEVENT) += hievent_driver.o \ No newline at end of file diff --git a/drivers/staging/hievent/hievent_driver.c b/drivers/staging/hievent/hievent_driver.c index 36b0a778e04f9bb106620f3aa8f2164fe271c4ec..b65dee9392a3d9f5030e6ae46e36a0e1a9cbbfea 100644 --- a/drivers/staging/hievent/hievent_driver.c +++ b/drivers/staging/hievent/hievent_driver.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2021 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) "hievent_driver " fmt diff --git a/drivers/staging/hievent/hievent_driver.h b/drivers/staging/hievent/hievent_driver.h index 5d52982b78f634166b52340567741f92f6ba7c1a..83c67d9d2e152723c39659dd40b16c4b3a247983 100644 --- a/drivers/staging/hievent/hievent_driver.h +++ b/drivers/staging/hievent/hievent_driver.h @@ -1,16 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2021 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef HIEVENT_DRIVER_H diff --git a/drivers/staging/hievent/hiview_hievent.c b/drivers/staging/hievent/hiview_hievent.c index c72e6f2bb40193471ebfd297388766bf2262670c..4533b6fbb7595036952b003ce83a31afff7cb595 100644 --- a/drivers/staging/hievent/hiview_hievent.c +++ b/drivers/staging/hievent/hiview_hievent.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2021 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #include "hiview_hievent.h" diff --git a/drivers/staging/hievent/hiview_hievent.h b/drivers/staging/hievent/hiview_hievent.h index 358a3e8fed4ec2630ff414ea4b2280702831ab19..c1c003510485bb098de8d0c469be52befa0a0cc8 100644 --- a/drivers/staging/hievent/hiview_hievent.h +++ b/drivers/staging/hievent/hiview_hievent.h @@ -1,16 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2021 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef HIVIEW_HIEVENT_H diff --git a/drivers/staging/hungtask/Kconfig b/drivers/staging/hungtask/Kconfig index c7b43fa6eb62056b3e693e96dcef0ed452db08d2..4e80dc9fc4342075d1d592878dcfd3533e7ddcea 100644 --- a/drivers/staging/hungtask/Kconfig +++ b/drivers/staging/hungtask/Kconfig @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 config DFX_HUNGTASK bool "DFX hungtask" depends on DETECT_HUNG_TASK diff --git a/drivers/staging/hungtask/Makefile b/drivers/staging/hungtask/Makefile index 24951f2cf42cab6f4c0b664da9e6723d0a5ae986..12def220e3d60cdcd8fa5530a36e5ab9b8ce9b1c 100644 --- a/drivers/staging/hungtask/Makefile +++ b/drivers/staging/hungtask/Makefile @@ -1,2 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_DFX_HUNGTASK) += hungtask_base.o obj-$(CONFIG_DFX_HUNGTASK_USER) += hungtask_user.o diff --git a/drivers/staging/hungtask/hungtask_base.c b/drivers/staging/hungtask/hungtask_base.c index 740a5d1e257824cb41cd89dadf7456c52381602f..95c21dd045d223f32ea5da1f066e83471ff16a87 100644 --- a/drivers/staging/hungtask/hungtask_base.c +++ b/drivers/staging/hungtask/hungtask_base.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) "hungtask_base " fmt @@ -403,7 +393,7 @@ void do_show_task(struct task_struct *task, unsigned int flag, int d_state_time) upload.tgid = task->tgid; upload.duration = d_state_time; memset(upload.name, 0, sizeof(upload.name)); - strncpy(upload.name, task->comm, sizeof(task->comm)); + strncpy(upload.name, task->comm, sizeof(upload.name)); upload.flag = flag; if (task->flags & PF_FROZEN) upload.flag = (upload.flag | FLAG_PF_FROZEN); @@ -426,7 +416,7 @@ static void create_taskitem(struct task_item *taskitem, taskitem->pid = task->pid; taskitem->tgid = task->tgid; memset(taskitem->name, 0, sizeof(taskitem->name)); - strncpy(taskitem->name, task->comm, sizeof(task->comm)); + strncpy(taskitem->name, task->comm, sizeof(taskitem->name)); taskitem->switch_count = task->nvcsw + task->nivcsw; taskitem->dump_wa = 0; /* whitelist or applist task dump times */ taskitem->panic_wa = 0; /* whitelist or applist task panic times */ @@ -628,7 +618,7 @@ static void update_panic_task(struct task_item *item) upload.pid = item->pid; upload.tgid = item->tgid; memset(upload.name, 0, sizeof(upload.name)); - strncpy(upload.name, item->name, sizeof(item->name)); + strncpy(upload.name, item->name, sizeof(upload.name)); } static void deal_task(struct task_item *item, struct task_struct *task, bool is_called) diff --git a/drivers/staging/hungtask/hungtask_user.c b/drivers/staging/hungtask/hungtask_user.c index 7070ba197d9bdc234963ccfc54137168fcfa054a..39b0b1bd50351415d8c2d831c1477cab65b81032 100644 --- a/drivers/staging/hungtask/hungtask_user.c +++ b/drivers/staging/hungtask/hungtask_user.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) "hungtask_user " fmt diff --git a/drivers/staging/hungtask/hungtask_user.h b/drivers/staging/hungtask/hungtask_user.h index 3cd655cac2d5dbcb547b15f0f4a133979b8739af..17ea7212b21ea551d9b776ecd0e40fb87d9ce954 100644 --- a/drivers/staging/hungtask/hungtask_user.h +++ b/drivers/staging/hungtask/hungtask_user.h @@ -1,16 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef DFX_HUNGTASK_USER_H diff --git a/drivers/staging/zerohung/watchpoint/hung_wp_screen.c b/drivers/staging/zerohung/watchpoint/hung_wp_screen.c index 9b295fed067d783ddade33bd3327585d42f593d1..3b5f2d6daa5401af661000f1bb6b15076ada2a06 100644 --- a/drivers/staging/zerohung/watchpoint/hung_wp_screen.c +++ b/drivers/staging/zerohung/watchpoint/hung_wp_screen.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) "zrhung " fmt @@ -18,6 +8,8 @@ #include #include #include +#include +#include #include #include #include @@ -61,7 +53,7 @@ static unsigned int headevt; static int *check_off_point; struct work_struct powerkeyevent_sendwork; struct work_struct lpressevent_sendwork; - +static struct notifier_block hung_wp_screen_setblank_ncb; static void zrhung_lpressevent_send_work(struct work_struct *work) { @@ -157,13 +149,19 @@ static void zrhung_powerkeyevent_handler(void) zrhung_new_powerkeyevent(curtime); } -void hung_wp_screen_setblank(int blank) +static int hung_wp_screen_setblank(struct notifier_block *self, unsigned long event, void *data) { unsigned long flags; + struct fb_event *evdata = data; + int blank; if (!init_done) - return; + return 0; + if (event != FB_EVENT_BLANK) + return 0; + + blank = *(int *)evdata->data; spin_lock_irqsave(&(g_hung_data.lock), flags); g_hung_data.fb_blank = blank; if (((g_hung_data.check_id == ZRHUNG_WP_SCREENON) && (blank == 0)) || @@ -173,6 +171,8 @@ void hung_wp_screen_setblank(int blank) g_hung_data.check_id = ZRHUNG_WP_NONE; } spin_unlock_irqrestore(&(g_hung_data.lock), flags); + + return 0; } static void hung_wp_screen_send_work(struct work_struct *work) @@ -212,8 +212,6 @@ static void hung_wp_screen_start(int check_id) g_hung_data.timer.expires = jiffies + msecs_to_jiffies(DEFAULT_TIMEOUT * TIME_CONVERT_UNIT); add_timer(&g_hung_data.timer); pr_info("going to check ID=%d timeout=%d\n", check_id, DEFAULT_TIMEOUT); - - return; } void hung_wp_screen_powerkey_ncb(int event) @@ -271,12 +269,30 @@ static int __init hung_wp_screen_init(void) INIT_WORK(&powerkeyevent_sendwork, zrhung_powerkeyevent_send_work); INIT_WORK(&lpressevent_sendwork, zrhung_lpressevent_send_work); + hung_wp_screen_setblank_ncb.notifier_call = hung_wp_screen_setblank; + fb_register_client(&hung_wp_screen_setblank_ncb); + init_done = true; pr_info("%s done\n", __func__); return 0; } +static void __exit hung_wp_screen_exit(void) +{ + fb_unregister_client(&hung_wp_screen_setblank_ncb); + + cancel_work_sync(&lpressevent_sendwork); + cancel_work_sync(&powerkeyevent_sendwork); + cancel_work_sync(&g_hung_data.send_work); + + destroy_workqueue(g_hung_data.workq); + + del_timer_sync(&g_hung_data.timer); + del_timer_sync(&g_hung_data.long_press_timer); +} + module_init(hung_wp_screen_init); +module_exit(hung_wp_screen_exit); MODULE_AUTHOR("OHOS"); MODULE_DESCRIPTION("Reporting the frozen screen alarm event"); diff --git a/drivers/staging/zerohung/zrhung_event.c b/drivers/staging/zerohung/zrhung_event.c index 0ad2d9abb31d026737ba3466c2aa1d06eacb8e12..be0428d4edfa60c282d373fa54143d7597f9e9fd 100644 --- a/drivers/staging/zerohung/zrhung_event.c +++ b/drivers/staging/zerohung/zrhung_event.c @@ -1,16 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #define pr_fmt(fmt) "zrhung " fmt @@ -117,7 +107,7 @@ struct hisysevent *create_hisysevent(const char *domain, const char *event_name) event = vmalloc(sizeof(*event)); if (!event) { pr_err("failed to vmalloc for event"); - return -ENOMEM; + return NULL; } memset(event, 0, sizeof(*event)); diff --git a/drivers/video/backlight/backlight.c b/drivers/video/backlight/backlight.c index 4bda5fc5e624f535cf1b9c4dba2f2ca355fbc672..537fe1b376ad73d3a304809a90ab835bd02fab4a 100644 --- a/drivers/video/backlight/backlight.c +++ b/drivers/video/backlight/backlight.c @@ -22,10 +22,6 @@ #include #endif -#ifdef CONFIG_DFX_ZEROHUNG -#include -#endif - /** * DOC: overview * @@ -124,9 +120,6 @@ static int fb_notifier_callback(struct notifier_block *self, bd->props.state &= ~BL_CORE_FBBLANK; bd->props.fb_blank = FB_BLANK_UNBLANK; backlight_update_status(bd); -#ifdef CONFIG_DFX_ZEROHUNG - hung_wp_screen_setblank(fb_blank); -#endif } } else if (fb_blank != FB_BLANK_UNBLANK && bd->fb_bl_on[node]) { bd->fb_bl_on[node] = false; @@ -134,9 +127,6 @@ static int fb_notifier_callback(struct notifier_block *self, bd->props.state |= BL_CORE_FBBLANK; bd->props.fb_blank = fb_blank; backlight_update_status(bd); -#ifdef CONFIG_DFX_ZEROHUNG - hung_wp_screen_setblank(fb_blank); -#endif } } out: diff --git a/include/dfx/hung_wp_screen.h b/include/dfx/hung_wp_screen.h index 88bb62435d6a53a42bd2ea7e5a2f8a7f730a2907..39bad044c942d47412f68af816528855d9416eed 100644 --- a/include/dfx/hung_wp_screen.h +++ b/include/dfx/hung_wp_screen.h @@ -1,16 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef HUNG_WP_SCREEN_H @@ -24,13 +14,11 @@ #define ZRHUNG_WP_SCREENOFF 2 #define WP_SCREEN_DOMAIN "KERNEL_VENDOR" -#define WP_SCREEN_PWK_NAME "POWERKEY" -#define WP_SCREEN_LPRESS_NAME "LONGPRESS" +#define WP_SCREEN_PWK_NAME "POWER_KEY" +#define WP_SCREEN_LPRESS_NAME "LONG_PRESS" #define WP_SCREEN_ON_NAME "SCREEN_ON" #define WP_SCREEN_OFF_NAME "SCREEN_OFF" void hung_wp_screen_powerkey_ncb(int event); -void hung_wp_screen_setblank(int blank); -int hung_wp_screen_getbl(void); #endif /* HUNG_WP_SCREEN_H */ diff --git a/include/dfx/hungtask_base.h b/include/dfx/hungtask_base.h index 5c280b5b21b5626be6229f5b7151b1b3130bf40a..b3cf189a0051287f49fea44d3e1e983c912e5778 100644 --- a/include/dfx/hungtask_base.h +++ b/include/dfx/hungtask_base.h @@ -1,16 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef DFX_HUNGTASK_BASE_H diff --git a/include/dfx/zrhung.h b/include/dfx/zrhung.h index 9d54df21c81755443fb22d3c0154b818f3c327b2..4a217c99d39c7211a91130056d72cbffe66750b7 100644 --- a/include/dfx/zrhung.h +++ b/include/dfx/zrhung.h @@ -1,16 +1,6 @@ -// SPDX-License-Identifier: GPL-2.0 +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2022 Huawei Technologies Co., Ltd. All rights reserved. - * - * This software is licensed under the terms of the GNU General Public - * License version 2, as published by the Free Software Foundation, and - * may be copied, distributed, and modified under those terms. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * */ #ifndef ZRHUNG_H