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@xxxxxxxxxxxxxx> --- drivers/s390/char/sclp_config.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c index f56ea9b60e08e817652a9b7d19d420e9977c6552..0fe0782ccd325c1c3907e5d6272f770477e9ea46 100644 --- a/drivers/s390/char/sclp_config.c +++ b/drivers/s390/char/sclp_config.c @@ -127,9 +127,9 @@ static int sclp_ofb_send_req(char *ev_data, size_t len) return rc; } -static ssize_t sysfs_ofb_data_write(struct file *filp, struct kobject *kobj, - struct bin_attribute *bin_attr, - char *buf, loff_t off, size_t count) +static ssize_t event_data_write(struct file *filp, struct kobject *kobj, + const struct bin_attribute *bin_attr, + char *buf, loff_t off, size_t count) { int rc; @@ -137,13 +137,7 @@ static ssize_t sysfs_ofb_data_write(struct file *filp, struct kobject *kobj, return rc ?: count; } -static const struct bin_attribute ofb_bin_attr = { - .attr = { - .name = "event_data", - .mode = S_IWUSR, - }, - .write = sysfs_ofb_data_write, -}; +static const BIN_ATTR_ADMIN_WO(event_data, 0); #endif static int __init sclp_ofb_setup(void) @@ -155,7 +149,7 @@ static int __init sclp_ofb_setup(void) ofb_kset = kset_create_and_add("ofb", NULL, firmware_kobj); if (!ofb_kset) return -ENOMEM; - rc = sysfs_create_bin_file(&ofb_kset->kobj, &ofb_bin_attr); + rc = sysfs_create_bin_file(&ofb_kset->kobj, &bin_attr_event_data); if (rc) { kset_unregister(ofb_kset); return rc; -- 2.47.1