Skip to content

Commit 93b35f7

Browse files
committed
Fix function declaration
The function pointer type of myvariable_store was incompatible with the store member of struct kobj_attribute, leading to a compilation error when the type conversion (void *) was omitted. This patch corrects the function declaration and eliminates the need for type conversion.
1 parent 2eadbb1 commit 93b35f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: examples/hello-sysfs.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ static ssize_t myvariable_show(struct kobject *kobj,
2020
}
2121

2222
static ssize_t myvariable_store(struct kobject *kobj,
23-
struct kobj_attribute *attr, char *buf,
23+
struct kobj_attribute *attr, const char *buf,
2424
size_t count)
2525
{
2626
sscanf(buf, "%du", &myvariable);
2727
return count;
2828
}
2929

3030
static struct kobj_attribute myvariable_attribute =
31-
__ATTR(myvariable, 0660, myvariable_show, (void *)myvariable_store);
31+
__ATTR(myvariable, 0660, myvariable_show, myvariable_store);
3232

3333
static int __init mymodule_init(void)
3434
{

0 commit comments

Comments
 (0)