@@ -487,9 +487,9 @@ static const struct efivar_operations efivar_ops = {
#endif /* CONFIG_EFI */
-static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
- struct bin_attribute *bin_attr,
- char *buf, loff_t pos, size_t count)
+static ssize_t append_to_eventlog_write(struct file *filp, struct kobject *kobj,
+ const struct bin_attribute *bin_attr,
+ char *buf, loff_t pos, size_t count)
{
struct gsmi_set_eventlog_param param = {
.data_ptr = gsmi_dev.data_buf->address,
@@ -528,10 +528,7 @@ static ssize_t eventlog_write(struct file *filp, struct kobject *kobj,
}
-static struct bin_attribute eventlog_bin_attr = {
- .attr = {.name = "append_to_eventlog", .mode = 0200},
- .write = eventlog_write,
-};
+static const BIN_ATTR_ADMIN_WO(append_to_eventlog, 0);
static ssize_t gsmi_clear_eventlog_store(struct kobject *kobj,
struct kobj_attribute *attr,
@@ -1017,7 +1014,7 @@ static __init int gsmi_init(void)
}
/* Setup eventlog access */
- ret = sysfs_create_bin_file(gsmi_kobj, &eventlog_bin_attr);
+ ret = sysfs_create_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
if (ret) {
printk(KERN_INFO "gsmi: Failed to setup eventlog");
goto out_err;
@@ -1049,7 +1046,7 @@ static __init int gsmi_init(void)
return 0;
out_remove_bin_file:
- sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
+ sysfs_remove_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
out_err:
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
@@ -1076,7 +1073,7 @@ static void __exit gsmi_exit(void)
#endif
sysfs_remove_files(gsmi_kobj, gsmi_attrs);
- sysfs_remove_bin_file(gsmi_kobj, &eventlog_bin_attr);
+ sysfs_remove_bin_file(gsmi_kobj, &bin_attr_append_to_eventlog);
kobject_put(gsmi_kobj);
gsmi_buf_free(gsmi_dev.param_buf);
gsmi_buf_free(gsmi_dev.data_buf);
Using the macro saves some lines of code and prepares the attribute for the general constifications of struct bin_attributes. While at it also constify the callback parameter. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> --- drivers/firmware/google/gsmi.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-)