diff options
author | Lukas Wunner <lukas@wunner.de> | 2024-04-20 22:00:06 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-05-04 17:37:04 +0200 |
commit | 9bb8e30611a4c9a28cb96ea64d1694202ac67da8 (patch) | |
tree | c51b8bc3bf55f0b34fe90732e40bf430ffdad325 /drivers/scsi/ibmvscsi_tgt | |
parent | 3182459b7bff642eb968d6203a08aea3862436c1 (diff) |
scsi: Use device_show_string() helper for sysfs attributes
Deduplicate sysfs ->show() callbacks which expose a string at a static
memory location. Use the newly introduced device_show_string() helper
in the driver core instead by declaring those sysfs attributes with
DEVICE_STRING_ATTR_RO().
No functional change intended.
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Link: https://lore.kernel.org/r/b11792137186f5a6794f12fdf891d0c6d51b3557.1713608122.git.lukas@wunner.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/scsi/ibmvscsi_tgt')
-rw-r--r-- | drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c index 68b99924ee4f..2fca17cf8b51 100644 --- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c +++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c @@ -3613,12 +3613,6 @@ static void ibmvscsis_remove(struct vio_dev *vdev) kfree(vscsi); } -static ssize_t system_id_show(struct device *dev, - struct device_attribute *attr, char *buf) -{ - return sysfs_emit(buf, "%s\n", system_id); -} - static ssize_t partition_number_show(struct device *dev, struct device_attribute *attr, char *buf) { @@ -3982,8 +3976,7 @@ static const struct target_core_fabric_ops ibmvscsis_ops = { static void ibmvscsis_dev_release(struct device *dev) {}; -static struct device_attribute dev_attr_system_id = - __ATTR(system_id, S_IRUGO, system_id_show, NULL); +static DEVICE_STRING_ATTR_RO(system_id, S_IRUGO, system_id); static struct device_attribute dev_attr_partition_number = __ATTR(partition_number, S_IRUGO, partition_number_show, NULL); @@ -3992,7 +3985,7 @@ static struct device_attribute dev_attr_unit_address = __ATTR(unit_address, S_IRUGO, unit_address_show, NULL); static struct attribute *ibmvscsis_dev_attrs[] = { - &dev_attr_system_id.attr, + &dev_attr_system_id.attr.attr, &dev_attr_partition_number.attr, &dev_attr_unit_address.attr, }; |