diff mbox series

[3/3] megaraid_sas: use DEVICE_ATTR_{RO, RW}

Message ID 20190529160041.7242-4-thenzl@redhat.com (mailing list archive)
State Mainlined
Commit d635468349695e6f2286400eb7a740f1635000b4
Headers show
Series megaraid_sas: | expand

Commit Message

Tomas Henzl May 29, 2019, 4 p.m. UTC
Use existing macros.
No functional change.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
---
 drivers/scsi/megaraid/megaraid_sas_base.c | 44 ++++++++++-------------
 1 file changed, 18 insertions(+), 26 deletions(-)

Comments

Sumit Saxena June 7, 2019, 7:15 a.m. UTC | #1
On Wed, May 29, 2019 at 9:30 PM Tomas Henzl <thenzl@redhat.com> wrote:
>
> Use existing macros.
> No functional change.
>
> Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Sumit Saxena <sumit.saxena@broadcom.com>

> ---
>  drivers/scsi/megaraid/megaraid_sas_base.c | 44 ++++++++++-------------
>  1 file changed, 18 insertions(+), 26 deletions(-)
>
> diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
> index 0522821a5..aa6a5d86d 100644
> --- a/drivers/scsi/megaraid/megaraid_sas_base.c
> +++ b/drivers/scsi/megaraid/megaraid_sas_base.c
> @@ -3121,7 +3121,7 @@ megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
>  }
>
>  static ssize_t
> -megasas_fw_crash_buffer_store(struct device *cdev,
> +fw_crash_buffer_store(struct device *cdev,
>         struct device_attribute *attr, const char *buf, size_t count)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3140,7 +3140,7 @@ megasas_fw_crash_buffer_store(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_fw_crash_buffer_show(struct device *cdev,
> +fw_crash_buffer_show(struct device *cdev,
>         struct device_attribute *attr, char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3185,7 +3185,7 @@ megasas_fw_crash_buffer_show(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_fw_crash_buffer_size_show(struct device *cdev,
> +fw_crash_buffer_size_show(struct device *cdev,
>         struct device_attribute *attr, char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3197,7 +3197,7 @@ megasas_fw_crash_buffer_size_show(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_fw_crash_state_store(struct device *cdev,
> +fw_crash_state_store(struct device *cdev,
>         struct device_attribute *attr, const char *buf, size_t count)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3232,7 +3232,7 @@ megasas_fw_crash_state_store(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_fw_crash_state_show(struct device *cdev,
> +fw_crash_state_show(struct device *cdev,
>         struct device_attribute *attr, char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3243,14 +3243,14 @@ megasas_fw_crash_state_show(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_page_size_show(struct device *cdev,
> +page_size_show(struct device *cdev,
>         struct device_attribute *attr, char *buf)
>  {
>         return snprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)PAGE_SIZE - 1);
>  }
>
>  static ssize_t
> -megasas_ldio_outstanding_show(struct device *cdev, struct device_attribute *attr,
> +ldio_outstanding_show(struct device *cdev, struct device_attribute *attr,
>         char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3260,7 +3260,7 @@ megasas_ldio_outstanding_show(struct device *cdev, struct device_attribute *attr
>  }
>
>  static ssize_t
> -megasas_fw_cmds_outstanding_show(struct device *cdev,
> +fw_cmds_outstanding_show(struct device *cdev,
>                                  struct device_attribute *attr, char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3270,7 +3270,7 @@ megasas_fw_cmds_outstanding_show(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_dump_system_regs_show(struct device *cdev,
> +dump_system_regs_show(struct device *cdev,
>                                struct device_attribute *attr, char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3281,7 +3281,7 @@ megasas_dump_system_regs_show(struct device *cdev,
>  }
>
>  static ssize_t
> -megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr,
> +raid_map_id_show(struct device *cdev, struct device_attribute *attr,
>                           char *buf)
>  {
>         struct Scsi_Host *shost = class_to_shost(cdev);
> @@ -3292,22 +3292,14 @@ megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr,
>                         (unsigned long)instance->map_id);
>  }
>
> -static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR,
> -       megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store);
> -static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO,
> -       megasas_fw_crash_buffer_size_show, NULL);
> -static DEVICE_ATTR(fw_crash_state, S_IRUGO | S_IWUSR,
> -       megasas_fw_crash_state_show, megasas_fw_crash_state_store);
> -static DEVICE_ATTR(page_size, S_IRUGO,
> -       megasas_page_size_show, NULL);
> -static DEVICE_ATTR(ldio_outstanding, S_IRUGO,
> -       megasas_ldio_outstanding_show, NULL);
> -static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO,
> -       megasas_fw_cmds_outstanding_show, NULL);
> -static DEVICE_ATTR(dump_system_regs, S_IRUGO,
> -       megasas_dump_system_regs_show, NULL);
> -static DEVICE_ATTR(raid_map_id, S_IRUGO,
> -       megasas_raid_map_id_show, NULL);
> +static DEVICE_ATTR_RW(fw_crash_buffer);
> +static DEVICE_ATTR_RO(fw_crash_buffer_size);
> +static DEVICE_ATTR_RW(fw_crash_state);
> +static DEVICE_ATTR_RO(page_size);
> +static DEVICE_ATTR_RO(ldio_outstanding);
> +static DEVICE_ATTR_RO(fw_cmds_outstanding);
> +static DEVICE_ATTR_RO(dump_system_regs);
> +static DEVICE_ATTR_RO(raid_map_id);
>
>  struct device_attribute *megaraid_host_attrs[] = {
>         &dev_attr_fw_crash_buffer_size,
> --
> 2.20.1
>
diff mbox series

Patch

diff --git a/drivers/scsi/megaraid/megaraid_sas_base.c b/drivers/scsi/megaraid/megaraid_sas_base.c
index 0522821a5..aa6a5d86d 100644
--- a/drivers/scsi/megaraid/megaraid_sas_base.c
+++ b/drivers/scsi/megaraid/megaraid_sas_base.c
@@ -3121,7 +3121,7 @@  megasas_service_aen(struct megasas_instance *instance, struct megasas_cmd *cmd)
 }
 
 static ssize_t
-megasas_fw_crash_buffer_store(struct device *cdev,
+fw_crash_buffer_store(struct device *cdev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3140,7 +3140,7 @@  megasas_fw_crash_buffer_store(struct device *cdev,
 }
 
 static ssize_t
-megasas_fw_crash_buffer_show(struct device *cdev,
+fw_crash_buffer_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3185,7 +3185,7 @@  megasas_fw_crash_buffer_show(struct device *cdev,
 }
 
 static ssize_t
-megasas_fw_crash_buffer_size_show(struct device *cdev,
+fw_crash_buffer_size_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3197,7 +3197,7 @@  megasas_fw_crash_buffer_size_show(struct device *cdev,
 }
 
 static ssize_t
-megasas_fw_crash_state_store(struct device *cdev,
+fw_crash_state_store(struct device *cdev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3232,7 +3232,7 @@  megasas_fw_crash_state_store(struct device *cdev,
 }
 
 static ssize_t
-megasas_fw_crash_state_show(struct device *cdev,
+fw_crash_state_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3243,14 +3243,14 @@  megasas_fw_crash_state_show(struct device *cdev,
 }
 
 static ssize_t
-megasas_page_size_show(struct device *cdev,
+page_size_show(struct device *cdev,
 	struct device_attribute *attr, char *buf)
 {
 	return snprintf(buf, PAGE_SIZE, "%ld\n", (unsigned long)PAGE_SIZE - 1);
 }
 
 static ssize_t
-megasas_ldio_outstanding_show(struct device *cdev, struct device_attribute *attr,
+ldio_outstanding_show(struct device *cdev, struct device_attribute *attr,
 	char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3260,7 +3260,7 @@  megasas_ldio_outstanding_show(struct device *cdev, struct device_attribute *attr
 }
 
 static ssize_t
-megasas_fw_cmds_outstanding_show(struct device *cdev,
+fw_cmds_outstanding_show(struct device *cdev,
 				 struct device_attribute *attr, char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3270,7 +3270,7 @@  megasas_fw_cmds_outstanding_show(struct device *cdev,
 }
 
 static ssize_t
-megasas_dump_system_regs_show(struct device *cdev,
+dump_system_regs_show(struct device *cdev,
 			       struct device_attribute *attr, char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3281,7 +3281,7 @@  megasas_dump_system_regs_show(struct device *cdev,
 }
 
 static ssize_t
-megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr,
+raid_map_id_show(struct device *cdev, struct device_attribute *attr,
 			  char *buf)
 {
 	struct Scsi_Host *shost = class_to_shost(cdev);
@@ -3292,22 +3292,14 @@  megasas_raid_map_id_show(struct device *cdev, struct device_attribute *attr,
 			(unsigned long)instance->map_id);
 }
 
-static DEVICE_ATTR(fw_crash_buffer, S_IRUGO | S_IWUSR,
-	megasas_fw_crash_buffer_show, megasas_fw_crash_buffer_store);
-static DEVICE_ATTR(fw_crash_buffer_size, S_IRUGO,
-	megasas_fw_crash_buffer_size_show, NULL);
-static DEVICE_ATTR(fw_crash_state, S_IRUGO | S_IWUSR,
-	megasas_fw_crash_state_show, megasas_fw_crash_state_store);
-static DEVICE_ATTR(page_size, S_IRUGO,
-	megasas_page_size_show, NULL);
-static DEVICE_ATTR(ldio_outstanding, S_IRUGO,
-	megasas_ldio_outstanding_show, NULL);
-static DEVICE_ATTR(fw_cmds_outstanding, S_IRUGO,
-	megasas_fw_cmds_outstanding_show, NULL);
-static DEVICE_ATTR(dump_system_regs, S_IRUGO,
-	megasas_dump_system_regs_show, NULL);
-static DEVICE_ATTR(raid_map_id, S_IRUGO,
-	megasas_raid_map_id_show, NULL);
+static DEVICE_ATTR_RW(fw_crash_buffer);
+static DEVICE_ATTR_RO(fw_crash_buffer_size);
+static DEVICE_ATTR_RW(fw_crash_state);
+static DEVICE_ATTR_RO(page_size);
+static DEVICE_ATTR_RO(ldio_outstanding);
+static DEVICE_ATTR_RO(fw_cmds_outstanding);
+static DEVICE_ATTR_RO(dump_system_regs);
+static DEVICE_ATTR_RO(raid_map_id);
 
 struct device_attribute *megaraid_host_attrs[] = {
 	&dev_attr_fw_crash_buffer_size,