From: Salah Triki <salah.triki@gmail.com>
To: "James E.J. Bottomley" <James.Bottomley@hansenpartnership.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: salah.triki@gmail.com
Subject: [PATCH] drivers: scsi: replace DEVICE_ATTR with DEVICE_ATTR_{RO,WO}
Date: Mon, 5 May 2025 16:28:26 +0100 [thread overview]
Message-ID: <aBjZGppbYDLSQRlH@pc> (raw)
Replace DEVICE_ATTR with DEVICE_ATTR_{RO,WO} to make the code cleaner. And
replace the names of the functions {store_, show_}* with *{_store, _show}
to make the functions usable with DEVICE_ATTR_{RO,WO}.
Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
drivers/scsi/scsi_sysfs.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index d772258e29ad..04c9f0cc18cd 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -182,7 +182,7 @@ shost_rd_attr2(field, field, format_string)
*/
static ssize_t
-store_scan(struct device *dev, struct device_attribute *attr,
+scan_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct Scsi_Host *shost = class_to_shost(dev);
@@ -193,7 +193,7 @@ store_scan(struct device *dev, struct device_attribute *attr,
res = count;
return res;
};
-static DEVICE_ATTR(scan, S_IWUSR, NULL, store_scan);
+static DEVICE_ATTR_WO(scan);
static ssize_t
store_shost_state(struct device *dev, struct device_attribute *attr,
@@ -292,7 +292,7 @@ static int check_reset_type(const char *str)
}
static ssize_t
-store_host_reset(struct device *dev, struct device_attribute *attr,
+host_reset_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t count)
{
struct Scsi_Host *shost = class_to_shost(dev);
@@ -315,7 +315,7 @@ store_host_reset(struct device *dev, struct device_attribute *attr,
return ret;
}
-static DEVICE_ATTR(host_reset, S_IWUSR, NULL, store_host_reset);
+static DEVICE_ATTR_WO(host_reset);
static ssize_t
show_shost_eh_deadline(struct device *dev,
@@ -379,29 +379,29 @@ shost_rd_attr(prot_guard_type, "%hd\n");
shost_rd_attr2(proc_name, hostt->proc_name, "%s\n");
static ssize_t
-show_host_busy(struct device *dev, struct device_attribute *attr, char *buf)
+host_busy_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
return snprintf(buf, 20, "%d\n", scsi_host_busy(shost));
}
-static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL);
+static DEVICE_ATTR_RO(host_busy);
static ssize_t
-show_use_blk_mq(struct device *dev, struct device_attribute *attr, char *buf)
+use_blk_mq_show(struct device *dev, struct device_attribute *attr, char *buf)
{
return sprintf(buf, "1\n");
}
-static DEVICE_ATTR(use_blk_mq, S_IRUGO, show_use_blk_mq, NULL);
+static DEVICE_ATTR_RO(use_blk_mq);
static ssize_t
-show_nr_hw_queues(struct device *dev, struct device_attribute *attr, char *buf)
+nr_hw_queues_show(struct device *dev, struct device_attribute *attr, char *buf)
{
struct Scsi_Host *shost = class_to_shost(dev);
struct blk_mq_tag_set *tag_set = &shost->tag_set;
return snprintf(buf, 20, "%d\n", tag_set->nr_hw_queues);
}
-static DEVICE_ATTR(nr_hw_queues, S_IRUGO, show_nr_hw_queues, NULL);
+static DEVICE_ATTR_RO(nr_hw_queues);
static struct attribute *scsi_sysfs_shost_attrs[] = {
&dev_attr_use_blk_mq.attr,
--
2.43.0
reply other threads:[~2025-05-05 15:28 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=aBjZGppbYDLSQRlH@pc \
--to=salah.triki@gmail.com \
--cc=James.Bottomley@hansenpartnership.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.