[PATCH 1/2] devcoredump: Define 'struct bin_attribute' through macro

Thomas Weißschuh posted 2 patches 11 months ago
[PATCH 1/2] devcoredump: Define 'struct bin_attribute' through macro
Posted by Thomas Weißschuh 11 months ago
The macro saves some lines of code and simplifies the constification of
the attribute.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 drivers/base/devcoredump.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/base/devcoredump.c b/drivers/base/devcoredump.c
index c795edad1b969bc212dda5bd37578cb83118e850..13b3614c9ac911e704d3485b4f0370ce3b0afff6 100644
--- a/drivers/base/devcoredump.c
+++ b/drivers/base/devcoredump.c
@@ -132,12 +132,8 @@ static ssize_t devcd_data_write(struct file *filp, struct kobject *kobj,
 	return count;
 }
 
-static struct bin_attribute devcd_attr_data = {
-	.attr = { .name = "data", .mode = S_IRUSR | S_IWUSR, },
-	.size = 0,
-	.read = devcd_data_read,
-	.write = devcd_data_write,
-};
+static struct bin_attribute devcd_attr_data =
+	__BIN_ATTR(data, 0600, devcd_data_read, devcd_data_write, 0);
 
 static struct bin_attribute *devcd_dev_bin_attrs[] = {
 	&devcd_attr_data, NULL,

-- 
2.48.0