Skip to contentSkip to conversation

Input: edt-ft5x06: Use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

PATCH In review Aishwarya Ramakrishnan 2 participants 4 messages May 5, 2020 – May 6, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Input: edt-ft5x06: Use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE.

---
 drivers/input/touchscreen/edt-ft5x06.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/edt-ft5x06.c +1 -1
index d2587724c52a..7f2070fde2ae 100644
@@ -676,7 +676,7 @@ static int edt_ft5x06_debugfs_mode_set(void *data, u64 mode)
 	return retval;
 };
 
-DEFINE_SIMPLE_ATTRIBUTE(debugfs_mode_fops, edt_ft5x06_debugfs_mode_get,
+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,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 2 lines · Aishwarya Ramakrishnan

It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE.

No it is not, why do you think so?

The two defines do different things, that is why we have 2 different defines. You can not just replace one with the other without understanding why one was used and not the other one.

Did you test this change to verify that everything still works properly? Why is it needed to be changed at all?

thanks,

greg k-h

#2 lore raw

PATCH 1/1 Input: edt-ft5x06: Use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs fops

In reply to Aishwarya Ramakrishnan

From: Aishwarya Ramakrishnan <[email protected]>

Quoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · Aishwarya Ramakrishnan

It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE.

No it is not, why do you think so?

This change is suggested by Coccinelle software.
Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Quoted 6 lines

The two defines do different things, that is why we have 2 different defines. You can not just replace one with the other without understanding why one was used and not the other one.

Did you test this change to verify that everything still works properly? Why is it needed to be changed at all?

DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().
But I missed to use debugfs_create_file_unsafe() function in the patch.

#3 lore raw
Quoted 11 lines · Aishwarya Ramakrishnan

From: Aishwarya Ramakrishnan <[email protected]>

Quoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · Aishwarya Ramakrishnan

It is more clear to use DEFINE_DEBUGFS_ATTRIBUTE to define debugfs file operation rather than DEFINE_SIMPLE_ATTRIBUTE.

No it is not, why do you think so?

This change is suggested by Coccinelle software.
Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Not a good thing, I do not know why that was added :(

Quoted 10 lines
Quoted 6 lines

The two defines do different things, that is why we have 2 different defines. You can not just replace one with the other without understanding why one was used and not the other one.

Did you test this change to verify that everything still works properly? Why is it needed to be changed at all?

DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file() imposes some significant overhead as compared to DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

What kind of overhead? Is it required?

Quoted 1 line

But I missed to use debugfs_create_file_unsafe() function in the patch.

Yeah, don't use the unsafe stuff unless you know what is happening here please.

greg k-h