mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: Johannes Berg <johannes@sipsolutions.net>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 "Rafael J. Wysocki" <rafael@kernel.org>
Cc: linux-kernel@vger.kernel.org, "Thomas Weißschuh" <linux@weissschuh.net>
Subject: [PATCH 1/2] devcoredump: Define 'struct bin_attribute' through macro
Date: Tue, 14 Jan 2025 22:44:58 +0100	[thread overview]
Message-ID: <20250114-sysfs-const-bin_attr-devcoredump-v1-1-fa93be30efae@weissschuh.net> (raw)
In-Reply-To: <20250114-sysfs-const-bin_attr-devcoredump-v1-0-fa93be30efae@weissschuh.net>

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


  reply	other threads:[~2025-01-14 21:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14 21:44 [PATCH 0/2] devcoredump: Constify 'struct bin_attribute' Thomas Weißschuh
2025-01-14 21:44 ` Thomas Weißschuh [this message]
2025-01-14 21:44 ` [PATCH 2/2] " Thomas Weißschuh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250114-sysfs-const-bin_attr-devcoredump-v1-1-fa93be30efae@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®