Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO

From: Zhang Rui
Date: Wed Dec 20 2017 - 19:49:12 EST


On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@xxxxxxxxxxx>
> ---
> Âarch/arm/mach-pxa/sharpsl_pm.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ4 ++--
> Âarch/sh/drivers/push-switch.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âarch/tile/kernel/sysfs.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 10 +++++-----
> Âdrivers/acpi/device_sysfs.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +++---
> Âdrivers/char/ipmi/ipmi_msghandler.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 17 ++++++++
> ---------
> Âdrivers/gpu/drm/i915/i915_sysfs.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +++---
> Âdrivers/nvme/host/core.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 10 +++++-----
> Âdrivers/s390/cio/css.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ8 ++++----
> Âdrivers/s390/cio/device.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ8 ++++----
> Âdrivers/s390/crypto/ap_card.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âdrivers/scsi/hpsa.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 10 +++++-----
> Âdrivers/scsi/lpfc/lpfc_attr.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| 18 ++++++++
> ----------
> Âdrivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c |ÂÂ8 ++++----
> Âdrivers/thermal/thermal_sysfs.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ6 +++---

For the thermal part,
ACK-by: Zhang Rui <rui.zhang@xxxxxxxxx>

thanks,
rui
> Âsound/soc/soc-core.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Âsound/soc/soc-dapm.cÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ|ÂÂ2 +-
> Â16 files changed, 58 insertions(+), 61 deletions(-)
>
> diff --git a/arch/arm/mach-pxa/sharpsl_pm.c b/arch/arm/mach-
> pxa/sharpsl_pm.c
> index 398ba9ba2632..ef9fd9b759cb 100644
> --- a/arch/arm/mach-pxa/sharpsl_pm.c
> +++ b/arch/arm/mach-pxa/sharpsl_pm.c
> @@ -802,8 +802,8 @@ static ssize_t battery_voltage_show(struct device
> *dev, struct device_attribute
> Â return sprintf(buf, "%d\n",
> sharpsl_pm.battstat.mainbat_voltage);
> Â}
> Â
> -static DEVICE_ATTR(battery_percentage, 0444,
> battery_percentage_show, NULL);
> -static DEVICE_ATTR(battery_voltage, 0444, battery_voltage_show,
> NULL);
> +static DEVICE_ATTR_RO(battery_percentage);
> +static DEVICE_ATTR_RO(battery_voltage);
> Â
> Âextern void (*apm_get_power_status)(struct apm_power_info *);
> Â
> diff --git a/arch/sh/drivers/push-switch.c b/arch/sh/drivers/push-
> switch.c
> index a17181160233..762bc5619910 100644
> --- a/arch/sh/drivers/push-switch.c
> +++ b/arch/sh/drivers/push-switch.c
> @@ -24,7 +24,7 @@ static ssize_t switch_show(struct device *dev,
> Â struct push_switch_platform_info *psw_info = dev-
> >platform_data;
> Â return sprintf(buf, "%s\n", psw_info->name);
> Â}
> -static DEVICE_ATTR(switch, S_IRUGO, switch_show, NULL);
> +static DEVICE_ATTR_RO(switch);
> Â
> Âstatic void switch_timer(struct timer_list *t)
> Â{
> diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
> index af5024f0fb5a..b09456a3d77a 100644
> --- a/arch/tile/kernel/sysfs.c
> +++ b/arch/tile/kernel/sysfs.c
> @@ -38,7 +38,7 @@ static ssize_t chip_width_show(struct device *dev,
> Â{
> Â return sprintf(page, "%u\n", smp_width);
> Â}
> -static DEVICE_ATTR(chip_width, 0444, chip_width_show, NULL);
> +static DEVICE_ATTR_RO(chip_width);
> Â
> Âstatic ssize_t chip_height_show(struct device *dev,
> Â struct device_attribute *attr,
> @@ -46,7 +46,7 @@ static ssize_t chip_height_show(struct device *dev,
> Â{
> Â return sprintf(page, "%u\n", smp_height);
> Â}
> -static DEVICE_ATTR(chip_height, 0444, chip_height_show, NULL);
> +static DEVICE_ATTR_RO(chip_height);
> Â
> Âstatic ssize_t chip_serial_show(struct device *dev,
> Â struct device_attribute *attr,
> @@ -54,7 +54,7 @@ static ssize_t chip_serial_show(struct device *dev,
> Â{
> Â return get_hv_confstr(page, HV_CONFSTR_CHIP_SERIAL_NUM);
> Â}
> -static DEVICE_ATTR(chip_serial, 0444, chip_serial_show, NULL);
> +static DEVICE_ATTR_RO(chip_serial);
> Â
> Âstatic ssize_t chip_revision_show(struct device *dev,
> Â ÂÂstruct device_attribute *attr,
> @@ -62,7 +62,7 @@ static ssize_t chip_revision_show(struct device
> *dev,
> Â{
> Â return get_hv_confstr(page, HV_CONFSTR_CHIP_REV);
> Â}
> -static DEVICE_ATTR(chip_revision, 0444, chip_revision_show, NULL);
> +static DEVICE_ATTR_RO(chip_revision);
> Â
> Â
> Âstatic ssize_t type_show(struct device *dev,
> @@ -71,7 +71,7 @@ static ssize_t type_show(struct device *dev,
> Â{
> Â return sprintf(page, "tilera\n");
> Â}
> -static DEVICE_ATTR(type, 0444, type_show, NULL);
> +static DEVICE_ATTR_RO(type);
> Â
> Â#define HV_CONF_ATTR(name, conf)
> \
> Â static ssize_t name ## _show(struct device *dev,
> \
> diff --git a/drivers/acpi/device_sysfs.c
> b/drivers/acpi/device_sysfs.c
> index a041689e5701..545e91420cde 100644
> --- a/drivers/acpi/device_sysfs.c
> +++ b/drivers/acpi/device_sysfs.c
> @@ -357,7 +357,7 @@ static ssize_t real_power_state_show(struct
> device *dev,
> Â return sprintf(buf, "%s\n", acpi_power_state_string(state));
> Â}
> Â
> -static DEVICE_ATTR(real_power_state, 0444, real_power_state_show,
> NULL);
> +static DEVICE_ATTR_RO(real_power_state);
> Â
> Âstatic ssize_t power_state_show(struct device *dev,
> Â struct device_attribute *attr, char
> *buf)
> @@ -367,7 +367,7 @@ static ssize_t power_state_show(struct device
> *dev,
> Â return sprintf(buf, "%s\n", acpi_power_state_string(adev-
> >power.state));
> Â}
> Â
> -static DEVICE_ATTR(power_state, 0444, power_state_show, NULL);
> +static DEVICE_ATTR_RO(power_state);
> Â
> Âstatic ssize_t
> Âacpi_eject_store(struct device *d, struct device_attribute *attr,
> @@ -462,7 +462,7 @@ static ssize_t description_show(struct device
> *dev,
> Â
> Â return result;
> Â}
> -static DEVICE_ATTR(description, 0444, description_show, NULL);
> +static DEVICE_ATTR_RO(description);
> Â
> Âstatic ssize_t
> Âacpi_device_sun_show(struct device *dev, struct device_attribute
> *attr,
> diff --git a/drivers/char/ipmi/ipmi_msghandler.c
> b/drivers/char/ipmi/ipmi_msghandler.c
> index f45732a2cb3e..7f51acd74e10 100644
> --- a/drivers/char/ipmi/ipmi_msghandler.c
> +++ b/drivers/char/ipmi/ipmi_msghandler.c
> @@ -2588,7 +2588,7 @@ static ssize_t device_id_show(struct device
> *dev,
> Â
> Â return snprintf(buf, 10, "%u\n", id.device_id);
> Â}
> -static DEVICE_ATTR(device_id, S_IRUGO, device_id_show, NULL);
> +static DEVICE_ATTR_RO(device_id);
> Â
> Âstatic ssize_t provides_device_sdrs_show(struct device *dev,
> Â Âstruct device_attribute
> *attr,
> @@ -2604,8 +2604,7 @@ static ssize_t provides_device_sdrs_show(struct
> device *dev,
> Â
> Â return snprintf(buf, 10, "%u\n", (id.device_revision & 0x80)
> >> 7);
> Â}
> -static DEVICE_ATTR(provides_device_sdrs, S_IRUGO,
> provides_device_sdrs_show,
> - ÂÂÂNULL);
> +static DEVICE_ATTR_RO(provides_device_sdrs);
> Â
> Âstatic ssize_t revision_show(struct device *dev, struct
> device_attribute *attr,
> Â ÂÂÂÂÂchar *buf)
> @@ -2620,7 +2619,7 @@ static ssize_t revision_show(struct device
> *dev, struct device_attribute *attr,
> Â
> Â return snprintf(buf, 20, "%u\n", id.device_revision & 0x0F);
> Â}
> -static DEVICE_ATTR(revision, S_IRUGO, revision_show, NULL);
> +static DEVICE_ATTR_RO(revision);
> Â
> Âstatic ssize_t firmware_revision_show(struct device *dev,
> Â ÂÂÂÂÂÂstruct device_attribute *attr,
> @@ -2637,7 +2636,7 @@ static ssize_t firmware_revision_show(struct
> device *dev,
> Â return snprintf(buf, 20, "%u.%x\n", id.firmware_revision_1,
> Â id.firmware_revision_2);
> Â}
> -static DEVICE_ATTR(firmware_revision, S_IRUGO,
> firmware_revision_show, NULL);
> +static DEVICE_ATTR_RO(firmware_revision);
> Â
> Âstatic ssize_t ipmi_version_show(struct device *dev,
> Â Âstruct device_attribute *attr,
> @@ -2655,7 +2654,7 @@ static ssize_t ipmi_version_show(struct device
> *dev,
> Â ipmi_version_major(&id),
> Â ipmi_version_minor(&id));
> Â}
> -static DEVICE_ATTR(ipmi_version, S_IRUGO, ipmi_version_show, NULL);
> +static DEVICE_ATTR_RO(ipmi_version);
> Â
> Âstatic ssize_t add_dev_support_show(struct device *dev,
> Â ÂÂÂÂstruct device_attribute *attr,
> @@ -2688,7 +2687,7 @@ static ssize_t manufacturer_id_show(struct
> device *dev,
> Â
> Â return snprintf(buf, 20, "0x%6.6x\n", id.manufacturer_id);
> Â}
> -static DEVICE_ATTR(manufacturer_id, S_IRUGO, manufacturer_id_show,
> NULL);
> +static DEVICE_ATTR_RO(manufacturer_id);
> Â
> Âstatic ssize_t product_id_show(struct device *dev,
> Â ÂÂÂÂÂÂÂstruct device_attribute *attr,
> @@ -2704,7 +2703,7 @@ static ssize_t product_id_show(struct device
> *dev,
> Â
> Â return snprintf(buf, 10, "0x%4.4x\n", id.product_id);
> Â}
> -static DEVICE_ATTR(product_id, S_IRUGO, product_id_show, NULL);
> +static DEVICE_ATTR_RO(product_id);
> Â
> Âstatic ssize_t aux_firmware_rev_show(struct device *dev,
> Â ÂÂÂÂÂstruct device_attribute *attr,
> @@ -2742,7 +2741,7 @@ static ssize_t guid_show(struct device *dev,
> struct device_attribute *attr,
> Â
> Â return snprintf(buf, 38, "%pUl\n", guid.b);
> Â}
> -static DEVICE_ATTR(guid, S_IRUGO, guid_show, NULL);
> +static DEVICE_ATTR_RO(guid);
> Â
> Âstatic struct attribute *bmc_dev_attrs[] = {
> Â &dev_attr_device_id.attr,
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index 1d0ab8ff5915..b33d2158c234 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -445,13 +445,13 @@ static ssize_t gt_min_freq_mhz_store(struct
> device *kdev,
> Â return ret ?: count;
> Â}
> Â
> -static DEVICE_ATTR(gt_act_freq_mhz, S_IRUGO, gt_act_freq_mhz_show,
> NULL);
> -static DEVICE_ATTR(gt_cur_freq_mhz, S_IRUGO, gt_cur_freq_mhz_show,
> NULL);
> +static DEVICE_ATTR_RO(gt_act_freq_mhz);
> +static DEVICE_ATTR_RO(gt_cur_freq_mhz);
> Âstatic DEVICE_ATTR_RW(gt_boost_freq_mhz);
> Âstatic DEVICE_ATTR_RW(gt_max_freq_mhz);
> Âstatic DEVICE_ATTR_RW(gt_min_freq_mhz);
> Â
> -static DEVICE_ATTR(vlv_rpe_freq_mhz, S_IRUGO, vlv_rpe_freq_mhz_show,
> NULL);
> +static DEVICE_ATTR_RO(vlv_rpe_freq_mhz);
> Â
> Âstatic ssize_t gt_rp_mhz_show(struct device *kdev, struct
> device_attribute *attr, char *buf);
> Âstatic DEVICE_ATTR(gt_RP0_freq_mhz, S_IRUGO, gt_rp_mhz_show, NULL);
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index 63691e251f8c..8f9fa6f1dfb4 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -2516,14 +2516,14 @@ static ssize_t wwid_show(struct device *dev,
> struct device_attribute *attr,
> Â serial_len, subsys->serial, model_len, subsys-
> >model,
> Â head->ns_id);
> Â}
> -static DEVICE_ATTR(wwid, S_IRUGO, wwid_show, NULL);
> +static DEVICE_ATTR_RO(wwid);
> Â
> Âstatic ssize_t nguid_show(struct device *dev, struct
> device_attribute *attr,
> Â char *buf)
> Â{
> Â return sprintf(buf, "%pU\n", dev_to_ns_head(dev)-
> >ids.nguid);
> Â}
> -static DEVICE_ATTR(nguid, S_IRUGO, nguid_show, NULL);
> +static DEVICE_ATTR_RO(nguid);
> Â
> Âstatic ssize_t uuid_show(struct device *dev, struct device_attribute
> *attr,
> Â char *buf)
> @@ -2540,21 +2540,21 @@ static ssize_t uuid_show(struct device *dev,
> struct device_attribute *attr,
> Â }
> Â return sprintf(buf, "%pU\n", &ids->uuid);
> Â}
> -static DEVICE_ATTR(uuid, S_IRUGO, uuid_show, NULL);
> +static DEVICE_ATTR_RO(uuid);
> Â
> Âstatic ssize_t eui_show(struct device *dev, struct device_attribute
> *attr,
> Â char *buf)
> Â{
> Â return sprintf(buf, "%8ph\n", dev_to_ns_head(dev)-
> >ids.eui64);
> Â}
> -static DEVICE_ATTR(eui, S_IRUGO, eui_show, NULL);
> +static DEVICE_ATTR_RO(eui);
> Â
> Âstatic ssize_t nsid_show(struct device *dev, struct device_attribute
> *attr,
> Â char *buf)
> Â{
> Â return sprintf(buf, "%d\n", dev_to_ns_head(dev)->ns_id);
> Â}
> -static DEVICE_ATTR(nsid, S_IRUGO, nsid_show, NULL);
> +static DEVICE_ATTR_RO(nsid);
> Â
> Âstatic struct attribute *nvme_ns_id_attrs[] = {
> Â &dev_attr_wwid.attr,
> diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c
> index 0f11dce6e224..9263a0fb3858 100644
> --- a/drivers/s390/cio/css.c
> +++ b/drivers/s390/cio/css.c
> @@ -268,7 +268,7 @@ static ssize_t type_show(struct device *dev,
> struct device_attribute *attr,
> Â return sprintf(buf, "%01x\n", sch->st);
> Â}
> Â
> -static DEVICE_ATTR(type, 0444, type_show, NULL);
> +static DEVICE_ATTR_RO(type);
> Â
> Âstatic ssize_t modalias_show(struct device *dev, struct
> device_attribute *attr,
> Â ÂÂÂÂÂchar *buf)
> @@ -278,7 +278,7 @@ static ssize_t modalias_show(struct device *dev,
> struct device_attribute *attr,
> Â return sprintf(buf, "css:t%01X\n", sch->st);
> Â}
> Â
> -static DEVICE_ATTR(modalias, 0444, modalias_show, NULL);
> +static DEVICE_ATTR_RO(modalias);
> Â
> Âstatic struct attribute *subch_attrs[] = {
> Â &dev_attr_type.attr,
> @@ -315,7 +315,7 @@ static ssize_t chpids_show(struct device *dev,
> Â ret += sprintf(buf + ret, "\n");
> Â return ret;
> Â}
> -static DEVICE_ATTR(chpids, 0444, chpids_show, NULL);
> +static DEVICE_ATTR_RO(chpids);
> Â
> Âstatic ssize_t pimpampom_show(struct device *dev,
> Â ÂÂÂÂÂÂstruct device_attribute *attr,
> @@ -327,7 +327,7 @@ static ssize_t pimpampom_show(struct device *dev,
> Â return sprintf(buf, "%02x %02x %02x\n",
> Â ÂÂÂÂÂÂÂpmcw->pim, pmcw->pam, pmcw->pom);
> Â}
> -static DEVICE_ATTR(pimpampom, 0444, pimpampom_show, NULL);
> +static DEVICE_ATTR_RO(pimpampom);
> Â
> Âstatic struct attribute *io_subchannel_type_attrs[] = {
> Â &dev_attr_chpids.attr,
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 6eefb67b31f3..f50ea035aa9b 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -597,13 +597,13 @@ static ssize_t vpm_show(struct device *dev,
> struct device_attribute *attr,
> Â return sprintf(buf, "%02x\n", sch->vpm);
> Â}
> Â
> -static DEVICE_ATTR(devtype, 0444, devtype_show, NULL);
> -static DEVICE_ATTR(cutype, 0444, cutype_show, NULL);
> -static DEVICE_ATTR(modalias, 0444, modalias_show, NULL);
> +static DEVICE_ATTR_RO(devtype);
> +static DEVICE_ATTR_RO(cutype);
> +static DEVICE_ATTR_RO(modalias);
> Âstatic DEVICE_ATTR_RW(online);
> Âstatic DEVICE_ATTR(availability, 0444, available_show, NULL);
> Âstatic DEVICE_ATTR(logging, 0200, NULL, initiate_logging);
> -static DEVICE_ATTR(vpm, 0444, vpm_show, NULL);
> +static DEVICE_ATTR_RO(vpm);
> Â
> Âstatic struct attribute *io_subchannel_attrs[] = {
> Â &dev_attr_logging.attr,
> diff --git a/drivers/s390/crypto/ap_card.c
> b/drivers/s390/crypto/ap_card.c
> index 97a8cf578116..2c726df210f6 100644
> --- a/drivers/s390/crypto/ap_card.c
> +++ b/drivers/s390/crypto/ap_card.c
> @@ -57,7 +57,7 @@ static ssize_t ap_functions_show(struct device
> *dev,
> Â return snprintf(buf, PAGE_SIZE, "0x%08X\n", ac->functions);
> Â}
> Â
> -static DEVICE_ATTR(ap_functions, 0444, ap_functions_show, NULL);
> +static DEVICE_ATTR_RO(ap_functions);
> Â
> Âstatic ssize_t ap_req_count_show(struct device *dev,
> Â Âstruct device_attribute *attr,
> diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
> index b0aa5dc1d54c..d62377b68ef4 100644
> --- a/drivers/scsi/hpsa.c
> +++ b/drivers/scsi/hpsa.c
> @@ -901,14 +901,14 @@ static ssize_t host_show_legacy_board(struct
> device *dev,
> Â return snprintf(buf, 20, "%d\n", h->legacy_board ? 1 : 0);
> Â}
> Â
> -static DEVICE_ATTR(raid_level, S_IRUGO, raid_level_show, NULL);
> -static DEVICE_ATTR(lunid, S_IRUGO, lunid_show, NULL);
> -static DEVICE_ATTR(unique_id, S_IRUGO, unique_id_show, NULL);
> +static DEVICE_ATTR_RO(raid_level);
> +static DEVICE_ATTR_RO(lunid);
> +static DEVICE_ATTR_RO(unique_id);
> Âstatic DEVICE_ATTR(rescan, S_IWUSR, NULL, host_store_rescan);
> -static DEVICE_ATTR(sas_address, S_IRUGO, sas_address_show, NULL);
> +static DEVICE_ATTR_RO(sas_address);
> Âstatic DEVICE_ATTR(hp_ssd_smart_path_enabled, S_IRUGO,
> Â host_show_hp_ssd_smart_path_enabled, NULL);
> -static DEVICE_ATTR(path_info, S_IRUGO, path_info_show, NULL);
> +static DEVICE_ATTR_RO(path_info);
> Âstatic DEVICE_ATTR(hp_ssd_smart_path_status,
> S_IWUSR|S_IRUGO|S_IROTH,
> Â host_show_hp_ssd_smart_path_status,
> Â host_store_hp_ssd_smart_path_status);
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 95f7ba3c3f1a..517ff203cfde 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2294,8 +2294,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);
> @@ -2306,12 +2306,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);
> @@ -3719,8 +3718,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
> diff --git a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> index a1c81c12718c..4338b8a1309f 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp2/hmm/hmm.c
> @@ -158,10 +158,10 @@ static ssize_t dynamic_pool_show(struct device
> *dev,
> Â return ret;
> Â};
> Â
> -static DEVICE_ATTR(active_bo, 0444, active_bo_show, NULL);
> -static DEVICE_ATTR(free_bo, 0444, free_bo_show, NULL);
> -static DEVICE_ATTR(reserved_pool, 0444, reserved_pool_show, NULL);
> -static DEVICE_ATTR(dynamic_pool, 0444, dynamic_pool_show, NULL);
> +static DEVICE_ATTR_RO(active_bo);
> +static DEVICE_ATTR_RO(free_bo);
> +static DEVICE_ATTR_RO(reserved_pool);
> +static DEVICE_ATTR_RO(dynamic_pool);
> Â
> Âstatic struct attribute *sysfs_attrs_ctrl[] = {
> Â &dev_attr_active_bo.attr,
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index c008af7fb480..2bc964392924 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -396,10 +396,10 @@ create_s32_tzp_attr(offset);
> Â * All the attributes created for tzp (create_s32_tzp_attr) also are
> always
> Â * present on the sysfs interface.
> Â */
> -static DEVICE_ATTR(type, 0444, type_show, NULL);
> -static DEVICE_ATTR(temp, 0444, temp_show, NULL);
> +static DEVICE_ATTR_RO(type);
> +static DEVICE_ATTR_RO(temp);
> Âstatic DEVICE_ATTR_RW(policy);
> -static DEVICE_ATTR(available_policies, S_IRUGO,
> available_policies_show, NULL);
> +static DEVICE_ATTR_RO(available_policies);
> Âstatic DEVICE_ATTR_RW(sustainable_power);
> Â
> Â/* These thermal zone device attributes are created based on
> conditions */
> diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
> index 2d392f2d7ffe..9a380e55f4af 100644
> --- a/sound/soc/soc-core.c
> +++ b/sound/soc/soc-core.c
> @@ -173,7 +173,7 @@ static ssize_t codec_reg_show(struct device *dev,
> Â return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0);
> Â}
> Â
> -static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
> +static DEVICE_ATTR_RO(codec_reg);
> Â
> Âstatic ssize_t pmdown_time_show(struct device *dev,
> Â struct device_attribute *attr, char
> *buf)
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index a10b21cfc31e..d1977ced895f 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -2364,7 +2364,7 @@ static ssize_t dapm_widget_show(struct device
> *dev,
> Â return count;
> Â}
> Â
> -static DEVICE_ATTR(dapm_widget, 0444, dapm_widget_show, NULL);
> +static DEVICE_ATTR_RO(dapm_widget);
> Â
> Âstruct attribute *soc_dapm_dev_attrs[] = {
> Â &dev_attr_dapm_widget.attr,