Skip to content

Commit 4cb282b

Browse files
committed
Correct the function declaration
The function pointer type of myvariable_store is incompatible with the store member of struct kobj_attribute, so, if we omit the type conversion (void *), we will meet a compilation error. This patch corrects the function declaration and removes the type conversion.
1 parent 2eadbb1 commit 4cb282b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

examples/hello-sysfs.c

Lines changed: 2 additions & 2 deletions
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)