From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Joe Perches <joe@perches.com>
Cc: Don Brace <don.brace@microsemi.com>,
linux-nvme@lists.infradead.org, Rich Felker <dalias@libc.org>,
linux-sh@vger.kernel.org, David Airlie <airlied@linux.ie>,
esc.storagedev@microsemi.com,
Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Heiko Carstens <heiko.carstens@de.ibm.com>,
alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org,
Russell King <linux@armlinux.org.uk>,
Keith Busch <keith.busch@intel.com>,
Robert Jarzmik <robert.jarzmik@free.fr>,
Christoph Hellwig <hch@lst.de>,
devel@driverdev.osuosl.org, linux-s390@vger.kernel.org,
"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
Sagi Grimberg <sagi@grimberg.me>,
Yoshinori Sato <ysato@users.sourceforge.jp>,
Takashi Iwai <tiwai@suse.com>,
Sebastian Ott <sebott@linux.vnet.ibm.com>,
James Smart <james.smart@broadcom.com>,
linux-acpi@vger.kernel.org, Zhang Rui <rui.zhang@intel.com>,
Len Brown <lenb@kernel.org>
Subject: Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
Date: Wed, 20 Dec 2017 20:00:43 +0100 [thread overview]
Message-ID: <5619005.tOTWM00GFv@aspire.rjw.lan> (raw)
In-Reply-To: <2e64e7d278fa9e4e255221fb84717884a7bfb69c.1513706701.git.joe@perches.com>
On Tuesday, December 19, 2017 7:15:08 PM CET 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@perches.com>
> ---
> 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 +++---
> 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,
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
for this bit.
Thanks!
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-12-20 19:01 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-19 18:15 [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo> Joe Perches
2017-12-19 18:15 ` [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW Joe Perches
2017-12-19 18:41 ` Andy Shevchenko
2017-12-20 7:19 ` [alsa-devel] " Jidong Zhang
2017-12-20 8:34 ` Jarkko Nikula
2017-12-20 9:24 ` Joe Perches
2017-12-20 9:32 ` Greg Kroah-Hartman
2017-12-20 9:54 ` Joe Perches
2017-12-20 9:59 ` Greg Kroah-Hartman
2017-12-20 10:55 ` Joe Perches
2017-12-20 13:26 ` Julia Lawall
2017-12-20 10:54 ` Jarkko Nikula
2018-01-10 14:43 ` Peter Ujfalusi
2017-12-21 0:47 ` Zhang Rui
2018-01-03 15:16 ` Bartlomiej Zolnierkiewicz
2017-12-19 18:15 ` [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO Joe Perches
2017-12-20 19:00 ` Rafael J. Wysocki [this message]
2017-12-20 20:26 ` Sagi Grimberg
2017-12-20 21:38 ` Robert Jarzmik
2017-12-21 0:48 ` Zhang Rui
2017-12-21 7:55 ` Harald Freudenberger
2017-12-21 9:34 ` Sakari Ailus
2018-01-09 15:34 ` Greg Kroah-Hartman
2017-12-19 18:54 ` [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo> Jani Nikula
2017-12-19 19:26 ` Corey Minyard
2017-12-20 9:46 ` Felipe Balbi
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=5619005.tOTWM00GFv@aspire.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=airlied@linux.ie \
--cc=alsa-devel@alsa-project.org \
--cc=dalias@libc.org \
--cc=devel@driverdev.osuosl.org \
--cc=don.brace@microsemi.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=esc.storagedev@microsemi.com \
--cc=hch@lst.de \
--cc=heiko.carstens@de.ibm.com \
--cc=james.smart@broadcom.com \
--cc=jejb@linux.vnet.ibm.com \
--cc=joe@perches.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=keith.busch@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-nvme@lists.infradead.org \
--cc=linux-s390@vger.kernel.org \
--cc=linux-sh@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=robert.jarzmik@free.fr \
--cc=rui.zhang@intel.com \
--cc=sagi@grimberg.me \
--cc=sebott@linux.vnet.ibm.com \
--cc=tiwai@suse.com \
--cc=ysato@users.sourceforge.jp \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox