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 <yuehaibing@xxxxxxxxxx> --- 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); }