From b6b996b6cdeecf7e1646c87422e04e446ddce124 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 19 Dec 2017 10:15:07 -0800 Subject: treewide: Use DEVICE_ATTR_RW Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible. Done with perl script: $ git grep -w --name-only DEVICE_ATTR | \ xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*\1_show\s*,\s*\1_store\s*\)/DEVICE_ATTR_RW(\1)/g; print;}' Signed-off-by: Joe Perches Acked-by: Felipe Balbi Acked-by: Andy Shevchenko Acked-by: Bartlomiej Zolnierkiewicz Acked-by: Zhang Rui Acked-by: Jarkko Nikula Acked-by: Jani Nikula Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_attr.c | 43 ++++++++++++++----------------------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'drivers/scsi/lpfc') diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index 82f6e219ee34..c9f54de2aefd 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -2485,8 +2485,7 @@ lpfc_soft_wwpn_store(struct device *dev, struct device_attribute *attr, "reinit adapter - %d\n", stat2); return (stat1 || stat2) ? -EIO : count; } -static DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR, - lpfc_soft_wwpn_show, lpfc_soft_wwpn_store); +static DEVICE_ATTR_RW(lpfc_soft_wwpn); /** * lpfc_soft_wwnn_show - Return the cfg soft ww node name for the adapter @@ -2549,8 +2548,7 @@ lpfc_soft_wwnn_store(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(lpfc_soft_wwnn, S_IRUGO | S_IWUSR, - lpfc_soft_wwnn_show, lpfc_soft_wwnn_store); +static DEVICE_ATTR_RW(lpfc_soft_wwnn); /** * lpfc_oas_tgt_show - Return wwpn of target whose luns maybe enabled for @@ -3068,8 +3066,7 @@ MODULE_PARM_DESC(lpfc_poll, "FCP ring polling mode control:" " 1 - poll with interrupts enabled" " 3 - poll and disable FCP ring interrupts"); -static DEVICE_ATTR(lpfc_poll, S_IRUGO | S_IWUSR, - lpfc_poll_show, lpfc_poll_store); +static DEVICE_ATTR_RW(lpfc_poll); int lpfc_no_hba_reset_cnt; unsigned long lpfc_no_hba_reset[MAX_HBAS_NO_RESET] = { @@ -3302,8 +3299,7 @@ lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val) lpfc_vport_param_store(nodev_tmo) -static DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR, - lpfc_nodev_tmo_show, lpfc_nodev_tmo_store); +static DEVICE_ATTR_RW(lpfc_nodev_tmo); /* # lpfc_devloss_tmo: If set, it will hold all I/O errors on devices that @@ -3352,8 +3348,7 @@ lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val) } lpfc_vport_param_store(devloss_tmo) -static DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR, - lpfc_devloss_tmo_show, lpfc_devloss_tmo_store); +static DEVICE_ATTR_RW(lpfc_devloss_tmo); /* * lpfc_suppress_rsp: Enable suppress rsp feature is firmware supports it @@ -3545,8 +3540,7 @@ lpfc_restrict_login_set(struct lpfc_vport *vport, int val) return 0; } lpfc_vport_param_store(restrict_login); -static DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR, - lpfc_restrict_login_show, lpfc_restrict_login_store); +static DEVICE_ATTR_RW(lpfc_restrict_login); /* # Some disk devices have a "select ID" or "select Target" capability. @@ -3660,8 +3654,7 @@ lpfc_topology_store(struct device *dev, struct device_attribute *attr, } lpfc_param_show(topology) -static DEVICE_ATTR(lpfc_topology, S_IRUGO | S_IWUSR, - lpfc_topology_show, lpfc_topology_store); +static DEVICE_ATTR_RW(lpfc_topology); /** * lpfc_static_vport_show: Read callback function for @@ -3919,8 +3912,7 @@ lpfc_stat_data_ctrl_show(struct device *dev, struct device_attribute *attr, /* * Sysfs attribute to control the statistical data collection. */ -static DEVICE_ATTR(lpfc_stat_data_ctrl, S_IRUGO | S_IWUSR, - lpfc_stat_data_ctrl_show, lpfc_stat_data_ctrl_store); +static DEVICE_ATTR_RW(lpfc_stat_data_ctrl); /* * lpfc_drvr_stat_data: sysfs attr to get driver statistical data. @@ -4159,8 +4151,7 @@ lpfc_link_speed_init(struct lpfc_hba *phba, int val) return -EINVAL; } -static DEVICE_ATTR(lpfc_link_speed, S_IRUGO | S_IWUSR, - lpfc_link_speed_show, lpfc_link_speed_store); +static DEVICE_ATTR_RW(lpfc_link_speed); /* # lpfc_aer_support: Support PCIe device Advanced Error Reporting (AER) @@ -4253,8 +4244,7 @@ lpfc_aer_support_store(struct device *dev, struct device_attribute *attr, return rc; } -static DEVICE_ATTR(lpfc_aer_support, S_IRUGO | S_IWUSR, - lpfc_aer_support_show, lpfc_aer_support_store); +static DEVICE_ATTR_RW(lpfc_aer_support); /** * lpfc_aer_cleanup_state - Clean up aer state to the aer enabled device @@ -4401,8 +4391,7 @@ LPFC_ATTR(sriov_nr_virtfn, LPFC_DEF_VFN_PER_PFN, 0, LPFC_MAX_VFN_PER_PFN, "Enable PCIe device SR-IOV virtual fn"); lpfc_param_show(sriov_nr_virtfn) -static DEVICE_ATTR(lpfc_sriov_nr_virtfn, S_IRUGO | S_IWUSR, - lpfc_sriov_nr_virtfn_show, lpfc_sriov_nr_virtfn_store); +static DEVICE_ATTR_RW(lpfc_sriov_nr_virtfn); /** * lpfc_request_firmware_store - Request for Linux generic firmware upgrade @@ -4576,8 +4565,7 @@ lpfc_fcp_imax_init(struct lpfc_hba *phba, int val) return 0; } -static DEVICE_ATTR(lpfc_fcp_imax, S_IRUGO | S_IWUSR, - lpfc_fcp_imax_show, lpfc_fcp_imax_store); +static DEVICE_ATTR_RW(lpfc_fcp_imax); /* * lpfc_auto_imax: Controls Auto-interrupt coalescing values support. @@ -4737,8 +4725,7 @@ lpfc_fcp_cpu_map_init(struct lpfc_hba *phba, int val) return 0; } -static DEVICE_ATTR(lpfc_fcp_cpu_map, S_IRUGO | S_IWUSR, - lpfc_fcp_cpu_map_show, lpfc_fcp_cpu_map_store); +static DEVICE_ATTR_RW(lpfc_fcp_cpu_map); /* # lpfc_fcp_class: Determines FC class to use for the FCP protocol. @@ -4824,9 +4811,7 @@ lpfc_max_scsicmpl_time_set(struct lpfc_vport *vport, int val) return 0; } lpfc_vport_param_store(max_scsicmpl_time); -static DEVICE_ATTR(lpfc_max_scsicmpl_time, S_IRUGO | S_IWUSR, - lpfc_max_scsicmpl_time_show, - lpfc_max_scsicmpl_time_store); +static DEVICE_ATTR_RW(lpfc_max_scsicmpl_time); /* # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value -- cgit v1.2.1 From c828a8920307185b7194b575731e8387c99a5a67 Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 19 Dec 2017 10:15:08 -0800 Subject: treewide: Use DEVICE_ATTR_RO Convert DEVICE_ATTR uses to DEVICE_ATTR_RO where possible. Done with perl script: $ git grep -w --name-only DEVICE_ATTR | \ xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(?:\s*S_IRUGO\s*|\s*0444\s*)\)?\s*,\s*\1_show\s*,\s*NULL\s*\)/DEVICE_ATTR_RO(\1)/g; print;}' Signed-off-by: Joe Perches Acked-by: Rafael J. Wysocki Acked-by: Robert Jarzmik Acked-by: Sagi Grimberg Acked-by: Zhang Rui Acked-by: Harald Freudenberger Acked-by: Jani Nikula Acked-by: Corey Minyard Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_attr.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'drivers/scsi/lpfc') diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index c9f54de2aefd..ea8d382bc2eb 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -2260,8 +2260,8 @@ static DEVICE_ATTR(num_discovered_ports, S_IRUGO, lpfc_num_discovered_ports_show, NULL); static DEVICE_ATTR(menlo_mgmt_mode, S_IRUGO, lpfc_mlomgmt_show, NULL); static DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL); -static DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show, NULL); -static DEVICE_ATTR(lpfc_enable_fip, S_IRUGO, lpfc_enable_fip_show, NULL); +static DEVICE_ATTR_RO(lpfc_drvr_version); +static DEVICE_ATTR_RO(lpfc_enable_fip); static DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR, lpfc_board_mode_show, lpfc_board_mode_store); static DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset); @@ -2272,12 +2272,11 @@ static DEVICE_ATTR(used_rpi, S_IRUGO, lpfc_used_rpi_show, NULL); static DEVICE_ATTR(max_xri, S_IRUGO, lpfc_max_xri_show, NULL); static DEVICE_ATTR(used_xri, S_IRUGO, lpfc_used_xri_show, NULL); static DEVICE_ATTR(npiv_info, S_IRUGO, lpfc_npiv_info_show, NULL); -static DEVICE_ATTR(lpfc_temp_sensor, S_IRUGO, lpfc_temp_sensor_show, NULL); -static DEVICE_ATTR(lpfc_fips_level, S_IRUGO, lpfc_fips_level_show, NULL); -static DEVICE_ATTR(lpfc_fips_rev, S_IRUGO, lpfc_fips_rev_show, NULL); -static DEVICE_ATTR(lpfc_dss, S_IRUGO, lpfc_dss_show, NULL); -static DEVICE_ATTR(lpfc_sriov_hw_max_virtfn, S_IRUGO, - lpfc_sriov_hw_max_virtfn_show, NULL); +static DEVICE_ATTR_RO(lpfc_temp_sensor); +static DEVICE_ATTR_RO(lpfc_fips_level); +static DEVICE_ATTR_RO(lpfc_fips_rev); +static DEVICE_ATTR_RO(lpfc_dss); +static DEVICE_ATTR_RO(lpfc_sriov_hw_max_virtfn); static DEVICE_ATTR(protocol, S_IRUGO, lpfc_sli4_protocol_show, NULL); static DEVICE_ATTR(lpfc_xlane_supported, S_IRUGO, lpfc_oas_supported_show, NULL); @@ -3684,8 +3683,7 @@ lpfc_static_vport_show(struct device *dev, struct device_attribute *attr, /* * Sysfs attribute to control the statistical data collection. */ -static DEVICE_ATTR(lpfc_static_vport, S_IRUGO, - lpfc_static_vport_show, NULL); +static DEVICE_ATTR_RO(lpfc_static_vport); /** * lpfc_stat_data_ctrl_store - write call back for lpfc_stat_data_ctrl sysfs file -- cgit v1.2.1 From 6cbaefb4bf2ce6746e49c972289702133b347ffa Mon Sep 17 00:00:00 2001 From: Joe Perches Date: Tue, 19 Dec 2017 10:15:09 -0800 Subject: treewide: Use DEVICE_ATTR_WO Convert DEVICE_ATTR uses to DEVICE_ATTR_WO where possible. Done with perl script: $ git grep -w --name-only DEVICE_ATTR | \ xargs perl -i -e 'local $/; while (<>) { s/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,\s*\(?(?:\s*S_IWUSR\s*|\s*0200\s*)\)?\s*,\s*NULL\s*,\s*\s_store\s*\)/DEVICE_ATTR_WO(\1)/g; print;}' Signed-off-by: Joe Perches Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/lpfc/lpfc_attr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers/scsi/lpfc') diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c index ea8d382bc2eb..a28618c3eb63 100644 --- a/drivers/scsi/lpfc/lpfc_attr.c +++ b/drivers/scsi/lpfc/lpfc_attr.c @@ -2384,8 +2384,7 @@ lpfc_soft_wwn_enable_store(struct device *dev, struct device_attribute *attr, return count; } -static DEVICE_ATTR(lpfc_soft_wwn_enable, S_IWUSR, NULL, - lpfc_soft_wwn_enable_store); +static DEVICE_ATTR_WO(lpfc_soft_wwn_enable); /** * lpfc_soft_wwpn_show - Return the cfg soft ww port name of the adapter -- cgit v1.2.1