From patchwork Wed Jan 16 01:55:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yue Haibing X-Patchwork-Id: 10765327 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 33C27186E for ; Wed, 16 Jan 2019 01:50:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C8752C5AC for ; Wed, 16 Jan 2019 01:50:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 099FD2D177; Wed, 16 Jan 2019 01:50:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,TVD_SPACE_RATIO,TVD_SPACE_RATIO_MINFP autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 26C162C5AC for ; Wed, 16 Jan 2019 01:50:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727327AbfAPBuB (ORCPT ); Tue, 15 Jan 2019 20:50:01 -0500 Received: from szxga06-in.huawei.com ([45.249.212.32]:39838 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726123AbfAPBuB (ORCPT ); Tue, 15 Jan 2019 20:50:01 -0500 Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id E0BA9CA63D153E82BCDA; Wed, 16 Jan 2019 09:49:58 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.408.0; Wed, 16 Jan 2019 09:49:49 +0800 From: YueHaibing To: Dmitry Torokhov , Henrik Rydberg , Marco Felsch , Rob Herring , Andi Shyti CC: YueHaibing , , Subject: [PATCH -next] Input: fix debugfs_simple_attr.cocci warnings Date: Wed, 16 Jan 2019 01:55:56 +0000 Message-ID: <1547603756-151440-1-git-send-email-yuehaibing@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 X-Originating-IP: [10.175.113.25] X-CFilter-Loop: Reflected Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Use DEFINE_DEBUGFS_ATTRIBUTE rather than DEFINE_SIMPLE_ATTRIBUTE for debugfs files. Semantic patch information: Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe(). Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci Signed-off-by: YueHaibing --- drivers/input/touchscreen/edt-ft5x06.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c index 702bfda..8f06585 100644 --- a/drivers/input/touchscreen/edt-ft5x06.c +++ b/drivers/input/touchscreen/edt-ft5x06.c @@ -690,8 +690,8 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode) return retval; }; -DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, - edt_ft5x06_debugfs_mode_set, "%llu\n"); +DEFINE_DEBUGFS_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get, + edt_ft5x06_debugfs_mode_set, "%llu\n"); static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, char __user *buf, size_t count, loff_t *off) @@ -787,8 +787,9 @@ static ssize_t edt_ft5x06_debugfs_raw_data_read(struct file *file, debugfs_create_u16("num_x", S_IRUSR, tsdata->debug_dir, &tsdata->num_x); debugfs_create_u16("num_y", S_IRUSR, tsdata->debug_dir, &tsdata->num_y); - debugfs_create_file("mode", S_IRUSR | S_IWUSR, - tsdata->debug_dir, tsdata, &debugfs_mode_fops); + debugfs_create_file_unsafe("mode", 0600, + tsdata->debug_dir, tsdata, + &debugfs_mode_fops); debugfs_create_file("raw_data", S_IRUSR, tsdata->debug_dir, tsdata, &debugfs_raw_data_fops); }