All of lore.kernel.org
 help / color / mirror / Atom feed
* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:15 ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: linux-arm-kernel, linux-acpi, openipmi-developer, intel-gfx,
	linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c                     |  4 +-
 arch/s390/kernel/smp.c                             |  2 +-
 arch/s390/kernel/topology.c                        |  3 +-
 arch/sh/drivers/push-switch.c                      |  2 +-
 arch/tile/kernel/sysfs.c                           | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c               |  2 +-
 drivers/acpi/device_sysfs.c                        |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c             |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  2 +-
 drivers/net/wimax/i2400m/sysfs.c                   |  3 +-
 drivers/nvme/host/core.c                           | 10 ++--
 drivers/platform/x86/compal-laptop.c               | 18 ++----
 drivers/s390/cio/css.c                             |  8 +--
 drivers/s390/cio/device.c                          | 10 ++--
 drivers/s390/crypto/ap_card.c                      |  2 +-
 drivers/scsi/hpsa.c                                | 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c                      | 64 ++++++++--------------
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c                    | 17 +++---
 drivers/tty/serial/sh-sci.c                        |  2 +-
 drivers/usb/host/xhci-dbgcap.c                     |  2 +-
 drivers/usb/phy/phy-tahvo.c                        |  2 +-
 drivers/video/fbdev/auo_k190x.c                    |  4 +-
 drivers/video/fbdev/w100fb.c                       |  4 +-
 include/linux/sysfs.h                              | 14 ++---
 lib/test_firmware.c                                | 14 ++---
 lib/test_kmod.c                                    | 14 ++---
 sound/soc/omap/mcbsp.c                             |  4 +-
 sound/soc/soc-core.c                               |  2 +-
 sound/soc/soc-dapm.c                               |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0


^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:15 ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: linux-arm-kernel, linux-acpi, openipmi-developer, intel-gfx,
	linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c                     |  4 +-
 arch/s390/kernel/smp.c                             |  2 +-
 arch/s390/kernel/topology.c                        |  3 +-
 arch/sh/drivers/push-switch.c                      |  2 +-
 arch/tile/kernel/sysfs.c                           | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c               |  2 +-
 drivers/acpi/device_sysfs.c                        |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c             |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  2 +-
 drivers/net/wimax/i2400m/sysfs.c                   |  3 +-
 drivers/nvme/host/core.c                           | 10 ++--
 drivers/platform/x86/compal-laptop.c               | 18 ++----
 drivers/s390/cio/css.c                             |  8 +--
 drivers/s390/cio/device.c                          | 10 ++--
 drivers/s390/crypto/ap_card.c                      |  2 +-
 drivers/scsi/hpsa.c                                | 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c                      | 64 ++++++++--------------
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c                    | 17 +++---
 drivers/tty/serial/sh-sci.c                        |  2 +-
 drivers/usb/host/xhci-dbgcap.c                     |  2 +-
 drivers/usb/phy/phy-tahvo.c                        |  2 +-
 drivers/video/fbdev/auo_k190x.c                    |  4 +-
 drivers/video/fbdev/w100fb.c                       |  4 +-
 include/linux/sysfs.h                              | 14 ++---
 lib/test_firmware.c                                | 14 ++---
 lib/test_kmod.c                                    | 14 ++---
 sound/soc/omap/mcbsp.c                             |  4 +-
 sound/soc/soc-core.c                               |  2 +-
 sound/soc/soc-dapm.c                               |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:15 ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: linux-arm-kernel, linux-acpi, openipmi-developer, intel-gfx,
	linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: linux-sh, dri-devel, linux-input, linux-media, devel, linux-fbdev

Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c                     |  4 +-
 arch/s390/kernel/smp.c                             |  2 +-
 arch/s390/kernel/topology.c                        |  3 +-
 arch/sh/drivers/push-switch.c                      |  2 +-
 arch/tile/kernel/sysfs.c                           | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c               |  2 +-
 drivers/acpi/device_sysfs.c                        |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c             |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  2 +-
 drivers/net/wimax/i2400m/sysfs.c                   |  3 +-
 drivers/nvme/host/core.c                           | 10 ++--
 drivers/platform/x86/compal-laptop.c               | 18 ++----
 drivers/s390/cio/css.c                             |  8 +--
 drivers/s390/cio/device.c                          | 10 ++--
 drivers/s390/crypto/ap_card.c                      |  2 +-
 drivers/scsi/hpsa.c                                | 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c                      | 64 ++++++++--------------
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c                    | 17 +++---
 drivers/tty/serial/sh-sci.c                        |  2 +-
 drivers/usb/host/xhci-dbgcap.c                     |  2 +-
 drivers/usb/phy/phy-tahvo.c                        |  2 +-
 drivers/video/fbdev/auo_k190x.c                    |  4 +-
 drivers/video/fbdev/w100fb.c                       |  4 +-
 include/linux/sysfs.h                              | 14 ++---
 lib/test_firmware.c                                | 14 ++---
 lib/test_kmod.c                                    | 14 ++---
 sound/soc/omap/mcbsp.c                             |  4 +-
 sound/soc/soc-core.c                               |  2 +-
 sound/soc/soc-dapm.c                               |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:15 ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)


Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c                     |  4 +-
 arch/s390/kernel/smp.c                             |  2 +-
 arch/s390/kernel/topology.c                        |  3 +-
 arch/sh/drivers/push-switch.c                      |  2 +-
 arch/tile/kernel/sysfs.c                           | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c               |  2 +-
 drivers/acpi/device_sysfs.c                        |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c             |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  2 +-
 drivers/net/wimax/i2400m/sysfs.c                   |  3 +-
 drivers/nvme/host/core.c                           | 10 ++--
 drivers/platform/x86/compal-laptop.c               | 18 ++----
 drivers/s390/cio/css.c                             |  8 +--
 drivers/s390/cio/device.c                          | 10 ++--
 drivers/s390/crypto/ap_card.c                      |  2 +-
 drivers/scsi/hpsa.c                                | 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c                      | 64 ++++++++--------------
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c                    | 17 +++---
 drivers/tty/serial/sh-sci.c                        |  2 +-
 drivers/usb/host/xhci-dbgcap.c                     |  2 +-
 drivers/usb/phy/phy-tahvo.c                        |  2 +-
 drivers/video/fbdev/auo_k190x.c                    |  4 +-
 drivers/video/fbdev/w100fb.c                       |  4 +-
 include/linux/sysfs.h                              | 14 ++---
 lib/test_firmware.c                                | 14 ++---
 lib/test_kmod.c                                    | 14 ++---
 sound/soc/omap/mcbsp.c                             |  4 +-
 sound/soc/soc-core.c                               |  2 +-
 sound/soc/soc-dapm.c                               |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:15 ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: linux-arm-kernel

Joe Perches (4):
  sysfs.h: Use octal permissions
  treewide: Use DEVICE_ATTR_RW
  treewide: Use DEVICE_ATTR_RO
  treewide: Use DEVICE_ATTR_WO

 arch/arm/mach-pxa/sharpsl_pm.c                     |  4 +-
 arch/s390/kernel/smp.c                             |  2 +-
 arch/s390/kernel/topology.c                        |  3 +-
 arch/sh/drivers/push-switch.c                      |  2 +-
 arch/tile/kernel/sysfs.c                           | 12 ++--
 arch/x86/kernel/cpu/microcode/core.c               |  2 +-
 drivers/acpi/device_sysfs.c                        |  6 +-
 drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---
 drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--
 drivers/input/touchscreen/elants_i2c.c             |  2 +-
 drivers/net/ethernet/ibm/ibmvnic.c                 |  2 +-
 drivers/net/wimax/i2400m/sysfs.c                   |  3 +-
 drivers/nvme/host/core.c                           | 10 ++--
 drivers/platform/x86/compal-laptop.c               | 18 ++----
 drivers/s390/cio/css.c                             |  8 +--
 drivers/s390/cio/device.c                          | 10 ++--
 drivers/s390/crypto/ap_card.c                      |  2 +-
 drivers/scsi/hpsa.c                                | 10 ++--
 drivers/scsi/lpfc/lpfc_attr.c                      | 64 ++++++++--------------
 .../staging/media/atomisp/pci/atomisp2/hmm/hmm.c   |  8 +--
 drivers/thermal/thermal_sysfs.c                    | 17 +++---
 drivers/tty/serial/sh-sci.c                        |  2 +-
 drivers/usb/host/xhci-dbgcap.c                     |  2 +-
 drivers/usb/phy/phy-tahvo.c                        |  2 +-
 drivers/video/fbdev/auo_k190x.c                    |  4 +-
 drivers/video/fbdev/w100fb.c                       |  4 +-
 include/linux/sysfs.h                              | 14 ++---
 lib/test_firmware.c                                | 14 ++---
 lib/test_kmod.c                                    | 14 ++---
 sound/soc/omap/mcbsp.c                             |  4 +-
 sound/soc/soc-core.c                               |  2 +-
 sound/soc/soc-dapm.c                               |  2 +-
 32 files changed, 120 insertions(+), 158 deletions(-)

-- 
2.15.0

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 1/4] sysfs.h: Use octal permissions
  2017-12-19 18:15 ` Joe Perches
                   ` (3 preceding siblings ...)
  (?)
@ 2017-12-19 18:15 ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: linux-kernel

Use the more common and preferred octal directly.

Signed-off-by: Joe Perches <joe@perches.com>
---
 include/linux/sysfs.h | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h
index 40839c02d28c..b8bfdc173ec0 100644
--- a/include/linux/sysfs.h
+++ b/include/linux/sysfs.h
@@ -113,7 +113,7 @@ struct attribute_group {
 }
 
 #define __ATTR_RO(_name) {						\
-	.attr	= { .name = __stringify(_name), .mode = S_IRUGO },	\
+	.attr	= { .name = __stringify(_name), .mode = 0444 },		\
 	.show	= _name##_show,						\
 }
 
@@ -124,12 +124,11 @@ struct attribute_group {
 }
 
 #define __ATTR_WO(_name) {						\
-	.attr	= { .name = __stringify(_name), .mode = S_IWUSR },	\
+	.attr	= { .name = __stringify(_name), .mode = 0200 },		\
 	.store	= _name##_store,					\
 }
 
-#define __ATTR_RW(_name) __ATTR(_name, (S_IWUSR | S_IRUGO),		\
-			 _name##_show, _name##_store)
+#define __ATTR_RW(_name) __ATTR(_name, 0644, _name##_show, _name##_store)
 
 #define __ATTR_NULL { .attr = { .name = NULL } }
 
@@ -192,14 +191,13 @@ struct bin_attribute {
 }
 
 #define __BIN_ATTR_RO(_name, _size) {					\
-	.attr	= { .name = __stringify(_name), .mode = S_IRUGO },	\
+	.attr	= { .name = __stringify(_name), .mode = 0444 },		\
 	.read	= _name##_read,						\
 	.size	= _size,						\
 }
 
-#define __BIN_ATTR_RW(_name, _size) __BIN_ATTR(_name,			\
-				   (S_IWUSR | S_IRUGO), _name##_read,	\
-				   _name##_write, _size)
+#define __BIN_ATTR_RW(_name, _size)					\
+	__BIN_ATTR(_name, 0644, _name##_read, _name##_write, _size)
 
 #define __BIN_ATTR_NULL __ATTR_NULL
 
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:15 ` Joe Perches
  (?)
  (?)
@ 2017-12-19 18:15   ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

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 <joe@perches.com>
---
 arch/s390/kernel/topology.c          |  3 +--
 arch/tile/kernel/sysfs.c             |  2 +-
 drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
 drivers/platform/x86/compal-laptop.c | 18 +++++----------
 drivers/s390/cio/device.c            |  2 +-
 drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
 drivers/thermal/thermal_sysfs.c      |  9 ++++----
 drivers/tty/serial/sh-sci.c          |  2 +-
 drivers/usb/host/xhci-dbgcap.c       |  2 +-
 drivers/usb/phy/phy-tahvo.c          |  2 +-
 drivers/video/fbdev/auo_k190x.c      |  4 ++--
 drivers/video/fbdev/w100fb.c         |  4 ++--
 lib/test_firmware.c                  | 14 +++++-------
 lib/test_kmod.c                      | 14 +++++-------
 sound/soc/omap/mcbsp.c               |  4 ++--
 15 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4d5b65e527b5..4b6e0397f66d 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device *dev,
 	put_online_cpus();
 	return rc ? rc : count;
 }
-static DEVICE_ATTR(dispatching, 0644, dispatching_show,
-			 dispatching_store);
+static DEVICE_ATTR_RW(dispatching);
 
 static ssize_t cpu_polarization_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 825867c53853..af5024f0fb5a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
 	return n < 0 ? n : count;
 }
 
-static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
+static DEVICE_ATTR_RW(hv_stats);
 
 static int hv_stats_device_add(struct device *dev, struct subsys_interface *sif)
 {
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index c74a20b80182..1d0ab8ff5915 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 
 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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR, gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
-static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store);
-static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store);
+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);
 
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 6bcb750e1865..4f9bc72f0584 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
 /* ============== */
 /* Driver Globals */
 /* ============== */
-static DEVICE_ATTR(wake_up_pme,
-		0644, wake_up_pme_show,		wake_up_pme_store);
-static DEVICE_ATTR(wake_up_modem,
-		0644, wake_up_modem_show,	wake_up_modem_store);
-static DEVICE_ATTR(wake_up_lan,
-		0644, wake_up_lan_show,	wake_up_lan_store);
-static DEVICE_ATTR(wake_up_wlan,
-		0644, wake_up_wlan_show,	wake_up_wlan_store);
-static DEVICE_ATTR(wake_up_key,
-		0644, wake_up_key_show,	wake_up_key_store);
-static DEVICE_ATTR(wake_up_mouse,
-		0644, wake_up_mouse_show,	wake_up_mouse_store);
+static DEVICE_ATTR_RW(wake_up_pme);
+static DEVICE_ATTR_RW(wake_up_modem);
+static DEVICE_ATTR_RW(wake_up_lan);
+static DEVICE_ATTR_RW(wake_up_wlan);
+static DEVICE_ATTR_RW(wake_up_key);
+static DEVICE_ATTR_RW(wake_up_mouse);
 
 static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
 static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 75a245f38e2e..6eefb67b31f3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev, struct device_attribute *attr,
 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(online, 0644, online_show, online_store);
+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);
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 797bb42a6306..95f7ba3c3f1a 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2519,8 +2519,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
@@ -2583,8 +2582,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
@@ -3102,8 +3100,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] = {
@@ -3336,8 +3333,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
@@ -3386,8 +3382,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
@@ -3580,8 +3575,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.
@@ -3695,8 +3689,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
@@ -3954,8 +3947,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.
@@ -4194,8 +4186,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)
@@ -4288,8 +4279,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
@@ -4436,8 +4426,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
@@ -4611,8 +4600,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.
@@ -4772,8 +4760,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.
@@ -4859,9 +4846,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
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index fb80c96d8f73..c008af7fb480 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
  */
 static DEVICE_ATTR(type, 0444, type_show, NULL);
 static DEVICE_ATTR(temp, 0444, temp_show, NULL);
-static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store);
+static DEVICE_ATTR_RW(policy);
 static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL);
-static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
-		   sustainable_power_store);
+static DEVICE_ATTR_RW(sustainable_power);
 
 /* These thermal zone device attributes are created based on conditions */
-static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
-static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
+static DEVICE_ATTR_RW(mode);
+static DEVICE_ATTR_RW(passive);
 
 /* These attributes are unconditionally added to a thermal zone */
 static struct attribute *thermal_zone_dev_attrs[] = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d9f399c4e90c..7257c078e155 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show, rx_fifo_timeout_store);
+static DEVICE_ATTR_RW(rx_fifo_timeout);
 
 
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 452df0f87d6e..a1ab8acf39ba 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
+static DEVICE_ATTR_RW(dbc);
 
 int xhci_dbc_init(struct xhci_hcd *xhci)
 {
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b3ce42edb373..7f7c5c82420d 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device *device,
 
 	return r;
 }
-static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
+static DEVICE_ATTR_RW(otg_mode);
 
 static struct attribute *tahvo_attributes[] = {
 	&dev_attr_vbus.attr,
diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c
index 0d06038324e0..1e383c547633 100644
--- a/drivers/video/fbdev/auo_k190x.c
+++ b/drivers/video/fbdev/auo_k190x.c
@@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%d\n", temp);
 }
 
-static DEVICE_ATTR(update_mode, 0644, update_mode_show, update_mode_store);
-static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
+static DEVICE_ATTR_RW(update_mode);
+static DEVICE_ATTR_RW(flash);
 static DEVICE_ATTR(temp, 0644, temp_show, NULL);
 
 static struct attribute *auok190x_attributes[] = {
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index d570e19a2864..035ff6e02894 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev, struct device_attribute *attr, con
 	return count;
 }
 
-static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
+static DEVICE_ATTR_RW(flip);
 
 static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
@@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *att
 	return count;
 }
 
-static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show, fastpllclk_store);
+static DEVICE_ATTR_RW(fastpllclk);
 
 /*
  * Some touchscreens need hsync information from the video driver to
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 64a4c76cba2b..964784dc1602 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev,
 {
 	return config_test_show_str(buf, test_fw_config->name);
 }
-static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store);
+static DEVICE_ATTR_RW(config_name);
 
 static ssize_t config_num_requests_store(struct device *dev,
 					 struct device_attribute *attr,
@@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->num_requests);
 }
-static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show,
-		   config_num_requests_store);
+static DEVICE_ATTR_RW(config_num_requests);
 
 static ssize_t config_sync_direct_store(struct device *dev,
 					struct device_attribute *attr,
@@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->sync_direct);
 }
-static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show,
-		   config_sync_direct_store);
+static DEVICE_ATTR_RW(config_sync_direct);
 
 static ssize_t config_send_uevent_store(struct device *dev,
 					struct device_attribute *attr,
@@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->send_uevent);
 }
-static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show,
-		   config_send_uevent_store);
+static DEVICE_ATTR_RW(config_send_uevent);
 
 static ssize_t config_read_fw_idx_store(struct device *dev,
 					struct device_attribute *attr,
@@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx);
 }
-static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show,
-		   config_read_fw_idx_store);
+static DEVICE_ATTR_RW(config_read_fw_idx);
 
 
 static ssize_t trigger_request_store(struct device *dev,
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..e372b97eee13 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_driver);
 }
-static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show,
-		   config_test_driver_store);
+static DEVICE_ATTR_RW(config_test_driver);
 
 static ssize_t config_test_fs_store(struct device *dev,
 				    struct device_attribute *attr,
@@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_fs);
 }
-static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
-		   config_test_fs_store);
+static DEVICE_ATTR_RW(config_test_fs);
 
 static int trigger_config_run_type(struct kmod_test_device *test_dev,
 				   enum kmod_test_case test_case,
@@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->num_threads);
 }
-static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show,
-		   config_num_threads_store);
+static DEVICE_ATTR_RW(config_num_threads);
 
 static ssize_t config_test_case_store(struct device *dev,
 				      struct device_attribute *attr,
@@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev,
 
 	return test_dev_config_show_uint(test_dev, buf, config->test_case);
 }
-static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
-		   config_test_case_store);
+static DEVICE_ATTR_RW(config_test_case);
 
 static ssize_t test_result_show(struct device *dev,
 				struct device_attribute *attr,
@@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->test_result);
 }
-static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store);
+static DEVICE_ATTR_RW(test_result);
 
 #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.attr
 
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 7a54e3083203..79d4dc785e5c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
+static DEVICE_ATTR_RW(dma_op_mode);
 
 static const struct attribute *additional_attrs[] = {
 	&dev_attr_max_tx_thres.attr,
@@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
+static DEVICE_ATTR_RW(st_taps);
 
 static const struct attribute *sidetone_attrs[] = {
 	&dev_attr_st_taps.attr,
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:15   ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: alsa-devel, Liam Girdwood, David Airlie, Heiko Carstens,
	linux-fbdev, dri-devel, Takashi Iwai, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, linux-pm, linux-serial,
	Jiri Slaby, platform-driver-x86, Bartlomiej Zolnierkiewicz,
	intel-gfx, Mark Brown, Jaroslav Kysela, Martin K. Petersen,
	linux-usb, linux-kernel, Martin Schwidefsky

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 <joe@perches.com>
---
 arch/s390/kernel/topology.c          |  3 +--
 arch/tile/kernel/sysfs.c             |  2 +-
 drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
 drivers/platform/x86/compal-laptop.c | 18 +++++----------
 drivers/s390/cio/device.c            |  2 +-
 drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
 drivers/thermal/thermal_sysfs.c      |  9 ++++----
 drivers/tty/serial/sh-sci.c          |  2 +-
 drivers/usb/host/xhci-dbgcap.c       |  2 +-
 drivers/usb/phy/phy-tahvo.c          |  2 +-
 drivers/video/fbdev/auo_k190x.c      |  4 ++--
 drivers/video/fbdev/w100fb.c         |  4 ++--
 lib/test_firmware.c                  | 14 +++++-------
 lib/test_kmod.c                      | 14 +++++-------
 sound/soc/omap/mcbsp.c               |  4 ++--
 15 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4d5b65e527b5..4b6e0397f66d 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device *dev,
 	put_online_cpus();
 	return rc ? rc : count;
 }
-static DEVICE_ATTR(dispatching, 0644, dispatching_show,
-			 dispatching_store);
+static DEVICE_ATTR_RW(dispatching);
 
 static ssize_t cpu_polarization_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 825867c53853..af5024f0fb5a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
 	return n < 0 ? n : count;
 }
 
-static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
+static DEVICE_ATTR_RW(hv_stats);
 
 static int hv_stats_device_add(struct device *dev, struct subsys_interface *sif)
 {
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index c74a20b80182..1d0ab8ff5915 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 
 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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR, gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
-static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store);
-static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store);
+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);
 
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 6bcb750e1865..4f9bc72f0584 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
 /* ============== */
 /* Driver Globals */
 /* ============== */
-static DEVICE_ATTR(wake_up_pme,
-		0644, wake_up_pme_show,		wake_up_pme_store);
-static DEVICE_ATTR(wake_up_modem,
-		0644, wake_up_modem_show,	wake_up_modem_store);
-static DEVICE_ATTR(wake_up_lan,
-		0644, wake_up_lan_show,	wake_up_lan_store);
-static DEVICE_ATTR(wake_up_wlan,
-		0644, wake_up_wlan_show,	wake_up_wlan_store);
-static DEVICE_ATTR(wake_up_key,
-		0644, wake_up_key_show,	wake_up_key_store);
-static DEVICE_ATTR(wake_up_mouse,
-		0644, wake_up_mouse_show,	wake_up_mouse_store);
+static DEVICE_ATTR_RW(wake_up_pme);
+static DEVICE_ATTR_RW(wake_up_modem);
+static DEVICE_ATTR_RW(wake_up_lan);
+static DEVICE_ATTR_RW(wake_up_wlan);
+static DEVICE_ATTR_RW(wake_up_key);
+static DEVICE_ATTR_RW(wake_up_mouse);
 
 static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
 static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 75a245f38e2e..6eefb67b31f3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev, struct device_attribute *attr,
 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(online, 0644, online_show, online_store);
+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);
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 797bb42a6306..95f7ba3c3f1a 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2519,8 +2519,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
@@ -2583,8 +2582,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
@@ -3102,8 +3100,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] = {
@@ -3336,8 +3333,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
@@ -3386,8 +3382,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
@@ -3580,8 +3575,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.
@@ -3695,8 +3689,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
@@ -3954,8 +3947,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.
@@ -4194,8 +4186,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)
@@ -4288,8 +4279,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
@@ -4436,8 +4426,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
@@ -4611,8 +4600,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.
@@ -4772,8 +4760,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.
@@ -4859,9 +4846,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
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index fb80c96d8f73..c008af7fb480 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
  */
 static DEVICE_ATTR(type, 0444, type_show, NULL);
 static DEVICE_ATTR(temp, 0444, temp_show, NULL);
-static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store);
+static DEVICE_ATTR_RW(policy);
 static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL);
-static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
-		   sustainable_power_store);
+static DEVICE_ATTR_RW(sustainable_power);
 
 /* These thermal zone device attributes are created based on conditions */
-static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
-static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
+static DEVICE_ATTR_RW(mode);
+static DEVICE_ATTR_RW(passive);
 
 /* These attributes are unconditionally added to a thermal zone */
 static struct attribute *thermal_zone_dev_attrs[] = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d9f399c4e90c..7257c078e155 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show, rx_fifo_timeout_store);
+static DEVICE_ATTR_RW(rx_fifo_timeout);
 
 
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 452df0f87d6e..a1ab8acf39ba 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
+static DEVICE_ATTR_RW(dbc);
 
 int xhci_dbc_init(struct xhci_hcd *xhci)
 {
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b3ce42edb373..7f7c5c82420d 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device *device,
 
 	return r;
 }
-static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
+static DEVICE_ATTR_RW(otg_mode);
 
 static struct attribute *tahvo_attributes[] = {
 	&dev_attr_vbus.attr,
diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c
index 0d06038324e0..1e383c547633 100644
--- a/drivers/video/fbdev/auo_k190x.c
+++ b/drivers/video/fbdev/auo_k190x.c
@@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%d\n", temp);
 }
 
-static DEVICE_ATTR(update_mode, 0644, update_mode_show, update_mode_store);
-static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
+static DEVICE_ATTR_RW(update_mode);
+static DEVICE_ATTR_RW(flash);
 static DEVICE_ATTR(temp, 0644, temp_show, NULL);
 
 static struct attribute *auok190x_attributes[] = {
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index d570e19a2864..035ff6e02894 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev, struct device_attribute *attr, con
 	return count;
 }
 
-static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
+static DEVICE_ATTR_RW(flip);
 
 static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
@@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *att
 	return count;
 }
 
-static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show, fastpllclk_store);
+static DEVICE_ATTR_RW(fastpllclk);
 
 /*
  * Some touchscreens need hsync information from the video driver to
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 64a4c76cba2b..964784dc1602 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev,
 {
 	return config_test_show_str(buf, test_fw_config->name);
 }
-static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store);
+static DEVICE_ATTR_RW(config_name);
 
 static ssize_t config_num_requests_store(struct device *dev,
 					 struct device_attribute *attr,
@@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->num_requests);
 }
-static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show,
-		   config_num_requests_store);
+static DEVICE_ATTR_RW(config_num_requests);
 
 static ssize_t config_sync_direct_store(struct device *dev,
 					struct device_attribute *attr,
@@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->sync_direct);
 }
-static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show,
-		   config_sync_direct_store);
+static DEVICE_ATTR_RW(config_sync_direct);
 
 static ssize_t config_send_uevent_store(struct device *dev,
 					struct device_attribute *attr,
@@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->send_uevent);
 }
-static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show,
-		   config_send_uevent_store);
+static DEVICE_ATTR_RW(config_send_uevent);
 
 static ssize_t config_read_fw_idx_store(struct device *dev,
 					struct device_attribute *attr,
@@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx);
 }
-static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show,
-		   config_read_fw_idx_store);
+static DEVICE_ATTR_RW(config_read_fw_idx);
 
 
 static ssize_t trigger_request_store(struct device *dev,
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..e372b97eee13 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_driver);
 }
-static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show,
-		   config_test_driver_store);
+static DEVICE_ATTR_RW(config_test_driver);
 
 static ssize_t config_test_fs_store(struct device *dev,
 				    struct device_attribute *attr,
@@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_fs);
 }
-static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
-		   config_test_fs_store);
+static DEVICE_ATTR_RW(config_test_fs);
 
 static int trigger_config_run_type(struct kmod_test_device *test_dev,
 				   enum kmod_test_case test_case,
@@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->num_threads);
 }
-static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show,
-		   config_num_threads_store);
+static DEVICE_ATTR_RW(config_num_threads);
 
 static ssize_t config_test_case_store(struct device *dev,
 				      struct device_attribute *attr,
@@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev,
 
 	return test_dev_config_show_uint(test_dev, buf, config->test_case);
 }
-static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
-		   config_test_case_store);
+static DEVICE_ATTR_RW(config_test_case);
 
 static ssize_t test_result_show(struct device *dev,
 				struct device_attribute *attr,
@@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->test_result);
 }
-static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store);
+static DEVICE_ATTR_RW(test_result);
 
 #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.attr
 
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 7a54e3083203..79d4dc785e5c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
+static DEVICE_ATTR_RW(dma_op_mode);
 
 static const struct attribute *additional_attrs[] = {
 	&dev_attr_max_tx_thres.attr,
@@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
+static DEVICE_ATTR_RW(st_taps);
 
 static const struct attribute *sidetone_attrs[] = {
 	&dev_attr_st_taps.attr,
-- 
2.15.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:15   ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

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 <joe@perches.com>
---
 arch/s390/kernel/topology.c          |  3 +--
 arch/tile/kernel/sysfs.c             |  2 +-
 drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
 drivers/platform/x86/compal-laptop.c | 18 +++++----------
 drivers/s390/cio/device.c            |  2 +-
 drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
 drivers/thermal/thermal_sysfs.c      |  9 ++++----
 drivers/tty/serial/sh-sci.c          |  2 +-
 drivers/usb/host/xhci-dbgcap.c       |  2 +-
 drivers/usb/phy/phy-tahvo.c          |  2 +-
 drivers/video/fbdev/auo_k190x.c      |  4 ++--
 drivers/video/fbdev/w100fb.c         |  4 ++--
 lib/test_firmware.c                  | 14 +++++-------
 lib/test_kmod.c                      | 14 +++++-------
 sound/soc/omap/mcbsp.c               |  4 ++--
 15 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4d5b65e527b5..4b6e0397f66d 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device *dev,
 	put_online_cpus();
 	return rc ? rc : count;
 }
-static DEVICE_ATTR(dispatching, 0644, dispatching_show,
-			 dispatching_store);
+static DEVICE_ATTR_RW(dispatching);
 
 static ssize_t cpu_polarization_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 825867c53853..af5024f0fb5a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
 	return n < 0 ? n : count;
 }
 
-static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
+static DEVICE_ATTR_RW(hv_stats);
 
 static int hv_stats_device_add(struct device *dev, struct subsys_interface *sif)
 {
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index c74a20b80182..1d0ab8ff5915 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 
 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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR, gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
-static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store);
-static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store);
+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);
 
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 6bcb750e1865..4f9bc72f0584 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
 /* ============== */
 /* Driver Globals */
 /* ============== */
-static DEVICE_ATTR(wake_up_pme,
-		0644, wake_up_pme_show,		wake_up_pme_store);
-static DEVICE_ATTR(wake_up_modem,
-		0644, wake_up_modem_show,	wake_up_modem_store);
-static DEVICE_ATTR(wake_up_lan,
-		0644, wake_up_lan_show,	wake_up_lan_store);
-static DEVICE_ATTR(wake_up_wlan,
-		0644, wake_up_wlan_show,	wake_up_wlan_store);
-static DEVICE_ATTR(wake_up_key,
-		0644, wake_up_key_show,	wake_up_key_store);
-static DEVICE_ATTR(wake_up_mouse,
-		0644, wake_up_mouse_show,	wake_up_mouse_store);
+static DEVICE_ATTR_RW(wake_up_pme);
+static DEVICE_ATTR_RW(wake_up_modem);
+static DEVICE_ATTR_RW(wake_up_lan);
+static DEVICE_ATTR_RW(wake_up_wlan);
+static DEVICE_ATTR_RW(wake_up_key);
+static DEVICE_ATTR_RW(wake_up_mouse);
 
 static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
 static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 75a245f38e2e..6eefb67b31f3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev, struct device_attribute *attr,
 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(online, 0644, online_show, online_store);
+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);
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 797bb42a6306..95f7ba3c3f1a 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2519,8 +2519,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
@@ -2583,8 +2582,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
@@ -3102,8 +3100,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] = {
@@ -3336,8 +3333,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
@@ -3386,8 +3382,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
@@ -3580,8 +3575,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.
@@ -3695,8 +3689,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
@@ -3954,8 +3947,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.
@@ -4194,8 +4186,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)
@@ -4288,8 +4279,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
@@ -4436,8 +4426,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
@@ -4611,8 +4600,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.
@@ -4772,8 +4760,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.
@@ -4859,9 +4846,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
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index fb80c96d8f73..c008af7fb480 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
  */
 static DEVICE_ATTR(type, 0444, type_show, NULL);
 static DEVICE_ATTR(temp, 0444, temp_show, NULL);
-static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store);
+static DEVICE_ATTR_RW(policy);
 static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL);
-static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
-		   sustainable_power_store);
+static DEVICE_ATTR_RW(sustainable_power);
 
 /* These thermal zone device attributes are created based on conditions */
-static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
-static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
+static DEVICE_ATTR_RW(mode);
+static DEVICE_ATTR_RW(passive);
 
 /* These attributes are unconditionally added to a thermal zone */
 static struct attribute *thermal_zone_dev_attrs[] = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d9f399c4e90c..7257c078e155 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show, rx_fifo_timeout_store);
+static DEVICE_ATTR_RW(rx_fifo_timeout);
 
 
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 452df0f87d6e..a1ab8acf39ba 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
+static DEVICE_ATTR_RW(dbc);
 
 int xhci_dbc_init(struct xhci_hcd *xhci)
 {
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b3ce42edb373..7f7c5c82420d 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device *device,
 
 	return r;
 }
-static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
+static DEVICE_ATTR_RW(otg_mode);
 
 static struct attribute *tahvo_attributes[] = {
 	&dev_attr_vbus.attr,
diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c
index 0d06038324e0..1e383c547633 100644
--- a/drivers/video/fbdev/auo_k190x.c
+++ b/drivers/video/fbdev/auo_k190x.c
@@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%d\n", temp);
 }
 
-static DEVICE_ATTR(update_mode, 0644, update_mode_show, update_mode_store);
-static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
+static DEVICE_ATTR_RW(update_mode);
+static DEVICE_ATTR_RW(flash);
 static DEVICE_ATTR(temp, 0644, temp_show, NULL);
 
 static struct attribute *auok190x_attributes[] = {
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index d570e19a2864..035ff6e02894 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev, struct device_attribute *attr, con
 	return count;
 }
 
-static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
+static DEVICE_ATTR_RW(flip);
 
 static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
@@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *att
 	return count;
 }
 
-static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show, fastpllclk_store);
+static DEVICE_ATTR_RW(fastpllclk);
 
 /*
  * Some touchscreens need hsync information from the video driver to
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 64a4c76cba2b..964784dc1602 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev,
 {
 	return config_test_show_str(buf, test_fw_config->name);
 }
-static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store);
+static DEVICE_ATTR_RW(config_name);
 
 static ssize_t config_num_requests_store(struct device *dev,
 					 struct device_attribute *attr,
@@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->num_requests);
 }
-static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show,
-		   config_num_requests_store);
+static DEVICE_ATTR_RW(config_num_requests);
 
 static ssize_t config_sync_direct_store(struct device *dev,
 					struct device_attribute *attr,
@@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->sync_direct);
 }
-static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show,
-		   config_sync_direct_store);
+static DEVICE_ATTR_RW(config_sync_direct);
 
 static ssize_t config_send_uevent_store(struct device *dev,
 					struct device_attribute *attr,
@@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->send_uevent);
 }
-static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show,
-		   config_send_uevent_store);
+static DEVICE_ATTR_RW(config_send_uevent);
 
 static ssize_t config_read_fw_idx_store(struct device *dev,
 					struct device_attribute *attr,
@@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx);
 }
-static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show,
-		   config_read_fw_idx_store);
+static DEVICE_ATTR_RW(config_read_fw_idx);
 
 
 static ssize_t trigger_request_store(struct device *dev,
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..e372b97eee13 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_driver);
 }
-static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show,
-		   config_test_driver_store);
+static DEVICE_ATTR_RW(config_test_driver);
 
 static ssize_t config_test_fs_store(struct device *dev,
 				    struct device_attribute *attr,
@@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_fs);
 }
-static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
-		   config_test_fs_store);
+static DEVICE_ATTR_RW(config_test_fs);
 
 static int trigger_config_run_type(struct kmod_test_device *test_dev,
 				   enum kmod_test_case test_case,
@@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->num_threads);
 }
-static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show,
-		   config_num_threads_store);
+static DEVICE_ATTR_RW(config_num_threads);
 
 static ssize_t config_test_case_store(struct device *dev,
 				      struct device_attribute *attr,
@@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev,
 
 	return test_dev_config_show_uint(test_dev, buf, config->test_case);
 }
-static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
-		   config_test_case_store);
+static DEVICE_ATTR_RW(config_test_case);
 
 static ssize_t test_result_show(struct device *dev,
 				struct device_attribute *attr,
@@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->test_result);
 }
-static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store);
+static DEVICE_ATTR_RW(test_result);
 
 #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.attr
 
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 7a54e3083203..79d4dc785e5c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
+static DEVICE_ATTR_RW(dma_op_mode);
 
 static const struct attribute *additional_attrs[] = {
 	&dev_attr_max_tx_thres.attr,
@@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
+static DEVICE_ATTR_RW(st_taps);
 
 static const struct attribute *sidetone_attrs[] = {
 	&dev_attr_st_taps.attr,

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:15   ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: alsa-devel, Liam Girdwood, David Airlie, Heiko Carstens,
	linux-fbdev, dri-devel, Takashi Iwai, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, linux-pm, linux-serial,
	Jiri Slaby, platform-driver-x86, Bartlomiej Zolnierkiewicz,
	intel-gfx, Mark Brown, Jaroslav Kysela, Martin K. Petersen,
	linux-usb, linux-kernel, Martin Schwidefsky

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 <joe@perches.com>
---
 arch/s390/kernel/topology.c          |  3 +--
 arch/tile/kernel/sysfs.c             |  2 +-
 drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
 drivers/platform/x86/compal-laptop.c | 18 +++++----------
 drivers/s390/cio/device.c            |  2 +-
 drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
 drivers/thermal/thermal_sysfs.c      |  9 ++++----
 drivers/tty/serial/sh-sci.c          |  2 +-
 drivers/usb/host/xhci-dbgcap.c       |  2 +-
 drivers/usb/phy/phy-tahvo.c          |  2 +-
 drivers/video/fbdev/auo_k190x.c      |  4 ++--
 drivers/video/fbdev/w100fb.c         |  4 ++--
 lib/test_firmware.c                  | 14 +++++-------
 lib/test_kmod.c                      | 14 +++++-------
 sound/soc/omap/mcbsp.c               |  4 ++--
 15 files changed, 49 insertions(+), 80 deletions(-)

diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 4d5b65e527b5..4b6e0397f66d 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device *dev,
 	put_online_cpus();
 	return rc ? rc : count;
 }
-static DEVICE_ATTR(dispatching, 0644, dispatching_show,
-			 dispatching_store);
+static DEVICE_ATTR_RW(dispatching);
 
 static ssize_t cpu_polarization_show(struct device *dev,
 				     struct device_attribute *attr, char *buf)
diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
index 825867c53853..af5024f0fb5a 100644
--- a/arch/tile/kernel/sysfs.c
+++ b/arch/tile/kernel/sysfs.c
@@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
 	return n < 0 ? n : count;
 }
 
-static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
+static DEVICE_ATTR_RW(hv_stats);
 
 static int hv_stats_device_add(struct device *dev, struct subsys_interface *sif)
 {
diff --git a/drivers/gpu/drm/i915/i915_sysfs.c b/drivers/gpu/drm/i915/i915_sysfs.c
index c74a20b80182..1d0ab8ff5915 100644
--- a/drivers/gpu/drm/i915/i915_sysfs.c
+++ b/drivers/gpu/drm/i915/i915_sysfs.c
@@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct device *kdev,
 
 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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR, gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
-static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR, gt_max_freq_mhz_show, gt_max_freq_mhz_store);
-static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR, gt_min_freq_mhz_show, gt_min_freq_mhz_store);
+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);
 
diff --git a/drivers/platform/x86/compal-laptop.c b/drivers/platform/x86/compal-laptop.c
index 6bcb750e1865..4f9bc72f0584 100644
--- a/drivers/platform/x86/compal-laptop.c
+++ b/drivers/platform/x86/compal-laptop.c
@@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
 /* ======= */
 /* Driver Globals */
 /* ======= */
-static DEVICE_ATTR(wake_up_pme,
-		0644, wake_up_pme_show,		wake_up_pme_store);
-static DEVICE_ATTR(wake_up_modem,
-		0644, wake_up_modem_show,	wake_up_modem_store);
-static DEVICE_ATTR(wake_up_lan,
-		0644, wake_up_lan_show,	wake_up_lan_store);
-static DEVICE_ATTR(wake_up_wlan,
-		0644, wake_up_wlan_show,	wake_up_wlan_store);
-static DEVICE_ATTR(wake_up_key,
-		0644, wake_up_key_show,	wake_up_key_store);
-static DEVICE_ATTR(wake_up_mouse,
-		0644, wake_up_mouse_show,	wake_up_mouse_store);
+static DEVICE_ATTR_RW(wake_up_pme);
+static DEVICE_ATTR_RW(wake_up_modem);
+static DEVICE_ATTR_RW(wake_up_lan);
+static DEVICE_ATTR_RW(wake_up_wlan);
+static DEVICE_ATTR_RW(wake_up_key);
+static DEVICE_ATTR_RW(wake_up_mouse);
 
 static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
 static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
index 75a245f38e2e..6eefb67b31f3 100644
--- a/drivers/s390/cio/device.c
+++ b/drivers/s390/cio/device.c
@@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev, struct device_attribute *attr,
 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(online, 0644, online_show, online_store);
+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);
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 797bb42a6306..95f7ba3c3f1a 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2519,8 +2519,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
@@ -2583,8 +2582,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
@@ -3102,8 +3100,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] = {
@@ -3336,8 +3333,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
@@ -3386,8 +3382,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
@@ -3580,8 +3575,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.
@@ -3695,8 +3689,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
@@ -3954,8 +3947,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.
@@ -4194,8 +4186,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)
@@ -4288,8 +4279,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
@@ -4436,8 +4426,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
@@ -4611,8 +4600,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.
@@ -4772,8 +4760,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.
@@ -4859,9 +4846,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
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index fb80c96d8f73..c008af7fb480 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
  */
 static DEVICE_ATTR(type, 0444, type_show, NULL);
 static DEVICE_ATTR(temp, 0444, temp_show, NULL);
-static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show, policy_store);
+static DEVICE_ATTR_RW(policy);
 static DEVICE_ATTR(available_policies, S_IRUGO, available_policies_show, NULL);
-static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO, sustainable_power_show,
-		   sustainable_power_store);
+static DEVICE_ATTR_RW(sustainable_power);
 
 /* These thermal zone device attributes are created based on conditions */
-static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
-static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show, passive_store);
+static DEVICE_ATTR_RW(mode);
+static DEVICE_ATTR_RW(passive);
 
 /* These attributes are unconditionally added to a thermal zone */
 static struct attribute *thermal_zone_dev_attrs[] = {
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c
index d9f399c4e90c..7257c078e155 100644
--- a/drivers/tty/serial/sh-sci.c
+++ b/drivers/tty/serial/sh-sci.c
@@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show, rx_fifo_timeout_store);
+static DEVICE_ATTR_RW(rx_fifo_timeout);
 
 
 #ifdef CONFIG_SERIAL_SH_SCI_DMA
diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-dbgcap.c
index 452df0f87d6e..a1ab8acf39ba 100644
--- a/drivers/usb/host/xhci-dbgcap.c
+++ b/drivers/usb/host/xhci-dbgcap.c
@@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
+static DEVICE_ATTR_RW(dbc);
 
 int xhci_dbc_init(struct xhci_hcd *xhci)
 {
diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-tahvo.c
index b3ce42edb373..7f7c5c82420d 100644
--- a/drivers/usb/phy/phy-tahvo.c
+++ b/drivers/usb/phy/phy-tahvo.c
@@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device *device,
 
 	return r;
 }
-static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
+static DEVICE_ATTR_RW(otg_mode);
 
 static struct attribute *tahvo_attributes[] = {
 	&dev_attr_vbus.attr,
diff --git a/drivers/video/fbdev/auo_k190x.c b/drivers/video/fbdev/auo_k190x.c
index 0d06038324e0..1e383c547633 100644
--- a/drivers/video/fbdev/auo_k190x.c
+++ b/drivers/video/fbdev/auo_k190x.c
@@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%d\n", temp);
 }
 
-static DEVICE_ATTR(update_mode, 0644, update_mode_show, update_mode_store);
-static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
+static DEVICE_ATTR_RW(update_mode);
+static DEVICE_ATTR_RW(flash);
 static DEVICE_ATTR(temp, 0644, temp_show, NULL);
 
 static struct attribute *auok190x_attributes[] = {
diff --git a/drivers/video/fbdev/w100fb.c b/drivers/video/fbdev/w100fb.c
index d570e19a2864..035ff6e02894 100644
--- a/drivers/video/fbdev/w100fb.c
+++ b/drivers/video/fbdev/w100fb.c
@@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev, struct device_attribute *attr, con
 	return count;
 }
 
-static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
+static DEVICE_ATTR_RW(flip);
 
 static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
@@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *att
 	return count;
 }
 
-static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show, fastpllclk_store);
+static DEVICE_ATTR_RW(fastpllclk);
 
 /*
  * Some touchscreens need hsync information from the video driver to
diff --git a/lib/test_firmware.c b/lib/test_firmware.c
index 64a4c76cba2b..964784dc1602 100644
--- a/lib/test_firmware.c
+++ b/lib/test_firmware.c
@@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device *dev,
 {
 	return config_test_show_str(buf, test_fw_config->name);
 }
-static DEVICE_ATTR(config_name, 0644, config_name_show, config_name_store);
+static DEVICE_ATTR_RW(config_name);
 
 static ssize_t config_num_requests_store(struct device *dev,
 					 struct device_attribute *attr,
@@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->num_requests);
 }
-static DEVICE_ATTR(config_num_requests, 0644, config_num_requests_show,
-		   config_num_requests_store);
+static DEVICE_ATTR_RW(config_num_requests);
 
 static ssize_t config_sync_direct_store(struct device *dev,
 					struct device_attribute *attr,
@@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->sync_direct);
 }
-static DEVICE_ATTR(config_sync_direct, 0644, config_sync_direct_show,
-		   config_sync_direct_store);
+static DEVICE_ATTR_RW(config_sync_direct);
 
 static ssize_t config_send_uevent_store(struct device *dev,
 					struct device_attribute *attr,
@@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct device *dev,
 {
 	return test_dev_config_show_bool(buf, test_fw_config->send_uevent);
 }
-static DEVICE_ATTR(config_send_uevent, 0644, config_send_uevent_show,
-		   config_send_uevent_store);
+static DEVICE_ATTR_RW(config_send_uevent);
 
 static ssize_t config_read_fw_idx_store(struct device *dev,
 					struct device_attribute *attr,
@@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct device *dev,
 {
 	return test_dev_config_show_u8(buf, test_fw_config->read_fw_idx);
 }
-static DEVICE_ATTR(config_read_fw_idx, 0644, config_read_fw_idx_show,
-		   config_read_fw_idx_store);
+static DEVICE_ATTR_RW(config_read_fw_idx);
 
 
 static ssize_t trigger_request_store(struct device *dev,
diff --git a/lib/test_kmod.c b/lib/test_kmod.c
index 337f408b4de6..e372b97eee13 100644
--- a/lib/test_kmod.c
+++ b/lib/test_kmod.c
@@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_driver);
 }
-static DEVICE_ATTR(config_test_driver, 0644, config_test_driver_show,
-		   config_test_driver_store);
+static DEVICE_ATTR_RW(config_test_driver);
 
 static ssize_t config_test_fs_store(struct device *dev,
 				    struct device_attribute *attr,
@@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device *dev,
 	return config_test_show_str(&test_dev->config_mutex, buf,
 				    config->test_fs);
 }
-static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
-		   config_test_fs_store);
+static DEVICE_ATTR_RW(config_test_fs);
 
 static int trigger_config_run_type(struct kmod_test_device *test_dev,
 				   enum kmod_test_case test_case,
@@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->num_threads);
 }
-static DEVICE_ATTR(config_num_threads, 0644, config_num_threads_show,
-		   config_num_threads_store);
+static DEVICE_ATTR_RW(config_num_threads);
 
 static ssize_t config_test_case_store(struct device *dev,
 				      struct device_attribute *attr,
@@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct device *dev,
 
 	return test_dev_config_show_uint(test_dev, buf, config->test_case);
 }
-static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
-		   config_test_case_store);
+static DEVICE_ATTR_RW(config_test_case);
 
 static ssize_t test_result_show(struct device *dev,
 				struct device_attribute *attr,
@@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device *dev,
 
 	return test_dev_config_show_int(test_dev, buf, config->test_result);
 }
-static DEVICE_ATTR(test_result, 0644, test_result_show, test_result_store);
+static DEVICE_ATTR_RW(test_result);
 
 #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.attr
 
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index 7a54e3083203..79d4dc785e5c 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
+static DEVICE_ATTR_RW(dma_op_mode);
 
 static const struct attribute *additional_attrs[] = {
 	&dev_attr_max_tx_thres.attr,
@@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
 	return size;
 }
 
-static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
+static DEVICE_ATTR_RW(st_taps);
 
 static const struct attribute *sidetone_attrs[] = {
 	&dev_attr_st_taps.attr,
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-19 18:15 ` Joe Perches
  (?)
@ 2017-12-19 18:15   ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rafael J. Wysocki,
	Len Brown, Corey Minyard, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Sebastian Ott, Peter Oberparleiter,
	Harald Freudenberger, Don Brace, James E.J. Bottomley,
	Martin K. Petersen, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo
  Cc: alsa-devel, Rich Felker, linux-sh, David Airlie, Heiko Carstens,
	dri-devel, Takashi Iwai, devel, linux-s390,
	Mauro Carvalho Chehab, Yoshinori Sato, esc.storagedev,
	Russell King, linux-acpi, linux-media, Arnd Bergmann, linux-pm,
	intel-gfx, linux-nvme, openipmi-developer, Jaroslav Kysela,
	linux-arm-kernel, Alan Cox, linux-scsi, Greg Kroah-Hartman,
	linux-kernel, Sakari

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,
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,
-- 
2.15.0


^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
@ 2017-12-19 18:15   ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rafael J. Wysocki,
	Len Brown, Corey Minyard, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Sebastian Ott, Peter Oberparleiter,
	Harald Freudenberger, Don Brace, James E.J. Bottomley,
	Martin K. Petersen, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo
  Cc: alsa-devel, Rich Felker, linux-sh, David Airlie, Heiko Carstens,
	dri-devel, Takashi Iwai, devel, linux-s390,
	Mauro Carvalho Chehab, Yoshinori Sato, esc.storagedev,
	Russell King, linux-acpi, linux-media, Arnd Bergmann, linux-pm,
	intel-gfx, linux-nvme, openipmi-developer, Jaroslav Kysela,
	linux-arm-kernel, Alan Cox, linux-scsi, Greg Kroah-Hartman,
	linux-kernel, Sakari

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,
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,
-- 
2.15.0

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
@ 2017-12-19 18:15   ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Daniel Mack, Haojian Zhuang, Robert Jarzmik, Rafael J. Wysocki,
	Len Brown, Corey Minyard, Jani Nikula, Joonas Lahtinen,
	Rodrigo Vivi, Keith Busch, Jens Axboe, Christoph Hellwig,
	Sagi Grimberg, Sebastian Ott, Peter Oberparleiter,
	Harald Freudenberger, Don Brace, James E.J. Bottomley,
	Martin K. Petersen, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Liam Girdwood, Mark Brown
  Cc: Russell King, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, David Airlie, Martin Schwidefsky,
	Heiko Carstens, Alan Cox, Sakari Ailus, Mauro Carvalho Chehab,
	Jaroslav Kysela, Takashi Iwai, linux-arm-kernel, linux-kernel,
	linux-sh, linux-acpi, openipmi-developer, intel-gfx, dri-devel,
	linux-nvme, linux-s390, esc.storagedev, linux-scsi, linux-media,
	devel, linux-pm, alsa-devel

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,
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,
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
  2017-12-19 18:15 ` Joe Perches
                   ` (6 preceding siblings ...)
  (?)
@ 2017-12-19 18:15 ` Joe Perches
  2017-12-19 18:44     ` Borislav Petkov
  2017-12-21  0:50     ` Zhang Rui
  -1 siblings, 2 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:15 UTC (permalink / raw)
  To: Borislav Petkov, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Thomas Falcon, John Allen,
	Inaky Perez-Gonzalez, linux-wimax, James Smart, Dick Kennedy,
	Zhang Rui, Eduardo Valentin
  Cc: Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

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 <joe@perches.com>
---
 arch/s390/kernel/smp.c                 | 2 +-
 arch/x86/kernel/cpu/microcode/core.c   | 2 +-
 drivers/input/touchscreen/elants_i2c.c | 2 +-
 drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
 drivers/net/wimax/i2400m/sysfs.c       | 3 +--
 drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
 drivers/thermal/thermal_sysfs.c        | 2 +-
 7 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index b8c1a85bcf2d..a919b2f0141d 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device *dev,
 	rc = smp_rescan_cpus();
 	return rc ? rc : count;
 }
-static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
+static DEVICE_ATTR_WO(rescan);
 #endif /* CONFIG_HOTPLUG_CPU */
 
 static int __init s390_smp_init(void)
diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
index c4fa4a85d4cb..09c74b0560dd 100644
--- a/arch/x86/kernel/cpu/microcode/core.c
+++ b/arch/x86/kernel/cpu/microcode/core.c
@@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
 	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
 }
 
-static DEVICE_ATTR(reload, 0200, NULL, reload_store);
+static DEVICE_ATTR_WO(reload);
 static DEVICE_ATTR(version, 0400, version_show, NULL);
 static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
 
diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index a458e5ec9e41..819213e88f32 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1000,7 +1000,7 @@ static ssize_t show_iap_mode(struct device *dev,
 				"Normal" : "Recovery");
 }
 
-static DEVICE_ATTR(calibrate, S_IWUSR, NULL, calibrate_store);
+static DEVICE_ATTR_WO(calibrate);
 static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
 static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw);
 
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 1dc4aef37d3a..42b96e1a1b13 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4411,7 +4411,7 @@ static ssize_t failover_store(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(failover, 0200, NULL, failover_store);
+static DEVICE_ATTR_WO(failover);
 
 static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev)
 {
diff --git a/drivers/net/wimax/i2400m/sysfs.c b/drivers/net/wimax/i2400m/sysfs.c
index 1237109f251a..8c67df11105c 100644
--- a/drivers/net/wimax/i2400m/sysfs.c
+++ b/drivers/net/wimax/i2400m/sysfs.c
@@ -65,8 +65,7 @@ ssize_t i2400m_idle_timeout_store(struct device *dev,
 }
 
 static
-DEVICE_ATTR(i2400m_idle_timeout, S_IWUSR,
-	    NULL, i2400m_idle_timeout_store);
+DEVICE_ATTR_WO(i2400m_idle_timeout);
 
 static
 struct attribute *i2400m_dev_attrs[] = {
diff --git a/drivers/scsi/lpfc/lpfc_attr.c b/drivers/scsi/lpfc/lpfc_attr.c
index 517ff203cfde..6ddaf51a23f6 100644
--- a/drivers/scsi/lpfc/lpfc_attr.c
+++ b/drivers/scsi/lpfc/lpfc_attr.c
@@ -2418,8 +2418,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
diff --git a/drivers/thermal/thermal_sysfs.c b/drivers/thermal/thermal_sysfs.c
index 2bc964392924..ba81c9080f6e 100644
--- a/drivers/thermal/thermal_sysfs.c
+++ b/drivers/thermal/thermal_sysfs.c
@@ -317,7 +317,7 @@ emul_temp_store(struct device *dev, struct device_attribute *attr,
 
 	return ret ? ret : count;
 }
-static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store);
+static DEVICE_ATTR_WO(emul_temp);
 #endif
 
 static ssize_t
-- 
2.15.0

^ permalink raw reply related	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:15   ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-19 18:41     ` Andy Shevchenko
  -1 siblings, 0 replies; 99+ messages in thread
From: Andy Shevchenko @ 2017-12-19 18:41 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, Platform Driver, linux-scsi, linux-pm,
	linux-serial, USB, linux-fbdev, ALSA Development Mailing List,
	Linux OMAP Mailing List

On Tue, Dec 19, 2017 at 8:15 PM, Joe Perches <joe@perches.com> wrote:
> 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;}'

>  drivers/platform/x86/compal-laptop.c | 18 +++++----------

> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -               0644, wake_up_pme_show,         wake_up_pme_store);
> -static DEVICE_ATTR(wake_up_modem,
> -               0644, wake_up_modem_show,       wake_up_modem_store);
> -static DEVICE_ATTR(wake_up_lan,
> -               0644, wake_up_lan_show, wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -               0644, wake_up_wlan_show,        wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -               0644, wake_up_key_show, wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -               0644, wake_up_mouse_show,       wake_up_mouse_store);
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

for PDx86 bits.

Have to say that while it doesn't change the attributes here, it might
require still to be revisited by security people, if they wish.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:41     ` Andy Shevchenko
  0 siblings, 0 replies; 99+ messages in thread
From: Andy Shevchenko @ 2017-12-19 18:41 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens,
	ALSA Development Mailing List, dri-devel, Jaroslav Kysela,
	Peter Ujfalusi, linux-s390, Linux OMAP Mailing List,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman, Bartlomiej

On Tue, Dec 19, 2017 at 8:15 PM, Joe Perches <joe@perches.com> wrote:
> 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;}'

>  drivers/platform/x86/compal-laptop.c | 18 +++++----------

> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -               0644, wake_up_pme_show,         wake_up_pme_store);
> -static DEVICE_ATTR(wake_up_modem,
> -               0644, wake_up_modem_show,       wake_up_modem_store);
> -static DEVICE_ATTR(wake_up_lan,
> -               0644, wake_up_lan_show, wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -               0644, wake_up_wlan_show,        wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -               0644, wake_up_key_show, wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -               0644, wake_up_mouse_show,       wake_up_mouse_store);
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

for PDx86 bits.

Have to say that while it doesn't change the attributes here, it might
require still to be revisited by security people, if they wish.

-- 
With Best Regards,
Andy Shevchenko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:41     ` Andy Shevchenko
  0 siblings, 0 replies; 99+ messages in thread
From: Andy Shevchenko @ 2017-12-19 18:41 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, Platform Driver, linux-scsi, linux-pm,
	linux-serial, USB, linux-fbdev, ALSA Development Mailing List,
	Linux OMAP Mailing List

On Tue, Dec 19, 2017 at 8:15 PM, Joe Perches <joe@perches.com> wrote:
> 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;}'

>  drivers/platform/x86/compal-laptop.c | 18 +++++----------

> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -               0644, wake_up_pme_show,         wake_up_pme_store);
> -static DEVICE_ATTR(wake_up_modem,
> -               0644, wake_up_modem_show,       wake_up_modem_store);
> -static DEVICE_ATTR(wake_up_lan,
> -               0644, wake_up_lan_show, wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -               0644, wake_up_wlan_show,        wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -               0644, wake_up_key_show, wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -               0644, wake_up_mouse_show,       wake_up_mouse_store);
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

for PDx86 bits.

Have to say that while it doesn't change the attributes here, it might
require still to be revisited by security people, if they wish.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-19 18:41     ` Andy Shevchenko
  0 siblings, 0 replies; 99+ messages in thread
From: Andy Shevchenko @ 2017-12-19 18:41 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens,
	ALSA Development Mailing List, dri-devel, Jaroslav Kysela,
	Peter Ujfalusi, linux-s390, Linux OMAP Mailing List,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman, Bartlomiej

On Tue, Dec 19, 2017 at 8:15 PM, Joe Perches <joe@perches.com> wrote:
> 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;}'

>  drivers/platform/x86/compal-laptop.c | 18 +++++----------

> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct power_supply *psy,
>  /* ======= */
>  /* Driver Globals */
>  /* ======= */
> -static DEVICE_ATTR(wake_up_pme,
> -               0644, wake_up_pme_show,         wake_up_pme_store);
> -static DEVICE_ATTR(wake_up_modem,
> -               0644, wake_up_modem_show,       wake_up_modem_store);
> -static DEVICE_ATTR(wake_up_lan,
> -               0644, wake_up_lan_show, wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -               0644, wake_up_wlan_show,        wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -               0644, wake_up_key_show, wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -               0644, wake_up_mouse_show,       wake_up_mouse_store);
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

for PDx86 bits.

Have to say that while it doesn't change the attributes here, it might
require still to be revisited by security people, if they wish.

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
  2017-12-19 18:15 ` [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO Joe Perches
  2017-12-19 18:44     ` Borislav Petkov
@ 2017-12-19 18:44     ` Borislav Petkov
  1 sibling, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:44 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/smp.c                 | 2 +-
>  arch/x86/kernel/cpu/microcode/core.c   | 2 +-
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
>  drivers/net/wimax/i2400m/sysfs.c       | 3 +--
>  drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
>  drivers/thermal/thermal_sysfs.c        | 2 +-
>  7 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index b8c1a85bcf2d..a919b2f0141d 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device *dev,
>  	rc = smp_rescan_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
> +static DEVICE_ATTR_WO(rescan);
>  #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static int __init s390_smp_init(void)
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index c4fa4a85d4cb..09c74b0560dd 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
>  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
>  }
>  
> -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> +static DEVICE_ATTR_WO(reload);
>  static DEVICE_ATTR(version, 0400, version_show, NULL);
>  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
>  

# cat /sys/devices/system/cpu/microcode/reload
cat: /sys/devices/system/cpu/microcode/reload: Permission denied

The reason for the code churn being?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:44     ` Borislav Petkov
  0 siblings, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:44 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/smp.c                 | 2 +-
>  arch/x86/kernel/cpu/microcode/core.c   | 2 +-
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
>  drivers/net/wimax/i2400m/sysfs.c       | 3 +--
>  drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
>  drivers/thermal/thermal_sysfs.c        | 2 +-
>  7 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index b8c1a85bcf2d..a919b2f0141d 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device *dev,
>  	rc = smp_rescan_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
> +static DEVICE_ATTR_WO(rescan);
>  #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static int __init s390_smp_init(void)
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index c4fa4a85d4cb..09c74b0560dd 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
>  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
>  }
>  
> -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> +static DEVICE_ATTR_WO(reload);
>  static DEVICE_ATTR(version, 0400, version_show, NULL);
>  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
>  

# cat /sys/devices/system/cpu/microcode/reload
cat: /sys/devices/system/cpu/microcode/reload: Permission denied

The reason for the code churn being?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:44     ` Borislav Petkov
  0 siblings, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:44 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/smp.c                 | 2 +-
>  arch/x86/kernel/cpu/microcode/core.c   | 2 +-
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
>  drivers/net/wimax/i2400m/sysfs.c       | 3 +--
>  drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
>  drivers/thermal/thermal_sysfs.c        | 2 +-
>  7 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index b8c1a85bcf2d..a919b2f0141d 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device *dev,
>  	rc = smp_rescan_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
> +static DEVICE_ATTR_WO(rescan);
>  #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static int __init s390_smp_init(void)
> diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
> index c4fa4a85d4cb..09c74b0560dd 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
>  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
>  }
>  
> -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> +static DEVICE_ATTR_WO(reload);
>  static DEVICE_ATTR(version, 0400, version_show, NULL);
>  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
>  

# cat /sys/devices/system/cpu/microcode/reload
cat: /sys/devices/system/cpu/microcode/reload: Permission denied

The reason for the code churn being?

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
  2017-12-19 18:44     ` Borislav Petkov
  (?)
  (?)
@ 2017-12-19 18:51       ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:51 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote:
> On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> > 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;}'
[]
> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
[]
> > @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
> >  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
> >  }
> >  
> > -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> > +static DEVICE_ATTR_WO(reload);
> >  static DEVICE_ATTR(version, 0400, version_show, NULL);
> >  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
> >  
> 
> # cat /sys/devices/system/cpu/microcode/reload
> cat: /sys/devices/system/cpu/microcode/reload: Permission denied

Not different behavior.  It was and remains write only.

> The reason for the code churn being?

Consistency for easier grep by use-type.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:51       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:51 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote:
> On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> > 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;}'
[]
> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
[]
> > @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
> >  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
> >  }
> >  
> > -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> > +static DEVICE_ATTR_WO(reload);
> >  static DEVICE_ATTR(version, 0400, version_show, NULL);
> >  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
> >  
> 
> # cat /sys/devices/system/cpu/microcode/reload
> cat: /sys/devices/system/cpu/microcode/reload: Permission denied

Not different behavior.  It was and remains write only.

> The reason for the code churn being?

Consistency for easier grep by use-type.



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:51       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:51 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote:
> On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> > 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;}'
[]
> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
[]
> > @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
> >  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
> >  }
> >  
> > -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> > +static DEVICE_ATTR_WO(reload);
> >  static DEVICE_ATTR(version, 0400, version_show, NULL);
> >  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
> >  
> 
> # cat /sys/devices/system/cpu/microcode/reload
> cat: /sys/devices/system/cpu/microcode/reload: Permission denied

Not different behavior.  It was and remains write only.

> The reason for the code churn being?

Consistency for easier grep by use-type.



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:51       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-19 18:51 UTC (permalink / raw)
  To: Borislav Petkov
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, 2017-12-19 at 19:44 +0100, Borislav Petkov wrote:
> On Tue, Dec 19, 2017 at 10:15:09AM -0800, Joe Perches wrote:
> > 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;}'
[]
> > diff --git a/arch/x86/kernel/cpu/microcode/core.c b/arch/x86/kernel/cpu/microcode/core.c
[]
> > @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
> >  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
> >  }
> >  
> > -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> > +static DEVICE_ATTR_WO(reload);
> >  static DEVICE_ATTR(version, 0400, version_show, NULL);
> >  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
> >  
> 
> # cat /sys/devices/system/cpu/microcode/reload
> cat: /sys/devices/system/cpu/microcode/reload: Permission denied

Not different behavior.  It was and remains write only.

> The reason for the code churn being?

Consistency for easier grep by use-type.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
  2017-12-19 18:51       ` Joe Perches
  (?)
@ 2017-12-19 18:54         ` Borislav Petkov
  -1 siblings, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:54 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, Dec 19, 2017 at 10:51:14AM -0800, Joe Perches wrote:
> > The reason for the code churn being?
> 
> Consistency for easier grep by use-type.

Please explain that in the commit message so that we know why it was
changed.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:54         ` Borislav Petkov
  0 siblings, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:54 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, Dec 19, 2017 at 10:51:14AM -0800, Joe Perches wrote:
> > The reason for the code churn being?
> 
> Consistency for easier grep by use-type.

Please explain that in the commit message so that we know why it was
changed.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-19 18:54         ` Borislav Petkov
  0 siblings, 0 replies; 99+ messages in thread
From: Borislav Petkov @ 2017-12-19 18:54 UTC (permalink / raw)
  To: Joe Perches
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Thomas Falcon, John Allen, Inaky Perez-Gonzalez, linux-wimax,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen

On Tue, Dec 19, 2017 at 10:51:14AM -0800, Joe Perches wrote:
> > The reason for the code churn being?
> 
> Consistency for easier grep by use-type.

Please explain that in the commit message so that we know why it was
changed.

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
  2017-12-19 18:15 ` Joe Perches
  (?)
  (?)
@ 2017-12-19 18:54   ` Jani Nikula
  -1 siblings, 0 replies; 99+ messages in thread
From: Jani Nikula @ 2017-12-19 18:54 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

On Tue, 19 Dec 2017, Joe Perches <joe@perches.com> wrote:
>  drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--

For i915,

Acked-by: Jani Nikula <jani.nikula@intel.com>


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:54   ` Jani Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jani Nikula @ 2017-12-19 18:54 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

On Tue, 19 Dec 2017, Joe Perches <joe@perches.com> wrote:
>  drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--

For i915,

Acked-by: Jani Nikula <jani.nikula@intel.com>


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:54   ` Jani Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jani Nikula @ 2017-12-19 18:54 UTC (permalink / raw)


On Tue, 19 Dec 2017, Joe Perches <joe@perches.com> wrote:
>  drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--

For i915,

Acked-by: Jani Nikula <jani.nikula at intel.com>


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 18:54   ` Jani Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jani Nikula @ 2017-12-19 18:54 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 19 Dec 2017, Joe Perches <joe@perches.com> wrote:
>  drivers/gpu/drm/i915/i915_sysfs.c                  | 12 ++--

For i915,

Acked-by: Jani Nikula <jani.nikula@intel.com>


-- 
Jani Nikula, Intel Open Source Technology Center

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
  2017-12-19 18:15 ` Joe Perches
                     ` (2 preceding siblings ...)
  (?)
@ 2017-12-19 19:26   ` Corey Minyard
  -1 siblings, 0 replies; 99+ messages in thread
From: Corey Minyard @ 2017-12-19 19:26 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

On 12/19/2017 12:15 PM, Joe Perches wrote:
>   drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---

For ipmi:

Acked-by: Corey Minyard <cminyard@mvista.com>


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 19:26   ` Corey Minyard
  0 siblings, 0 replies; 99+ messages in thread
From: Corey Minyard @ 2017-12-19 19:26 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media

On 12/19/2017 12:15 PM, Joe Perches wrote:
>   drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---

For ipmi:

Acked-by: Corey Minyard <cminyard@mvista.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 19:26   ` Corey Minyard
  0 siblings, 0 replies; 99+ messages in thread
From: Corey Minyard @ 2017-12-19 19:26 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: linux-sh, dri-devel, linux-input, linux-media, devel, linux-fbdev

On 12/19/2017 12:15 PM, Joe Perches wrote:
>   drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---

For ipmi:

Acked-by: Corey Minyard <cminyard@mvista.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 19:26   ` Corey Minyard
  0 siblings, 0 replies; 99+ messages in thread
From: Corey Minyard @ 2017-12-19 19:26 UTC (permalink / raw)


On 12/19/2017 12:15 PM, Joe Perches wrote:
>   drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---

For ipmi:

Acked-by: Corey Minyard <cminyard at mvista.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-19 19:26   ` Corey Minyard
  0 siblings, 0 replies; 99+ messages in thread
From: Corey Minyard @ 2017-12-19 19:26 UTC (permalink / raw)
  To: linux-arm-kernel

On 12/19/2017 12:15 PM, Joe Perches wrote:
>   drivers/char/ipmi/ipmi_msghandler.c                | 17 +++---

For ipmi:

Acked-by: Corey Minyard <cminyard@mvista.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [alsa-devel] [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:41     ` [-next PATCH 2/4] " Andy Shevchenko
                       ` (2 preceding siblings ...)
  (?)
@ 2017-12-20  7:19     ` Jidong Zhang
  -1 siblings, 0 replies; 99+ messages in thread
From: Jidong Zhang @ 2017-12-20  7:19 UTC (permalink / raw)
  To: Andy Shevchenko, Joe Perches
  Cc: linux-fbdev, Liam Girdwood, David Airlie, Heiko Carstens,
	ALSA Development Mailing List, dri-devel, Platform Driver,
	Peter Ujfalusi, linux-s390, James E.J. Bottomley, linux-scsi,
	linux-pm, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui


Does anyone know how to use Conexant CX20921 to develop our own application. I cannot find anywhere to download the software and manuals.

Thanks to all
J.D

-----Original Message-----
From: alsa-devel-bounces@alsa-project.org [mailto:alsa-devel-bounces@alsa-project.org] On Behalf Of Andy Shevchenko
Sent: 2017年12月20日 2:42
To: Joe Perches <joe@perches.com>
Cc: linux-fbdev@vger.kernel.org; David Airlie <airlied@linux.ie>; Joonas Lahtinen <joonas.lahtinen@linux.intel.com>; Heiko Carstens <heiko.carstens@de.ibm.com>; ALSA Development Mailing List <alsa-devel@alsa-project.org>; dri-devel@lists.freedesktop.org; Peter Ujfalusi <peter.ujfalusi@ti.com>; linux-s390@vger.kernel.org; Linux OMAP Mailing List <linux-omap@vger.kernel.org>; James E.J. Bottomley <jejb@linux.vnet.ibm.com>; linux-scsi <linux-scsi@vger.kernel.org>; Takashi Iwai <tiwai@suse.com>; Sebastian Ott <sebott@linux.vnet.ibm.com>; James Smart <james.smart@broadcom.com>; Cezary Jackiewicz <cezary.jackiewicz@gmail.com>; linux-serial@vger.kernel.org; Jiri Slaby <jslaby@suse.com>; Darren Hart <dvhart@infradead.org>; Zhang Rui <rui.zhang@intel.com>; Dick Kennedy <dick.kennedy@broadcom.com>; Mathias Nyman <mathias.nyman@intel.com>; Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>; Peter Oberparleiter <oberpar@linux.vnet.ibm.com>; intel-gfx@lists.freedesktop.org; Jani Nikula <jani.nikula@linux.intel.com>; Eduardo Valentin <edubezval@gmail.com>; Mark Brown <broonie@kernel.org>; Rodrigo Vivi <rodrigo.vivi@intel.com>; Platform Driver <platform-driver-x86@vger.kernel.org>; Felipe Balbi <balbi@kernel.org>; Martin K. Petersen <martin.petersen@oracle.com>; Greg Kroah-Hartman <gregkh@linuxfoundation.org>; linux-pm@vger.kernel.org; USB <linux-usb@vger.kernel.org>; Liam Girdwood <lgirdwood@gmail.com>; linux-kernel@vger.kernel.org; Luis R. Rodriguez <mcgrof@kernel.org>; Andy Shevchenko <andy@infradead.org>; Martin Schwidefsky <schwidefsky@de.ibm.com>; Jarkko Nikula <jarkko.nikula@bitmer.com>
Subject: Re: [alsa-devel] [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW

On Tue, Dec 19, 2017 at 8:15 PM, Joe Perches <joe@perches.com> wrote:
> 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;}'

>  drivers/platform/x86/compal-laptop.c | 18 +++++----------

> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct 
> power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -               0644, wake_up_pme_show,         wake_up_pme_store);
> -static DEVICE_ATTR(wake_up_modem,
> -               0644, wake_up_modem_show,       wake_up_modem_store);
> -static DEVICE_ATTR(wake_up_lan,
> -               0644, wake_up_lan_show, wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -               0644, wake_up_wlan_show,        wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -               0644, wake_up_key_show, wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -               0644, wake_up_mouse_show,       wake_up_mouse_store);
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem); static 
> +DEVICE_ATTR_RW(wake_up_lan); static DEVICE_ATTR_RW(wake_up_wlan); 
> +static DEVICE_ATTR_RW(wake_up_key); static 
> +DEVICE_ATTR_RW(wake_up_mouse);

Acked-by: Andy Shevchenko <andy.shevchenko@gmail.com>

for PDx86 bits.

Have to say that while it doesn't change the attributes here, it might require still to be revisited by security people, if they wish.

--
With Best Regards,
Andy Shevchenko
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:15   ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-20  8:34     ` Jarkko Nikula
  -1 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20  8:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky,
	Heiko Carstens, David Airlie, James E.J. Bottomley,
	Martin K. Petersen, Jiri Slaby, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> 
...
  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
While I can ack this part here if it helps generic cleanup effort I
don't understart would it improve code readability in general? Mode 644
is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
through all of these files in order to see what does it mean:

DEVICE_ATTR_RW: include/linux/device.h
__ATTR_RW: include/linux/sysfs.h
S_IWUSR: include/uapi/linux/stat.h
S_IRUGO: include/linux/stat.h

Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  8:34     ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20  8:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky

On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> 
...
  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
While I can ack this part here if it helps generic cleanup effort I
don't understart would it improve code readability in general? Mode 644
is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
through all of these files in order to see what does it mean:

DEVICE_ATTR_RW: include/linux/device.h
__ATTR_RW: include/linux/sysfs.h
S_IWUSR: include/uapi/linux/stat.h
S_IRUGO: include/linux/stat.h

Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  8:34     ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20  8:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky,
	Heiko Carstens, David Airlie, James E.J. Bottomley,
	Martin K. Petersen, Jiri Slaby, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> 
...
  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
While I can ack this part here if it helps generic cleanup effort I
don't understart would it improve code readability in general? Mode 644
is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
through all of these files in order to see what does it mean:

DEVICE_ATTR_RW: include/linux/device.h
__ATTR_RW: include/linux/sysfs.h
S_IWUSR: include/uapi/linux/stat.h
S_IRUGO: include/linux/stat.h

Jarkko Nikula <jarkko.nikula@bitmer.com>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  8:34     ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20  8:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky

On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> 
...
  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
While I can ack this part here if it helps generic cleanup effort I
don't understart would it improve code readability in general? Mode 644
is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
through all of these files in order to see what does it mean:

DEVICE_ATTR_RW: include/linux/device.h
__ATTR_RW: include/linux/sysfs.h
S_IWUSR: include/uapi/linux/stat.h
S_IRUGO: include/linux/stat.h

Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  8:34     ` [-next PATCH 2/4] " Jarkko Nikula
  (?)
  (?)
@ 2017-12-20  9:24       ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:24 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky,
	Heiko Carstens, David Airlie, James E.J. Bottomley,
	Martin K. Petersen, Jiri Slaby, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
[] 
> > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
[]
> > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> >  	return size;
> >  }
> >  
> > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > +static DEVICE_ATTR_RW(dma_op_mode);
> >  
> 
> While I can ack this part here if it helps generic cleanup effort I
> don't understart would it improve code readability in general? Mode 644
> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> through all of these files in order to see what does it mean:

Are you suggesting that device.h (as that is where
DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
are #defined) should have better comments for the
_<FOO> variants?

> DEVICE_ATTR_RW: include/linux/device.h
> __ATTR_RW: include/linux/sysfs.h
> S_IWUSR: include/uapi/linux/stat.h
> S_IRUGO: include/linux/stat.h

btw: patch 1/4 of the series does remove the uses of
S_<PERMS> from these macros in sysfs.h and converts
them to simple octal instead.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:24       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:24 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter

On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
[] 
> > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
[]
> > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> >  	return size;
> >  }
> >  
> > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > +static DEVICE_ATTR_RW(dma_op_mode);
> >  
> 
> While I can ack this part here if it helps generic cleanup effort I
> don't understart would it improve code readability in general? Mode 644
> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> through all of these files in order to see what does it mean:

Are you suggesting that device.h (as that is where
DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
are #defined) should have better comments for the
_<FOO> variants?

> DEVICE_ATTR_RW: include/linux/device.h
> __ATTR_RW: include/linux/sysfs.h
> S_IWUSR: include/uapi/linux/stat.h
> S_IRUGO: include/linux/stat.h

btw: patch 1/4 of the series does remove the uses of
S_<PERMS> from these macros in sysfs.h and converts
them to simple octal instead.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:24       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:24 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Martin Schwidefsky,
	Heiko Carstens, David Airlie, James E.J. Bottomley,
	Martin K. Petersen, Jiri Slaby, Bartlomiej Zolnierkiewicz,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
[] 
> > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
[]
> > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> >  	return size;
> >  }
> >  
> > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > +static DEVICE_ATTR_RW(dma_op_mode);
> >  
> 
> While I can ack this part here if it helps generic cleanup effort I
> don't understart would it improve code readability in general? Mode 644
> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> through all of these files in order to see what does it mean:

Are you suggesting that device.h (as that is where
DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
are #defined) should have better comments for the
_<FOO> variants?

> DEVICE_ATTR_RW: include/linux/device.h
> __ATTR_RW: include/linux/sysfs.h
> S_IWUSR: include/uapi/linux/stat.h
> S_IRUGO: include/linux/stat.h

btw: patch 1/4 of the series does remove the uses of
S_<PERMS> from these macros in sysfs.h and converts
them to simple octal instead.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:24       ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:24 UTC (permalink / raw)
  To: Jarkko Nikula
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter

On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
[] 
> > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
[]
> > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> >  	return size;
> >  }
> >  
> > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > +static DEVICE_ATTR_RW(dma_op_mode);
> >  
> 
> While I can ack this part here if it helps generic cleanup effort I
> don't understart would it improve code readability in general? Mode 644
> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> through all of these files in order to see what does it mean:

Are you suggesting that device.h (as that is where
DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
are #defined) should have better comments for the
_<FOO> variants?

> DEVICE_ATTR_RW: include/linux/device.h
> __ATTR_RW: include/linux/sysfs.h
> S_IWUSR: include/uapi/linux/stat.h
> S_IRUGO: include/linux/stat.h

btw: patch 1/4 of the series does remove the uses of
S_<PERMS> from these macros in sysfs.h and converts
them to simple octal instead.


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  9:24       ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-20  9:32         ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> [] 
> > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> []
> > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > >  	return size;
> > >  }
> > >  
> > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > +static DEVICE_ATTR_RW(dma_op_mode);
> > >  
> > 
> > While I can ack this part here if it helps generic cleanup effort I
> > don't understart would it improve code readability in general? Mode 644
> > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > through all of these files in order to see what does it mean:

Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
get rid of all of the "non-standard" users that set random modes of
sysfs files, as we get it wrong too many times.  Using the "defaults" is
much better.

> Are you suggesting that device.h (as that is where
> DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> are #defined) should have better comments for the
> _<FOO> variants?
> 
> > DEVICE_ATTR_RW: include/linux/device.h
> > __ATTR_RW: include/linux/sysfs.h
> > S_IWUSR: include/uapi/linux/stat.h
> > S_IRUGO: include/linux/stat.h
> 
> btw: patch 1/4 of the series does remove the uses of
> S_<PERMS> from these macros in sysfs.h and converts
> them to simple octal instead.

Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

I should be taking this whole series through my tree.  Joe, thanks for
doing this in an automated way, I've been wanting to see this done for a
long time.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:32         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko

On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> [] 
> > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> []
> > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > >  	return size;
> > >  }
> > >  
> > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > +static DEVICE_ATTR_RW(dma_op_mode);
> > >  
> > 
> > While I can ack this part here if it helps generic cleanup effort I
> > don't understart would it improve code readability in general? Mode 644
> > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > through all of these files in order to see what does it mean:

Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
get rid of all of the "non-standard" users that set random modes of
sysfs files, as we get it wrong too many times.  Using the "defaults" is
much better.

> Are you suggesting that device.h (as that is where
> DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> are #defined) should have better comments for the
> _<FOO> variants?
> 
> > DEVICE_ATTR_RW: include/linux/device.h
> > __ATTR_RW: include/linux/sysfs.h
> > S_IWUSR: include/uapi/linux/stat.h
> > S_IRUGO: include/linux/stat.h
> 
> btw: patch 1/4 of the series does remove the uses of
> S_<PERMS> from these macros in sysfs.h and converts
> them to simple octal instead.

Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

I should be taking this whole series through my tree.  Joe, thanks for
doing this in an automated way, I've been wanting to see this done for a
long time.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:32         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> [] 
> > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> []
> > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > >  	return size;
> > >  }
> > >  
> > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > +static DEVICE_ATTR_RW(dma_op_mode);
> > >  
> > 
> > While I can ack this part here if it helps generic cleanup effort I
> > don't understart would it improve code readability in general? Mode 644
> > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > through all of these files in order to see what does it mean:

Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
get rid of all of the "non-standard" users that set random modes of
sysfs files, as we get it wrong too many times.  Using the "defaults" is
much better.

> Are you suggesting that device.h (as that is where
> DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> are #defined) should have better comments for the
> _<FOO> variants?
> 
> > DEVICE_ATTR_RW: include/linux/device.h
> > __ATTR_RW: include/linux/sysfs.h
> > S_IWUSR: include/uapi/linux/stat.h
> > S_IRUGO: include/linux/stat.h
> 
> btw: patch 1/4 of the series does remove the uses of
> S_<PERMS> from these macros in sysfs.h and converts
> them to simple octal instead.

Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

I should be taking this whole series through my tree.  Joe, thanks for
doing this in an automated way, I've been wanting to see this done for a
long time.

thanks,

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:32         ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:32 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko

On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> [] 
> > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> []
> > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > >  	return size;
> > >  }
> > >  
> > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > +static DEVICE_ATTR_RW(dma_op_mode);
> > >  
> > 
> > While I can ack this part here if it helps generic cleanup effort I
> > don't understart would it improve code readability in general? Mode 644
> > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > through all of these files in order to see what does it mean:

Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
get rid of all of the "non-standard" users that set random modes of
sysfs files, as we get it wrong too many times.  Using the "defaults" is
much better.

> Are you suggesting that device.h (as that is where
> DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> are #defined) should have better comments for the
> _<FOO> variants?
> 
> > DEVICE_ATTR_RW: include/linux/device.h
> > __ATTR_RW: include/linux/sysfs.h
> > S_IWUSR: include/uapi/linux/stat.h
> > S_IRUGO: include/linux/stat.h
> 
> btw: patch 1/4 of the series does remove the uses of
> S_<PERMS> from these macros in sysfs.h and converts
> them to simple octal instead.

Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

I should be taking this whole series through my tree.  Joe, thanks for
doing this in an automated way, I've been wanting to see this done for a
long time.

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
  2017-12-19 18:15 ` Joe Perches
                     ` (2 preceding siblings ...)
  (?)
@ 2017-12-20  9:46   ` Felipe Balbi
  -1 siblings, 0 replies; 99+ messages in thread
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media


Hi,

Joe Perches <joe@perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-20  9:46   ` Felipe Balbi
  0 siblings, 0 replies; 99+ messages in thread
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: devel, linux-fbdev, linux-sh, dri-devel, linux-input, linux-media


Hi,

Joe Perches <joe@perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-20  9:46   ` Felipe Balbi
  0 siblings, 0 replies; 99+ messages in thread
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)
  To: Joe Perches, linux-arm-kernel, linux-acpi, openipmi-developer,
	intel-gfx, linuxppc-dev, netdev, linux-nvme, platform-driver-x86,
	linux-s390, esc.storagedev, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-kernel, alsa-devel, linux-omap
  Cc: linux-sh, dri-devel, linux-input, linux-media, devel, linux-fbdev


Hi,

Joe Perches <joe@perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-20  9:46   ` Felipe Balbi
  0 siblings, 0 replies; 99+ messages in thread
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)



Hi,

Joe Perches <joe at perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi at linux.intel.com>

-- 
balbi

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo>
@ 2017-12-20  9:46   ` Felipe Balbi
  0 siblings, 0 replies; 99+ messages in thread
From: Felipe Balbi @ 2017-12-20  9:46 UTC (permalink / raw)
  To: linux-arm-kernel


Hi,

Joe Perches <joe@perches.com> writes:
>  drivers/usb/phy/phy-tahvo.c                        |  2 +-

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>

-- 
balbi

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  9:32         ` [-next PATCH 2/4] " Greg Kroah-Hartman
  (?)
  (?)
@ 2017-12-20  9:54           ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > 
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > 
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
> > Are you suggesting that device.h (as that is where
> > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > are #defined) should have better comments for the
> > _<FOO> variants?
> > 
> > > DEVICE_ATTR_RW: include/linux/device.h
> > > __ATTR_RW: include/linux/sysfs.h
> > > S_IWUSR: include/uapi/linux/stat.h
> > > S_IRUGO: include/linux/stat.h
> > 
> > btw: patch 1/4 of the series does remove the uses of
> > S_<PERMS> from these macros in sysfs.h and converts
> > them to simple octal instead.
> 
> Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

So here's an opportunity for you:

The sysfs maintainer hasn't added include/linux/sysfs.h to
the list of maintained files...

DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
S:	Supported
F:	Documentation/kobject.txt
F:	drivers/base/
F:	fs/debugfs/
F:	fs/sysfs/
F:	include/linux/debugfs.h
F:	include/linux/kobj*
F:	lib/kobj*

> I should be taking this whole series through my tree.  Joe, thanks for
> doing this in an automated way, I've been wanting to see this done for a
> long time.

btw: there are many uses of a reversed declaration style of DEVICE_ATTR

Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.

===

Some DEVICE_ATTR definitions use a reversed static function form from
the typical.  Convert them to use the more common macro form so it is
easier to grep for the style.

i.e.:
        static ssize_t show_<foo>(...)
and
        static ssize_t store_<foo>(...)

where the static function names in the DEVICE_ATTR_RW macro are reversed

        static ssize_t <foo>_show(...)
and
        static ssize_t <foo>_store(...)

Done with perl script

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
        my $var = $1;
        if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
            $file =~ s/\bshow_${var}\b/${var}_show/g;
            $file =~ s/\bstore_${var}\b/${var}_store/g;
        }
    }
    print $file;
}

$ git grep --name-only -w DEVICE_ATTR | \
  xargs perl -i dev_attr_rw_backwards.perl

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:54           ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx

On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > 
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > 
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
> > Are you suggesting that device.h (as that is where
> > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > are #defined) should have better comments for the
> > _<FOO> variants?
> > 
> > > DEVICE_ATTR_RW: include/linux/device.h
> > > __ATTR_RW: include/linux/sysfs.h
> > > S_IWUSR: include/uapi/linux/stat.h
> > > S_IRUGO: include/linux/stat.h
> > 
> > btw: patch 1/4 of the series does remove the uses of
> > S_<PERMS> from these macros in sysfs.h and converts
> > them to simple octal instead.
> 
> Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

So here's an opportunity for you:

The sysfs maintainer hasn't added include/linux/sysfs.h to
the list of maintained files...

DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
S:	Supported
F:	Documentation/kobject.txt
F:	drivers/base/
F:	fs/debugfs/
F:	fs/sysfs/
F:	include/linux/debugfs.h
F:	include/linux/kobj*
F:	lib/kobj*

> I should be taking this whole series through my tree.  Joe, thanks for
> doing this in an automated way, I've been wanting to see this done for a
> long time.

btw: there are many uses of a reversed declaration style of DEVICE_ATTR

Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.

===

Some DEVICE_ATTR definitions use a reversed static function form from
the typical.  Convert them to use the more common macro form so it is
easier to grep for the style.

i.e.:
        static ssize_t show_<foo>(...)
and
        static ssize_t store_<foo>(...)

where the static function names in the DEVICE_ATTR_RW macro are reversed

        static ssize_t <foo>_show(...)
and
        static ssize_t <foo>_store(...)

Done with perl script

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
        my $var = $1;
        if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
            $file =~ s/\bshow_${var}\b/${var}_show/g;
            $file =~ s/\bstore_${var}\b/${var}_store/g;
        }
    }
    print $file;
}

$ git grep --name-only -w DEVICE_ATTR | \
  xargs perl -i dev_attr_rw_backwards.perl


_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:54           ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > 
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > 
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
> > Are you suggesting that device.h (as that is where
> > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > are #defined) should have better comments for the
> > _<FOO> variants?
> > 
> > > DEVICE_ATTR_RW: include/linux/device.h
> > > __ATTR_RW: include/linux/sysfs.h
> > > S_IWUSR: include/uapi/linux/stat.h
> > > S_IRUGO: include/linux/stat.h
> > 
> > btw: patch 1/4 of the series does remove the uses of
> > S_<PERMS> from these macros in sysfs.h and converts
> > them to simple octal instead.
> 
> Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

So here's an opportunity for you:

The sysfs maintainer hasn't added include/linux/sysfs.h to
the list of maintained files...

DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
S:	Supported
F:	Documentation/kobject.txt
F:	drivers/base/
F:	fs/debugfs/
F:	fs/sysfs/
F:	include/linux/debugfs.h
F:	include/linux/kobj*
F:	lib/kobj*

> I should be taking this whole series through my tree.  Joe, thanks for
> doing this in an automated way, I've been wanting to see this done for a
> long time.

btw: there are many uses of a reversed declaration style of DEVICE_ATTR

Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.

===

Some DEVICE_ATTR definitions use a reversed static function form from
the typical.  Convert them to use the more common macro form so it is
easier to grep for the style.

i.e.:
        static ssize_t show_<foo>(...)
and
        static ssize_t store_<foo>(...)

where the static function names in the DEVICE_ATTR_RW macro are reversed

        static ssize_t <foo>_show(...)
and
        static ssize_t <foo>_store(...)

Done with perl script

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
        my $var = $1;
        if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
            $file =~ s/\bshow_${var}\b/${var}_show/g;
            $file =~ s/\bstore_${var}\b/${var}_store/g;
        }
    }
    print $file;
}

$ git grep --name-only -w DEVICE_ATTR | \
  xargs perl -i dev_attr_rw_backwards.perl
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:54           ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20  9:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx

On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > 
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > 
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
> > Are you suggesting that device.h (as that is where
> > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > are #defined) should have better comments for the
> > _<FOO> variants?
> > 
> > > DEVICE_ATTR_RW: include/linux/device.h
> > > __ATTR_RW: include/linux/sysfs.h
> > > S_IWUSR: include/uapi/linux/stat.h
> > > S_IRUGO: include/linux/stat.h
> > 
> > btw: patch 1/4 of the series does remove the uses of
> > S_<PERMS> from these macros in sysfs.h and converts
> > them to simple octal instead.
> 
> Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)

So here's an opportunity for you:

The sysfs maintainer hasn't added include/linux/sysfs.h to
the list of maintained files...

DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
S:	Supported
F:	Documentation/kobject.txt
F:	drivers/base/
F:	fs/debugfs/
F:	fs/sysfs/
F:	include/linux/debugfs.h
F:	include/linux/kobj*
F:	lib/kobj*

> I should be taking this whole series through my tree.  Joe, thanks for
> doing this in an automated way, I've been wanting to see this done for a
> long time.

btw: there are many uses of a reversed declaration style of DEVICE_ATTR

Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.

=
Some DEVICE_ATTR definitions use a reversed static function form from
the typical.  Convert them to use the more common macro form so it is
easier to grep for the style.

i.e.:
        static ssize_t show_<foo>(...)
and
        static ssize_t store_<foo>(...)

where the static function names in the DEVICE_ATTR_RW macro are reversed

        static ssize_t <foo>_show(...)
and
        static ssize_t <foo>_store(...)

Done with perl script

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
        my $var = $1;
        if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
            $file =~ s/\bshow_${var}\b/${var}_show/g;
            $file =~ s/\bstore_${var}\b/${var}_store/g;
        }
    }
    print $file;
}

$ git grep --name-only -w DEVICE_ATTR | \
  xargs perl -i dev_attr_rw_backwards.perl



^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  9:54           ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-20  9:59             ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 01:54:41AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> > On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > > 
> > > [] 
> > > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > > 
> > > []
> > > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > > >  	return size;
> > > > >  }
> > > > >  
> > > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > > >  
> > > > 
> > > > While I can ack this part here if it helps generic cleanup effort I
> > > > don't understart would it improve code readability in general? Mode 644
> > > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > > through all of these files in order to see what does it mean:
> > 
> > Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> > get rid of all of the "non-standard" users that set random modes of
> > sysfs files, as we get it wrong too many times.  Using the "defaults" is
> > much better.
> > 
> > > Are you suggesting that device.h (as that is where
> > > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > > are #defined) should have better comments for the
> > > _<FOO> variants?
> > > 
> > > > DEVICE_ATTR_RW: include/linux/device.h
> > > > __ATTR_RW: include/linux/sysfs.h
> > > > S_IWUSR: include/uapi/linux/stat.h
> > > > S_IRUGO: include/linux/stat.h
> > > 
> > > btw: patch 1/4 of the series does remove the uses of
> > > S_<PERMS> from these macros in sysfs.h and converts
> > > them to simple octal instead.
> > 
> > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> 
> So here's an opportunity for you:
> 
> The sysfs maintainer hasn't added include/linux/sysfs.h to
> the list of maintained files...
> 
> DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> S:	Supported
> F:	Documentation/kobject.txt
> F:	drivers/base/
> F:	fs/debugfs/
> F:	fs/sysfs/
> F:	include/linux/debugfs.h
> F:	include/linux/kobj*
> F:	lib/kobj*

Heh, good point, but using get_maintainer.pl does put me at the top of
the list that you should be cc:ing:

$ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
linux-kernel@vger.kernel.org (open list)

Anyway, I'll go add sysfs.h to the list, thanks for pointing it out.

> > I should be taking this whole series through my tree.  Joe, thanks for
> > doing this in an automated way, I've been wanting to see this done for a
> > long time.
> 
> btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> 
> Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> 
> ===
> 
> Some DEVICE_ATTR definitions use a reversed static function form from
> the typical.  Convert them to use the more common macro form so it is
> easier to grep for the style.
> 
> i.e.:
>         static ssize_t show_<foo>(...)
> and
>         static ssize_t store_<foo>(...)
> 
> where the static function names in the DEVICE_ATTR_RW macro are reversed
> 
>         static ssize_t <foo>_show(...)
> and
>         static ssize_t <foo>_store(...)
> 
> Done with perl script
> 
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
>         my $var = $1;
>         if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
>             $file =~ s/\bshow_${var}\b/${var}_show/g;
>             $file =~ s/\bstore_${var}\b/${var}_store/g;
>         }
>     }
>     print $file;
> }
> 
> $ git grep --name-only -w DEVICE_ATTR | \
>   xargs perl -i dev_attr_rw_backwards.perl
> 

Ah, nice, I love perl :)

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:59             ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx

On Wed, Dec 20, 2017 at 01:54:41AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> > On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > > 
> > > [] 
> > > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > > 
> > > []
> > > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > > >  	return size;
> > > > >  }
> > > > >  
> > > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > > >  
> > > > 
> > > > While I can ack this part here if it helps generic cleanup effort I
> > > > don't understart would it improve code readability in general? Mode 644
> > > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > > through all of these files in order to see what does it mean:
> > 
> > Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> > get rid of all of the "non-standard" users that set random modes of
> > sysfs files, as we get it wrong too many times.  Using the "defaults" is
> > much better.
> > 
> > > Are you suggesting that device.h (as that is where
> > > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > > are #defined) should have better comments for the
> > > _<FOO> variants?
> > > 
> > > > DEVICE_ATTR_RW: include/linux/device.h
> > > > __ATTR_RW: include/linux/sysfs.h
> > > > S_IWUSR: include/uapi/linux/stat.h
> > > > S_IRUGO: include/linux/stat.h
> > > 
> > > btw: patch 1/4 of the series does remove the uses of
> > > S_<PERMS> from these macros in sysfs.h and converts
> > > them to simple octal instead.
> > 
> > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> 
> So here's an opportunity for you:
> 
> The sysfs maintainer hasn't added include/linux/sysfs.h to
> the list of maintained files...
> 
> DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> S:	Supported
> F:	Documentation/kobject.txt
> F:	drivers/base/
> F:	fs/debugfs/
> F:	fs/sysfs/
> F:	include/linux/debugfs.h
> F:	include/linux/kobj*
> F:	lib/kobj*

Heh, good point, but using get_maintainer.pl does put me at the top of
the list that you should be cc:ing:

$ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
linux-kernel@vger.kernel.org (open list)

Anyway, I'll go add sysfs.h to the list, thanks for pointing it out.

> > I should be taking this whole series through my tree.  Joe, thanks for
> > doing this in an automated way, I've been wanting to see this done for a
> > long time.
> 
> btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> 
> Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> 
> ===
> 
> Some DEVICE_ATTR definitions use a reversed static function form from
> the typical.  Convert them to use the more common macro form so it is
> easier to grep for the style.
> 
> i.e.:
>         static ssize_t show_<foo>(...)
> and
>         static ssize_t store_<foo>(...)
> 
> where the static function names in the DEVICE_ATTR_RW macro are reversed
> 
>         static ssize_t <foo>_show(...)
> and
>         static ssize_t <foo>_store(...)
> 
> Done with perl script
> 
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
>         my $var = $1;
>         if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
>             $file =~ s/\bshow_${var}\b/${var}_show/g;
>             $file =~ s/\bstore_${var}\b/${var}_store/g;
>         }
>     }
>     print $file;
> }
> 
> $ git grep --name-only -w DEVICE_ATTR | \
>   xargs perl -i dev_attr_rw_backwards.perl
> 

Ah, nice, I love perl :)

greg k-h
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:59             ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 01:54:41AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> > On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > > 
> > > [] 
> > > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > > 
> > > []
> > > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > > >  	return size;
> > > > >  }
> > > > >  
> > > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > > >  
> > > > 
> > > > While I can ack this part here if it helps generic cleanup effort I
> > > > don't understart would it improve code readability in general? Mode 644
> > > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > > through all of these files in order to see what does it mean:
> > 
> > Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> > get rid of all of the "non-standard" users that set random modes of
> > sysfs files, as we get it wrong too many times.  Using the "defaults" is
> > much better.
> > 
> > > Are you suggesting that device.h (as that is where
> > > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > > are #defined) should have better comments for the
> > > _<FOO> variants?
> > > 
> > > > DEVICE_ATTR_RW: include/linux/device.h
> > > > __ATTR_RW: include/linux/sysfs.h
> > > > S_IWUSR: include/uapi/linux/stat.h
> > > > S_IRUGO: include/linux/stat.h
> > > 
> > > btw: patch 1/4 of the series does remove the uses of
> > > S_<PERMS> from these macros in sysfs.h and converts
> > > them to simple octal instead.
> > 
> > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> 
> So here's an opportunity for you:
> 
> The sysfs maintainer hasn't added include/linux/sysfs.h to
> the list of maintained files...
> 
> DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> S:	Supported
> F:	Documentation/kobject.txt
> F:	drivers/base/
> F:	fs/debugfs/
> F:	fs/sysfs/
> F:	include/linux/debugfs.h
> F:	include/linux/kobj*
> F:	lib/kobj*

Heh, good point, but using get_maintainer.pl does put me at the top of
the list that you should be cc:ing:

$ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
linux-kernel@vger.kernel.org (open list)

Anyway, I'll go add sysfs.h to the list, thanks for pointing it out.

> > I should be taking this whole series through my tree.  Joe, thanks for
> > doing this in an automated way, I've been wanting to see this done for a
> > long time.
> 
> btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> 
> Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> 
> ===
> 
> Some DEVICE_ATTR definitions use a reversed static function form from
> the typical.  Convert them to use the more common macro form so it is
> easier to grep for the style.
> 
> i.e.:
>         static ssize_t show_<foo>(...)
> and
>         static ssize_t store_<foo>(...)
> 
> where the static function names in the DEVICE_ATTR_RW macro are reversed
> 
>         static ssize_t <foo>_show(...)
> and
>         static ssize_t <foo>_store(...)
> 
> Done with perl script
> 
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
>         my $var = $1;
>         if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
>             $file =~ s/\bshow_${var}\b/${var}_show/g;
>             $file =~ s/\bstore_${var}\b/${var}_store/g;
>         }
>     }
>     print $file;
> }
> 
> $ git grep --name-only -w DEVICE_ATTR | \
>   xargs perl -i dev_attr_rw_backwards.perl
> 

Ah, nice, I love perl :)

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20  9:59             ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2017-12-20  9:59 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx

On Wed, Dec 20, 2017 at 01:54:41AM -0800, Joe Perches wrote:
> On Wed, 2017-12-20 at 10:32 +0100, Greg Kroah-Hartman wrote:
> > On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > > 
> > > [] 
> > > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > > 
> > > []
> > > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > > >  	return size;
> > > > >  }
> > > > >  
> > > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > > >  
> > > > 
> > > > While I can ack this part here if it helps generic cleanup effort I
> > > > don't understart would it improve code readability in general? Mode 644
> > > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > > through all of these files in order to see what does it mean:
> > 
> > Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> > get rid of all of the "non-standard" users that set random modes of
> > sysfs files, as we get it wrong too many times.  Using the "defaults" is
> > much better.
> > 
> > > Are you suggesting that device.h (as that is where
> > > DEVICE_ATTR and the other DEVICE_ATTR_<FOO> variants
> > > are #defined) should have better comments for the
> > > _<FOO> variants?
> > > 
> > > > DEVICE_ATTR_RW: include/linux/device.h
> > > > __ATTR_RW: include/linux/sysfs.h
> > > > S_IWUSR: include/uapi/linux/stat.h
> > > > S_IRUGO: include/linux/stat.h
> > > 
> > > btw: patch 1/4 of the series does remove the uses of
> > > S_<PERMS> from these macros in sysfs.h and converts
> > > them to simple octal instead.
> > 
> > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> 
> So here's an opportunity for you:
> 
> The sysfs maintainer hasn't added include/linux/sysfs.h to
> the list of maintained files...
> 
> DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> S:	Supported
> F:	Documentation/kobject.txt
> F:	drivers/base/
> F:	fs/debugfs/
> F:	fs/sysfs/
> F:	include/linux/debugfs.h
> F:	include/linux/kobj*
> F:	lib/kobj*

Heh, good point, but using get_maintainer.pl does put me at the top of
the list that you should be cc:ing:

$ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3\x100%,authored:2/3g%,added_lines:7/8ˆ%)
Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/33%)
Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/33%)
Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/33%)
Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/33%,authored:1/33%,added_lines:1/8\x12%,removed_lines:1/1\x100%)
linux-kernel@vger.kernel.org (open list)

Anyway, I'll go add sysfs.h to the list, thanks for pointing it out.

> > I should be taking this whole series through my tree.  Joe, thanks for
> > doing this in an automated way, I've been wanting to see this done for a
> > long time.
> 
> btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> 
> Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> 
> => 
> Some DEVICE_ATTR definitions use a reversed static function form from
> the typical.  Convert them to use the more common macro form so it is
> easier to grep for the style.
> 
> i.e.:
>         static ssize_t show_<foo>(...)
> and
>         static ssize_t store_<foo>(...)
> 
> where the static function names in the DEVICE_ATTR_RW macro are reversed
> 
>         static ssize_t <foo>_show(...)
> and
>         static ssize_t <foo>_store(...)
> 
> Done with perl script
> 
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
>         my $var = $1;
>         if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S
>             $file =~ s/\bshow_${var}\b/${var}_show/g;
>             $file =~ s/\bstore_${var}\b/${var}_store/g;
>         }
>     }
>     print $file;
> }
> 
> $ git grep --name-only -w DEVICE_ATTR | \
>   xargs perl -i dev_attr_rw_backwards.perl
> 

Ah, nice, I love perl :)

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  9:32         ` [-next PATCH 2/4] " Greg Kroah-Hartman
  (?)
  (?)
@ 2017-12-20 10:54           ` Jarkko Nikula
  -1 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20 10:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
previous reply):

Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:54           ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20 10:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky

On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
previous reply):

Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:54           ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20 10:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
previous reply):

Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:54           ` Jarkko Nikula
  0 siblings, 0 replies; 99+ messages in thread
From: Jarkko Nikula @ 2017-12-20 10:54 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky

On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
> > On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
> > > On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
> > > > Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
> > [] 
> > > > diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> > []
> > > > @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
> > > >  	return size;
> > > >  }
> > > >  
> > > > -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
> > > > +static DEVICE_ATTR_RW(dma_op_mode);
> > > >  
> > > 
> > > While I can ack this part here if it helps generic cleanup effort I
> > > don't understart would it improve code readability in general? Mode 644
> > > is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
> > > through all of these files in order to see what does it mean:
> 
> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
> get rid of all of the "non-standard" users that set random modes of
> sysfs files, as we get it wrong too many times.  Using the "defaults" is
> much better.
> 
Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
previous reply):

Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20  9:59             ` [-next PATCH 2/4] " Greg Kroah-Hartman
  (?)
  (?)
@ 2017-12-20 10:55               ` Joe Perches
  -1 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20 10:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Julia Lawall
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > 
> > So here's an opportunity for you:
> > 
> > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > the list of maintained files...
> > 
> > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > S:	Supported
> > F:	Documentation/kobject.txt
> > F:	drivers/base/
> > F:	fs/debugfs/
> > F:	fs/sysfs/
> > F:	include/linux/debugfs.h
> > F:	include/linux/kobj*
> > F:	lib/kobj*
> 
> Heh, good point, but using get_maintainer.pl does put me at the top of
> the list that you should be cc:ing:
> 
> $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> linux-kernel@vger.kernel.org (open list)

The script I use to send patches adds --nogit --nogit-fallback
to copy only listed maintainers because people that send cleanup
patches don't generally like to get random patches.

> > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > 
> > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > 
> > ===
> > 
> > Some DEVICE_ATTR definitions use a reversed static function form from
> > the typical.  Convert them to use the more common macro form so it is
> > easier to grep for the style.
[]
> > $ git grep --name-only -w DEVICE_ATTR | \
> >   xargs perl -i dev_attr_rw_backwards.perl
> Ah, nice, I love perl :

That was a bad copy/paste of the script.

The actual script for RW is:

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
	my $var = $1;
	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
	    $file =~ s/\bshow_${var}\b/${var}_show/g;
	    $file =~ s/\bstore_${var}\b/${var}_store/g;
	}
    }
    print $file;
}

There are 3 different perl scripts for rw, ro, and wo.
and these scripts, because of function renaming and
possible reuse of the original function names by other
string concatenated macros, create some bad conversions
so they need some manual cleanups too.

Perhaps coccinelle could do a better job of it, but
likely string concatenation macro uses are going to
be hard to deal with in any case.

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:55               ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20 10:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Julia Lawall
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter

On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > 
> > So here's an opportunity for you:
> > 
> > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > the list of maintained files...
> > 
> > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > S:	Supported
> > F:	Documentation/kobject.txt
> > F:	drivers/base/
> > F:	fs/debugfs/
> > F:	fs/sysfs/
> > F:	include/linux/debugfs.h
> > F:	include/linux/kobj*
> > F:	lib/kobj*
> 
> Heh, good point, but using get_maintainer.pl does put me at the top of
> the list that you should be cc:ing:
> 
> $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> linux-kernel@vger.kernel.org (open list)

The script I use to send patches adds --nogit --nogit-fallback
to copy only listed maintainers because people that send cleanup
patches don't generally like to get random patches.

> > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > 
> > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > 
> > ===
> > 
> > Some DEVICE_ATTR definitions use a reversed static function form from
> > the typical.  Convert them to use the more common macro form so it is
> > easier to grep for the style.
[]
> > $ git grep --name-only -w DEVICE_ATTR | \
> >   xargs perl -i dev_attr_rw_backwards.perl
> Ah, nice, I love perl :

That was a bad copy/paste of the script.

The actual script for RW is:

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
	my $var = $1;
	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
	    $file =~ s/\bshow_${var}\b/${var}_show/g;
	    $file =~ s/\bstore_${var}\b/${var}_store/g;
	}
    }
    print $file;
}

There are 3 different perl scripts for rw, ro, and wo.
and these scripts, because of function renaming and
possible reuse of the original function names by other
string concatenated macros, create some bad conversions
so they need some manual cleanups too.

Perhaps coccinelle could do a better job of it, but
likely string concatenation macro uses are going to
be hard to deal with in any case.

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:55               ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20 10:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Julia Lawall
  Cc: Jarkko Nikula, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Peter Ujfalusi, Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > 
> > So here's an opportunity for you:
> > 
> > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > the list of maintained files...
> > 
> > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > S:	Supported
> > F:	Documentation/kobject.txt
> > F:	drivers/base/
> > F:	fs/debugfs/
> > F:	fs/sysfs/
> > F:	include/linux/debugfs.h
> > F:	include/linux/kobj*
> > F:	lib/kobj*
> 
> Heh, good point, but using get_maintainer.pl does put me at the top of
> the list that you should be cc:ing:
> 
> $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> linux-kernel@vger.kernel.org (open list)

The script I use to send patches adds --nogit --nogit-fallback
to copy only listed maintainers because people that send cleanup
patches don't generally like to get random patches.

> > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > 
> > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > 
> > ===
> > 
> > Some DEVICE_ATTR definitions use a reversed static function form from
> > the typical.  Convert them to use the more common macro form so it is
> > easier to grep for the style.
[]
> > $ git grep --name-only -w DEVICE_ATTR | \
> >   xargs perl -i dev_attr_rw_backwards.perl
> Ah, nice, I love perl :

That was a bad copy/paste of the script.

The actual script for RW is:

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
	my $var = $1;
	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
	    $file =~ s/\bshow_${var}\b/${var}_show/g;
	    $file =~ s/\bstore_${var}\b/${var}_store/g;
	}
    }
    print $file;
}

There are 3 different perl scripts for rw, ro, and wo.
and these scripts, because of function renaming and
possible reuse of the original function names by other
string concatenated macros, create some bad conversions
so they need some manual cleanups too.

Perhaps coccinelle could do a better job of it, but
likely string concatenation macro uses are going to
be hard to deal with in any case.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 10:55               ` Joe Perches
  0 siblings, 0 replies; 99+ messages in thread
From: Joe Perches @ 2017-12-20 10:55 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Julia Lawall
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter

On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > 
> > So here's an opportunity for you:
> > 
> > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > the list of maintained files...
> > 
> > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > S:	Supported
> > F:	Documentation/kobject.txt
> > F:	drivers/base/
> > F:	fs/debugfs/
> > F:	fs/sysfs/
> > F:	include/linux/debugfs.h
> > F:	include/linux/kobj*
> > F:	lib/kobj*
> 
> Heh, good point, but using get_maintainer.pl does put me at the top of
> the list that you should be cc:ing:
> 
> $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3\x100%,authored:2/3g%,added_lines:7/8ˆ%)
> Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/33%)
> Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/33%)
> Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/33%)
> Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/33%,authored:1/33%,added_lines:1/8\x12%,removed_lines:1/1\x100%)
> linux-kernel@vger.kernel.org (open list)

The script I use to send patches adds --nogit --nogit-fallback
to copy only listed maintainers because people that send cleanup
patches don't generally like to get random patches.

> > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > 
> > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > 
> > => > 
> > Some DEVICE_ATTR definitions use a reversed static function form from
> > the typical.  Convert them to use the more common macro form so it is
> > easier to grep for the style.
[]
> > $ git grep --name-only -w DEVICE_ATTR | \
> >   xargs perl -i dev_attr_rw_backwards.perl
> Ah, nice, I love perl :

That was a bad copy/paste of the script.

The actual script for RW is:

$ cat dev_attr_rw_backwards.perl
local $/;
while (<>) {
    my $file = $_;
    while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
	my $var = $1;
	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
	    $file =~ s/\bshow_${var}\b/${var}_show/g;
	    $file =~ s/\bstore_${var}\b/${var}_store/g;
	}
    }
    print $file;
}

There are 3 different perl scripts for rw, ro, and wo.
and these scripts, because of function renaming and
possible reuse of the original function names by other
string concatenated macros, create some bad conversions
so they need some manual cleanups too.

Perhaps coccinelle could do a better job of it, but
likely string concatenation macro uses are going to
be hard to deal with in any case.


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20 10:55               ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-20 13:26                 ` Julia Lawall
  -1 siblings, 0 replies; 99+ messages in thread
From: Julia Lawall @ 2017-12-20 13:26 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Julia Lawall, Jarkko Nikula, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz, Darren Hart,
	Andy Shevchenko, Sebastian Ott, Peter Oberparleiter, James Smart,
	Dick Kennedy, Zhang Rui, Eduardo Valentin, Mathias Nyman,
	Felipe Balbi, Luis R. Rodriguez, Peter Ujfalusi,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap



On Wed, 20 Dec 2017, Joe Perches wrote:

> On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > >
> > > So here's an opportunity for you:
> > >
> > > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > > the list of maintained files...
> > >
> > > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > > S:	Supported
> > > F:	Documentation/kobject.txt
> > > F:	drivers/base/
> > > F:	fs/debugfs/
> > > F:	fs/sysfs/
> > > F:	include/linux/debugfs.h
> > > F:	include/linux/kobj*
> > > F:	lib/kobj*
> >
> > Heh, good point, but using get_maintainer.pl does put me at the top of
> > the list that you should be cc:ing:
> >
> > $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> > Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> > Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> > Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> > Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> > linux-kernel@vger.kernel.org (open list)
>
> The script I use to send patches adds --nogit --nogit-fallback
> to copy only listed maintainers because people that send cleanup
> patches don't generally like to get random patches.
>
> > > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > >
> > > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > >
> > > ===
> > >
> > > Some DEVICE_ATTR definitions use a reversed static function form from
> > > the typical.  Convert them to use the more common macro form so it is
> > > easier to grep for the style.
> []
> > > $ git grep --name-only -w DEVICE_ATTR | \
> > >   xargs perl -i dev_attr_rw_backwards.perl
> > Ah, nice, I love perl :
>
> That was a bad copy/paste of the script.
>
> The actual script for RW is:
>
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
> 	my $var = $1;
> 	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
> 	    $file =~ s/\bshow_${var}\b/${var}_show/g;
> 	    $file =~ s/\bstore_${var}\b/${var}_store/g;
> 	}
>     }
>     print $file;
> }
>
> There are 3 different perl scripts for rw, ro, and wo.
> and these scripts, because of function renaming and
> possible reuse of the original function names by other
> string concatenated macros, create some bad conversions
> so they need some manual cleanups too.
>
> Perhaps coccinelle could do a better job of it, but
> likely string concatenation macro uses are going to
> be hard to deal with in any case.

I made a rule for this at one point, but there are cases where the
functions have the wrong names, and then these functions may be used
elsewhere.

julia

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 13:26                 ` Julia Lawall
  0 siblings, 0 replies; 99+ messages in thread
From: Julia Lawall @ 2017-12-20 13:26 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter



On Wed, 20 Dec 2017, Joe Perches wrote:

> On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > >
> > > So here's an opportunity for you:
> > >
> > > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > > the list of maintained files...
> > >
> > > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > > S:	Supported
> > > F:	Documentation/kobject.txt
> > > F:	drivers/base/
> > > F:	fs/debugfs/
> > > F:	fs/sysfs/
> > > F:	include/linux/debugfs.h
> > > F:	include/linux/kobj*
> > > F:	lib/kobj*
> >
> > Heh, good point, but using get_maintainer.pl does put me at the top of
> > the list that you should be cc:ing:
> >
> > $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> > Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> > Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> > Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> > Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> > linux-kernel@vger.kernel.org (open list)
>
> The script I use to send patches adds --nogit --nogit-fallback
> to copy only listed maintainers because people that send cleanup
> patches don't generally like to get random patches.
>
> > > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > >
> > > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > >
> > > ===
> > >
> > > Some DEVICE_ATTR definitions use a reversed static function form from
> > > the typical.  Convert them to use the more common macro form so it is
> > > easier to grep for the style.
> []
> > > $ git grep --name-only -w DEVICE_ATTR | \
> > >   xargs perl -i dev_attr_rw_backwards.perl
> > Ah, nice, I love perl :
>
> That was a bad copy/paste of the script.
>
> The actual script for RW is:
>
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
> 	my $var = $1;
> 	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
> 	    $file =~ s/\bshow_${var}\b/${var}_show/g;
> 	    $file =~ s/\bstore_${var}\b/${var}_store/g;
> 	}
>     }
>     print $file;
> }
>
> There are 3 different perl scripts for rw, ro, and wo.
> and these scripts, because of function renaming and
> possible reuse of the original function names by other
> string concatenated macros, create some bad conversions
> so they need some manual cleanups too.
>
> Perhaps coccinelle could do a better job of it, but
> likely string concatenation macro uses are going to
> be hard to deal with in any case.

I made a rule for this at one point, but there are cases where the
functions have the wrong names, and then these functions may be used
elsewhere.

julia
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 13:26                 ` Julia Lawall
  0 siblings, 0 replies; 99+ messages in thread
From: Julia Lawall @ 2017-12-20 13:26 UTC (permalink / raw)
  To: Joe Perches
  Cc: Greg Kroah-Hartman, Julia Lawall, Jarkko Nikula, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz, Darren Hart,
	Andy Shevchenko, Sebastian Ott, Peter Oberparleiter, James Smart,
	Dick Kennedy, Zhang Rui, Eduardo Valentin, Mathias Nyman,
	Felipe Balbi, Luis R. Rodriguez, Peter Ujfalusi,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Wed, 20 Dec 2017, Joe Perches wrote:

> On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > >
> > > So here's an opportunity for you:
> > >
> > > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > > the list of maintained files...
> > >
> > > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > > S:	Supported
> > > F:	Documentation/kobject.txt
> > > F:	drivers/base/
> > > F:	fs/debugfs/
> > > F:	fs/sysfs/
> > > F:	include/linux/debugfs.h
> > > F:	include/linux/kobj*
> > > F:	lib/kobj*
> >
> > Heh, good point, but using get_maintainer.pl does put me at the top of
> > the list that you should be cc:ing:
> >
> > $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3=100%,authored:2/3=67%,added_lines:7/8=88%)
> > Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/3=33%)
> > Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/3=33%)
> > Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/3=33%)
> > Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/3=33%,authored:1/3=33%,added_lines:1/8=12%,removed_lines:1/1=100%)
> > linux-kernel@vger.kernel.org (open list)
>
> The script I use to send patches adds --nogit --nogit-fallback
> to copy only listed maintainers because people that send cleanup
> patches don't generally like to get random patches.
>
> > > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > >
> > > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > >
> > > ===
> > >
> > > Some DEVICE_ATTR definitions use a reversed static function form from
> > > the typical.  Convert them to use the more common macro form so it is
> > > easier to grep for the style.
> []
> > > $ git grep --name-only -w DEVICE_ATTR | \
> > >   xargs perl -i dev_attr_rw_backwards.perl
> > Ah, nice, I love perl :
>
> That was a bad copy/paste of the script.
>
> The actual script for RW is:
>
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
> 	my $var = $1;
> 	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
> 	    $file =~ s/\bshow_${var}\b/${var}_show/g;
> 	    $file =~ s/\bstore_${var}\b/${var}_store/g;
> 	}
>     }
>     print $file;
> }
>
> There are 3 different perl scripts for rw, ro, and wo.
> and these scripts, because of function renaming and
> possible reuse of the original function names by other
> string concatenated macros, create some bad conversions
> so they need some manual cleanups too.
>
> Perhaps coccinelle could do a better job of it, but
> likely string concatenation macro uses are going to
> be hard to deal with in any case.

I made a rule for this at one point, but there are cases where the
functions have the wrong names, and then these functions may be used
elsewhere.

julia
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-20 13:26                 ` Julia Lawall
  0 siblings, 0 replies; 99+ messages in thread
From: Julia Lawall @ 2017-12-20 13:26 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, Peter Ujfalusi,
	linux-s390, linux-omap, James E.J. Bottomley, linux-scsi,
	Takashi Iwai, Sebastian Ott, James Smart, Cezary Jackiewicz,
	linux-serial, Jiri Slaby, Darren Hart, Zhang Rui, Dick Kennedy,
	Mathias Nyman, Bartlomiej Zolnierkiewicz, Peter Oberparleiter



On Wed, 20 Dec 2017, Joe Perches wrote:

> On Wed, 2017-12-20 at 10:59 +0100, Greg Kroah-Hartman wrote:
> > > > Why you didn't send that patch to the sysfs maintainer is a bit odd...  :)
> > >
> > > So here's an opportunity for you:
> > >
> > > The sysfs maintainer hasn't added include/linux/sysfs.h to
> > > the list of maintained files...
> > >
> > > DRIVER CORE, KOBJECTS, DEBUGFS AND SYSFS
> > > M:	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > > T:	git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core.git
> > > S:	Supported
> > > F:	Documentation/kobject.txt
> > > F:	drivers/base/
> > > F:	fs/debugfs/
> > > F:	fs/sysfs/
> > > F:	include/linux/debugfs.h
> > > F:	include/linux/kobj*
> > > F:	lib/kobj*
> >
> > Heh, good point, but using get_maintainer.pl does put me at the top of
> > the list that you should be cc:ing:
> >
> > $ ./scripts/get_maintainer.pl --file include/linux/sysfs.h
> > Greg Kroah-Hartman <gregkh@linuxfoundation.org> (commit_signer:3/3\x100%,authored:2/3g%,added_lines:7/8ˆ%)
> > Kate Stewart <kstewart@linuxfoundation.org> (commit_signer:1/33%)
> > Thomas Gleixner <tglx@linutronix.de> (commit_signer:1/33%)
> > Philippe Ombredanne <pombredanne@nexb.com> (commit_signer:1/33%)
> > Nick Desaulniers <nick.desaulniers@gmail.com> (commit_signer:1/33%,authored:1/33%,added_lines:1/8\x12%,removed_lines:1/1\x100%)
> > linux-kernel@vger.kernel.org (open list)
>
> The script I use to send patches adds --nogit --nogit-fallback
> to copy only listed maintainers because people that send cleanup
> patches don't generally like to get random patches.
>
> > > btw: there are many uses of a reversed declaration style of DEVICE_ATTR
> > >
> > > Here's another thing that could be done for more DEVICE_ATTR_<FOO> uses.
> > >
> > > => > >
> > > Some DEVICE_ATTR definitions use a reversed static function form from
> > > the typical.  Convert them to use the more common macro form so it is
> > > easier to grep for the style.
> []
> > > $ git grep --name-only -w DEVICE_ATTR | \
> > >   xargs perl -i dev_attr_rw_backwards.perl
> > Ah, nice, I love perl :
>
> That was a bad copy/paste of the script.
>
> The actual script for RW is:
>
> $ cat dev_attr_rw_backwards.perl
> local $/;
> while (<>) {
>     my $file = $_;
>     while ($file =~ m/\bDEVICE_ATTR\s*\(\s*(\w+)\s*,/g) {
> 	my $var = $1;
> 	if ($file =~ s/\bDEVICE_ATTR\s*\(\s*${var}\s*,\s*\(?(\s*S_IRUGO\s*\|\s*S_IWUSR|\s*S_IWUSR\s*\|\s*S_IRUGO\s*|\s*0644\s*)\)?\s*,\s*show_${var}\s*,\s*store_${var}\s*\)/DEVICE_ATTR_RW(${var})/g) {
> 	    $file =~ s/\bshow_${var}\b/${var}_show/g;
> 	    $file =~ s/\bstore_${var}\b/${var}_store/g;
> 	}
>     }
>     print $file;
> }
>
> There are 3 different perl scripts for rw, ro, and wo.
> and these scripts, because of function renaming and
> possible reuse of the original function names by other
> string concatenated macros, create some bad conversions
> so they need some manual cleanups too.
>
> Perhaps coccinelle could do a better job of it, but
> likely string concatenation macro uses are going to
> be hard to deal with in any case.

I made a rule for this at one point, but there are cases where the
functions have the wrong names, and then these functions may be used
elsewhere.

julia

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-19 18:15   ` Joe Perches
  (?)
  (?)
@ 2017-12-20 19:00   ` Rafael J. Wysocki
  2017-12-20 20:26     ` Sagi Grimberg
  2017-12-20 21:38     ` Robert Jarzmik
  -1 siblings, 2 replies; 99+ messages in thread
From: Rafael J. Wysocki @ 2017-12-20 19:00 UTC (permalink / raw)
  To: Joe Perches
  Cc: Don Brace, linux-nvme, Rich Felker, linux-sh, David Airlie,
	esc.storagedev, Joonas Lahtinen, Heiko Carstens, alsa-devel,
	dri-devel, Russell King, Keith Busch, Robert Jarzmik,
	Christoph Hellwig, devel, linux-s390, James E.J. Bottomley,
	Sagi Grimberg, Yoshinori Sato, Takashi Iwai, Sebastian Ott,
	James Smart, linux-acpi, Zhang Rui, Len Brown

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

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-20 19:00   ` Rafael J. Wysocki
@ 2017-12-20 20:26     ` Sagi Grimberg
  2017-12-20 21:38     ` Robert Jarzmik
  1 sibling, 0 replies; 99+ messages in thread
From: Sagi Grimberg @ 2017-12-20 20:26 UTC (permalink / raw)
  To: Rafael J. Wysocki, Joe Perches
  Cc: Don Brace, linux-nvme, Rich Felker, linux-sh, David Airlie,
	esc.storagedev, Joonas Lahtinen, Heiko Carstens, alsa-devel,
	dri-devel, Russell King, Keith Busch, Robert Jarzmik,
	Christoph Hellwig, devel, linux-s390, James E.J. Bottomley,
	Arnd Bergmann, Yoshinori Sato, Takashi Iwai, Sebastian Ott,
	James Smart, linux-acpi, Zhang Rui, Len Brown, Dic

for the NVMe bits,

Acked-by: Sagi Grimberg <sagi@grimberg.me>

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-20 19:00   ` Rafael J. Wysocki
  2017-12-20 20:26     ` Sagi Grimberg
@ 2017-12-20 21:38     ` Robert Jarzmik
  1 sibling, 0 replies; 99+ messages in thread
From: Robert Jarzmik @ 2017-12-20 21:38 UTC (permalink / raw)
  To: Joe Perches
  Cc: Don Brace, linux-nvme, Rich Felker, linux-sh, David Airlie,
	esc.storagedev, Joonas Lahtinen, Heiko Carstens, alsa-devel,
	dri-devel, Jaroslav Kysela, Keith Busch, Russell King,
	Christoph Hellwig, devel, linux-s390, James E.J. Bottomley,
	Sagi Grimberg, Yoshinor i Sato, Takashi Iwai, Sebastian Ott,
	James Smart, linux-acpi, Zhang Rui, Len Brown

"Rafael J. Wysocki" <rjw@rjwysocki.net> writes:

> 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 ++--

For mach-pxa:
Acked-by: Robert Jarzmik <robert.jarzmik@free.fr>

Cheers.

--
Robert

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:15   ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2017-12-21  0:47     ` Zhang Rui
  -1 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:47 UTC (permalink / raw)
  To: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------
> ------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----

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

thanks,
rui

>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)
> 
> diff --git a/arch/s390/kernel/topology.c
> b/arch/s390/kernel/topology.c
> index 4d5b65e527b5..4b6e0397f66d 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device
> *dev,
>  	put_online_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(dispatching, 0644, dispatching_show,
> -			 dispatching_store);
> +static DEVICE_ATTR_RW(dispatching);
>  
>  static ssize_t cpu_polarization_show(struct device *dev,
>  				     struct device_attribute *attr,
> char *buf)
> diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
> index 825867c53853..af5024f0fb5a 100644
> --- a/arch/tile/kernel/sysfs.c
> +++ b/arch/tile/kernel/sysfs.c
> @@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
>  	return n < 0 ? n : count;
>  }
>  
> -static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
> +static DEVICE_ATTR_RW(hv_stats);
>  
>  static int hv_stats_device_add(struct device *dev, struct
> subsys_interface *sif)
>  {
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index c74a20b80182..1d0ab8ff5915 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct
> device *kdev,
>  
>  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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR,
> gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
> -static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR,
> gt_max_freq_mhz_show, gt_max_freq_mhz_store);
> -static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR,
> gt_min_freq_mhz_show, gt_min_freq_mhz_store);
> +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);
>  
> diff --git a/drivers/platform/x86/compal-laptop.c
> b/drivers/platform/x86/compal-laptop.c
> index 6bcb750e1865..4f9bc72f0584 100644
> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct
> power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -		0644, wake_up_pme_show,		wake_up_pme_s
> tore);
> -static DEVICE_ATTR(wake_up_modem,
> -		0644, wake_up_modem_show,	wake_up_modem_store
> );
> -static DEVICE_ATTR(wake_up_lan,
> -		0644, wake_up_lan_show,	wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -		0644, wake_up_wlan_show,	wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -		0644, wake_up_key_show,	wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -		0644, wake_up_mouse_show,	wake_up_mouse_store
> );
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);
>  
>  static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
>  static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 75a245f38e2e..6eefb67b31f3 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev,
> struct device_attribute *attr,
>  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(online, 0644, online_show, online_store);
> +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);
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 797bb42a6306..95f7ba3c3f1a 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2519,8 +2519,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
> @@ -2583,8 +2582,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
> @@ -3102,8 +3100,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] = {
> @@ -3336,8 +3333,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
> @@ -3386,8 +3382,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
> @@ -3580,8 +3575,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.
> @@ -3695,8 +3689,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
> @@ -3954,8 +3947,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.
> @@ -4194,8 +4186,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)
> @@ -4288,8 +4279,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
> @@ -4436,8 +4426,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
> @@ -4611,8 +4600,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.
> @@ -4772,8 +4760,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.
> @@ -4859,9 +4846,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index fb80c96d8f73..c008af7fb480 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
>   */
>  static DEVICE_ATTR(type, 0444, type_show, NULL);
>  static DEVICE_ATTR(temp, 0444, temp_show, NULL);
> -static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show,
> policy_store);
> +static DEVICE_ATTR_RW(policy);
>  static DEVICE_ATTR(available_policies, S_IRUGO,
> available_policies_show, NULL);
> -static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO,
> sustainable_power_show,
> -		   sustainable_power_store);
> +static DEVICE_ATTR_RW(sustainable_power);
>  
>  /* These thermal zone device attributes are created based on
> conditions */
> -static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
> -static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show,
> passive_store);
> +static DEVICE_ATTR_RW(mode);
> +static DEVICE_ATTR_RW(passive);
>  
>  /* These attributes are unconditionally added to a thermal zone */
>  static struct attribute *thermal_zone_dev_attrs[] = {
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-
> sci.c
> index d9f399c4e90c..7257c078e155 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct
> device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show,
> rx_fifo_timeout_store);
> +static DEVICE_ATTR_RW(rx_fifo_timeout);
>  
>  
>  #ifdef CONFIG_SERIAL_SH_SCI_DMA
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-
> dbgcap.c
> index 452df0f87d6e..a1ab8acf39ba 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
> +static DEVICE_ATTR_RW(dbc);
>  
>  int xhci_dbc_init(struct xhci_hcd *xhci)
>  {
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-
> tahvo.c
> index b3ce42edb373..7f7c5c82420d 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device
> *device,
>  
>  	return r;
>  }
> -static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
> +static DEVICE_ATTR_RW(otg_mode);
>  
>  static struct attribute *tahvo_attributes[] = {
>  	&dev_attr_vbus.attr,
> diff --git a/drivers/video/fbdev/auo_k190x.c
> b/drivers/video/fbdev/auo_k190x.c
> index 0d06038324e0..1e383c547633 100644
> --- a/drivers/video/fbdev/auo_k190x.c
> +++ b/drivers/video/fbdev/auo_k190x.c
> @@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev,
> struct device_attribute *attr,
>  	return sprintf(buf, "%d\n", temp);
>  }
>  
> -static DEVICE_ATTR(update_mode, 0644, update_mode_show,
> update_mode_store);
> -static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
> +static DEVICE_ATTR_RW(update_mode);
> +static DEVICE_ATTR_RW(flash);
>  static DEVICE_ATTR(temp, 0644, temp_show, NULL);
>  
>  static struct attribute *auok190x_attributes[] = {
> diff --git a/drivers/video/fbdev/w100fb.c
> b/drivers/video/fbdev/w100fb.c
> index d570e19a2864..035ff6e02894 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev,
> struct device_attribute *attr, con
>  	return count;
>  }
>  
> -static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
> +static DEVICE_ATTR_RW(flip);
>  
>  static ssize_t w100fb_reg_read(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t count)
>  {
> @@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device
> *dev, struct device_attribute *att
>  	return count;
>  }
>  
> -static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show,
> fastpllclk_store);
> +static DEVICE_ATTR_RW(fastpllclk);
>  
>  /*
>   * Some touchscreens need hsync information from the video driver to
> diff --git a/lib/test_firmware.c b/lib/test_firmware.c
> index 64a4c76cba2b..964784dc1602 100644
> --- a/lib/test_firmware.c
> +++ b/lib/test_firmware.c
> @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device
> *dev,
>  {
>  	return config_test_show_str(buf, test_fw_config->name);
>  }
> -static DEVICE_ATTR(config_name, 0644, config_name_show,
> config_name_store);
> +static DEVICE_ATTR_RW(config_name);
>  
>  static ssize_t config_num_requests_store(struct device *dev,
>  					 struct device_attribute
> *attr,
> @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >num_requests);
>  }
> -static DEVICE_ATTR(config_num_requests, 0644,
> config_num_requests_show,
> -		   config_num_requests_store);
> +static DEVICE_ATTR_RW(config_num_requests);
>  
>  static ssize_t config_sync_direct_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >sync_direct);
>  }
> -static DEVICE_ATTR(config_sync_direct, 0644,
> config_sync_direct_show,
> -		   config_sync_direct_store);
> +static DEVICE_ATTR_RW(config_sync_direct);
>  
>  static ssize_t config_send_uevent_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >send_uevent);
>  }
> -static DEVICE_ATTR(config_send_uevent, 0644,
> config_send_uevent_show,
> -		   config_send_uevent_store);
> +static DEVICE_ATTR_RW(config_send_uevent);
>  
>  static ssize_t config_read_fw_idx_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >read_fw_idx);
>  }
> -static DEVICE_ATTR(config_read_fw_idx, 0644,
> config_read_fw_idx_show,
> -		   config_read_fw_idx_store);
> +static DEVICE_ATTR_RW(config_read_fw_idx);
>  
>  
>  static ssize_t trigger_request_store(struct device *dev,
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index 337f408b4de6..e372b97eee13 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct
> device *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_driver);
>  }
> -static DEVICE_ATTR(config_test_driver, 0644,
> config_test_driver_show,
> -		   config_test_driver_store);
> +static DEVICE_ATTR_RW(config_test_driver);
>  
>  static ssize_t config_test_fs_store(struct device *dev,
>  				    struct device_attribute *attr,
> @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device
> *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_fs);
>  }
> -static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
> -		   config_test_fs_store);
> +static DEVICE_ATTR_RW(config_test_fs);
>  
>  static int trigger_config_run_type(struct kmod_test_device
> *test_dev,
>  				   enum kmod_test_case test_case,
> @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct
> device *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >num_threads);
>  }
> -static DEVICE_ATTR(config_num_threads, 0644,
> config_num_threads_show,
> -		   config_num_threads_store);
> +static DEVICE_ATTR_RW(config_num_threads);
>  
>  static ssize_t config_test_case_store(struct device *dev,
>  				      struct device_attribute *attr,
> @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct
> device *dev,
>  
>  	return test_dev_config_show_uint(test_dev, buf, config-
> >test_case);
>  }
> -static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
> -		   config_test_case_store);
> +static DEVICE_ATTR_RW(config_test_case);
>  
>  static ssize_t test_result_show(struct device *dev,
>  				struct device_attribute *attr,
> @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device
> *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >test_result);
>  }
> -static DEVICE_ATTR(test_result, 0644, test_result_show,
> test_result_store);
> +static DEVICE_ATTR_RW(test_result);
>  
>  #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.att
> r
>  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device
> *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show,
> dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
>  static const struct attribute *additional_attrs[] = {
>  	&dev_attr_max_tx_thres.attr,
> @@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
> +static DEVICE_ATTR_RW(st_taps);
>  
>  static const struct attribute *sidetone_attrs[] = {
>  	&dev_attr_st_taps.attr,

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-21  0:47     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:47 UTC (permalink / raw)
  To: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: alsa-devel, Liam Girdwood, David Airlie, Heiko Carstens,
	linux-fbdev, dri-devel, Takashi Iwai, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, linux-pm, linux-serial,
	Jiri Slaby, platform-driver-x86, Bartlomiej Zolnierkiewicz,
	intel-gfx, Mark Brown, Jaroslav Kysela, Martin K. Petersen,
	linux-usb, linux-kernel, Martin Schwidefsky

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------
> ------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----

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

thanks,
rui

>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)
> 
> diff --git a/arch/s390/kernel/topology.c
> b/arch/s390/kernel/topology.c
> index 4d5b65e527b5..4b6e0397f66d 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device
> *dev,
>  	put_online_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(dispatching, 0644, dispatching_show,
> -			 dispatching_store);
> +static DEVICE_ATTR_RW(dispatching);
>  
>  static ssize_t cpu_polarization_show(struct device *dev,
>  				     struct device_attribute *attr,
> char *buf)
> diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
> index 825867c53853..af5024f0fb5a 100644
> --- a/arch/tile/kernel/sysfs.c
> +++ b/arch/tile/kernel/sysfs.c
> @@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
>  	return n < 0 ? n : count;
>  }
>  
> -static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
> +static DEVICE_ATTR_RW(hv_stats);
>  
>  static int hv_stats_device_add(struct device *dev, struct
> subsys_interface *sif)
>  {
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index c74a20b80182..1d0ab8ff5915 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct
> device *kdev,
>  
>  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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR,
> gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
> -static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR,
> gt_max_freq_mhz_show, gt_max_freq_mhz_store);
> -static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR,
> gt_min_freq_mhz_show, gt_min_freq_mhz_store);
> +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);
>  
> diff --git a/drivers/platform/x86/compal-laptop.c
> b/drivers/platform/x86/compal-laptop.c
> index 6bcb750e1865..4f9bc72f0584 100644
> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct
> power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -		0644, wake_up_pme_show,		wake_up_pme_s
> tore);
> -static DEVICE_ATTR(wake_up_modem,
> -		0644, wake_up_modem_show,	wake_up_modem_store
> );
> -static DEVICE_ATTR(wake_up_lan,
> -		0644, wake_up_lan_show,	wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -		0644, wake_up_wlan_show,	wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -		0644, wake_up_key_show,	wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -		0644, wake_up_mouse_show,	wake_up_mouse_store
> );
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);
>  
>  static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
>  static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 75a245f38e2e..6eefb67b31f3 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev,
> struct device_attribute *attr,
>  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(online, 0644, online_show, online_store);
> +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);
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 797bb42a6306..95f7ba3c3f1a 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2519,8 +2519,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
> @@ -2583,8 +2582,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
> @@ -3102,8 +3100,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] = {
> @@ -3336,8 +3333,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
> @@ -3386,8 +3382,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
> @@ -3580,8 +3575,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.
> @@ -3695,8 +3689,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
> @@ -3954,8 +3947,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.
> @@ -4194,8 +4186,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)
> @@ -4288,8 +4279,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
> @@ -4436,8 +4426,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
> @@ -4611,8 +4600,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.
> @@ -4772,8 +4760,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.
> @@ -4859,9 +4846,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index fb80c96d8f73..c008af7fb480 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
>   */
>  static DEVICE_ATTR(type, 0444, type_show, NULL);
>  static DEVICE_ATTR(temp, 0444, temp_show, NULL);
> -static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show,
> policy_store);
> +static DEVICE_ATTR_RW(policy);
>  static DEVICE_ATTR(available_policies, S_IRUGO,
> available_policies_show, NULL);
> -static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO,
> sustainable_power_show,
> -		   sustainable_power_store);
> +static DEVICE_ATTR_RW(sustainable_power);
>  
>  /* These thermal zone device attributes are created based on
> conditions */
> -static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
> -static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show,
> passive_store);
> +static DEVICE_ATTR_RW(mode);
> +static DEVICE_ATTR_RW(passive);
>  
>  /* These attributes are unconditionally added to a thermal zone */
>  static struct attribute *thermal_zone_dev_attrs[] = {
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-
> sci.c
> index d9f399c4e90c..7257c078e155 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct
> device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show,
> rx_fifo_timeout_store);
> +static DEVICE_ATTR_RW(rx_fifo_timeout);
>  
>  
>  #ifdef CONFIG_SERIAL_SH_SCI_DMA
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-
> dbgcap.c
> index 452df0f87d6e..a1ab8acf39ba 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
> +static DEVICE_ATTR_RW(dbc);
>  
>  int xhci_dbc_init(struct xhci_hcd *xhci)
>  {
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-
> tahvo.c
> index b3ce42edb373..7f7c5c82420d 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device
> *device,
>  
>  	return r;
>  }
> -static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
> +static DEVICE_ATTR_RW(otg_mode);
>  
>  static struct attribute *tahvo_attributes[] = {
>  	&dev_attr_vbus.attr,
> diff --git a/drivers/video/fbdev/auo_k190x.c
> b/drivers/video/fbdev/auo_k190x.c
> index 0d06038324e0..1e383c547633 100644
> --- a/drivers/video/fbdev/auo_k190x.c
> +++ b/drivers/video/fbdev/auo_k190x.c
> @@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev,
> struct device_attribute *attr,
>  	return sprintf(buf, "%d\n", temp);
>  }
>  
> -static DEVICE_ATTR(update_mode, 0644, update_mode_show,
> update_mode_store);
> -static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
> +static DEVICE_ATTR_RW(update_mode);
> +static DEVICE_ATTR_RW(flash);
>  static DEVICE_ATTR(temp, 0644, temp_show, NULL);
>  
>  static struct attribute *auok190x_attributes[] = {
> diff --git a/drivers/video/fbdev/w100fb.c
> b/drivers/video/fbdev/w100fb.c
> index d570e19a2864..035ff6e02894 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev,
> struct device_attribute *attr, con
>  	return count;
>  }
>  
> -static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
> +static DEVICE_ATTR_RW(flip);
>  
>  static ssize_t w100fb_reg_read(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t count)
>  {
> @@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device
> *dev, struct device_attribute *att
>  	return count;
>  }
>  
> -static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show,
> fastpllclk_store);
> +static DEVICE_ATTR_RW(fastpllclk);
>  
>  /*
>   * Some touchscreens need hsync information from the video driver to
> diff --git a/lib/test_firmware.c b/lib/test_firmware.c
> index 64a4c76cba2b..964784dc1602 100644
> --- a/lib/test_firmware.c
> +++ b/lib/test_firmware.c
> @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device
> *dev,
>  {
>  	return config_test_show_str(buf, test_fw_config->name);
>  }
> -static DEVICE_ATTR(config_name, 0644, config_name_show,
> config_name_store);
> +static DEVICE_ATTR_RW(config_name);
>  
>  static ssize_t config_num_requests_store(struct device *dev,
>  					 struct device_attribute
> *attr,
> @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >num_requests);
>  }
> -static DEVICE_ATTR(config_num_requests, 0644,
> config_num_requests_show,
> -		   config_num_requests_store);
> +static DEVICE_ATTR_RW(config_num_requests);
>  
>  static ssize_t config_sync_direct_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >sync_direct);
>  }
> -static DEVICE_ATTR(config_sync_direct, 0644,
> config_sync_direct_show,
> -		   config_sync_direct_store);
> +static DEVICE_ATTR_RW(config_sync_direct);
>  
>  static ssize_t config_send_uevent_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >send_uevent);
>  }
> -static DEVICE_ATTR(config_send_uevent, 0644,
> config_send_uevent_show,
> -		   config_send_uevent_store);
> +static DEVICE_ATTR_RW(config_send_uevent);
>  
>  static ssize_t config_read_fw_idx_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >read_fw_idx);
>  }
> -static DEVICE_ATTR(config_read_fw_idx, 0644,
> config_read_fw_idx_show,
> -		   config_read_fw_idx_store);
> +static DEVICE_ATTR_RW(config_read_fw_idx);
>  
>  
>  static ssize_t trigger_request_store(struct device *dev,
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index 337f408b4de6..e372b97eee13 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct
> device *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_driver);
>  }
> -static DEVICE_ATTR(config_test_driver, 0644,
> config_test_driver_show,
> -		   config_test_driver_store);
> +static DEVICE_ATTR_RW(config_test_driver);
>  
>  static ssize_t config_test_fs_store(struct device *dev,
>  				    struct device_attribute *attr,
> @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device
> *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_fs);
>  }
> -static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
> -		   config_test_fs_store);
> +static DEVICE_ATTR_RW(config_test_fs);
>  
>  static int trigger_config_run_type(struct kmod_test_device
> *test_dev,
>  				   enum kmod_test_case test_case,
> @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct
> device *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >num_threads);
>  }
> -static DEVICE_ATTR(config_num_threads, 0644,
> config_num_threads_show,
> -		   config_num_threads_store);
> +static DEVICE_ATTR_RW(config_num_threads);
>  
>  static ssize_t config_test_case_store(struct device *dev,
>  				      struct device_attribute *attr,
> @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct
> device *dev,
>  
>  	return test_dev_config_show_uint(test_dev, buf, config-
> >test_case);
>  }
> -static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
> -		   config_test_case_store);
> +static DEVICE_ATTR_RW(config_test_case);
>  
>  static ssize_t test_result_show(struct device *dev,
>  				struct device_attribute *attr,
> @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device
> *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >test_result);
>  }
> -static DEVICE_ATTR(test_result, 0644, test_result_show,
> test_result_store);
> +static DEVICE_ATTR_RW(test_result);
>  
>  #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.att
> r
>  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device
> *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show,
> dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
>  static const struct attribute *additional_attrs[] = {
>  	&dev_attr_max_tx_thres.attr,
> @@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
> +static DEVICE_ATTR_RW(st_taps);
>  
>  static const struct attribute *sidetone_attrs[] = {
>  	&dev_attr_st_taps.attr,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-21  0:47     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang, Rui @ 2017-12-21  0:47 UTC (permalink / raw)
  To: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------
> ------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----

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

thanks,
rui

>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)
> 
> diff --git a/arch/s390/kernel/topology.c
> b/arch/s390/kernel/topology.c
> index 4d5b65e527b5..4b6e0397f66d 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device
> *dev,
>  	put_online_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(dispatching, 0644, dispatching_show,
> -			 dispatching_store);
> +static DEVICE_ATTR_RW(dispatching);
>  
>  static ssize_t cpu_polarization_show(struct device *dev,
>  				     struct device_attribute *attr,
> char *buf)
> diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
> index 825867c53853..af5024f0fb5a 100644
> --- a/arch/tile/kernel/sysfs.c
> +++ b/arch/tile/kernel/sysfs.c
> @@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
>  	return n < 0 ? n : count;
>  }
>  
> -static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
> +static DEVICE_ATTR_RW(hv_stats);
>  
>  static int hv_stats_device_add(struct device *dev, struct
> subsys_interface *sif)
>  {
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index c74a20b80182..1d0ab8ff5915 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct
> device *kdev,
>  
>  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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR,
> gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
> -static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR,
> gt_max_freq_mhz_show, gt_max_freq_mhz_store);
> -static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR,
> gt_min_freq_mhz_show, gt_min_freq_mhz_store);
> +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);
>  
> diff --git a/drivers/platform/x86/compal-laptop.c
> b/drivers/platform/x86/compal-laptop.c
> index 6bcb750e1865..4f9bc72f0584 100644
> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct
> power_supply *psy,
>  /* ============== */
>  /* Driver Globals */
>  /* ============== */
> -static DEVICE_ATTR(wake_up_pme,
> -		0644, wake_up_pme_show,		wake_up_pme_s
> tore);
> -static DEVICE_ATTR(wake_up_modem,
> -		0644, wake_up_modem_show,	wake_up_modem_store
> );
> -static DEVICE_ATTR(wake_up_lan,
> -		0644, wake_up_lan_show,	wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -		0644, wake_up_wlan_show,	wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -		0644, wake_up_key_show,	wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -		0644, wake_up_mouse_show,	wake_up_mouse_store
> );
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);
>  
>  static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
>  static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 75a245f38e2e..6eefb67b31f3 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev,
> struct device_attribute *attr,
>  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(online, 0644, online_show, online_store);
> +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);
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 797bb42a6306..95f7ba3c3f1a 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2519,8 +2519,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
> @@ -2583,8 +2582,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
> @@ -3102,8 +3100,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] = {
> @@ -3336,8 +3333,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
> @@ -3386,8 +3382,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
> @@ -3580,8 +3575,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.
> @@ -3695,8 +3689,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
> @@ -3954,8 +3947,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.
> @@ -4194,8 +4186,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)
> @@ -4288,8 +4279,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
> @@ -4436,8 +4426,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
> @@ -4611,8 +4600,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.
> @@ -4772,8 +4760,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.
> @@ -4859,9 +4846,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index fb80c96d8f73..c008af7fb480 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
>   */
>  static DEVICE_ATTR(type, 0444, type_show, NULL);
>  static DEVICE_ATTR(temp, 0444, temp_show, NULL);
> -static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show,
> policy_store);
> +static DEVICE_ATTR_RW(policy);
>  static DEVICE_ATTR(available_policies, S_IRUGO,
> available_policies_show, NULL);
> -static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO,
> sustainable_power_show,
> -		   sustainable_power_store);
> +static DEVICE_ATTR_RW(sustainable_power);
>  
>  /* These thermal zone device attributes are created based on
> conditions */
> -static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
> -static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show,
> passive_store);
> +static DEVICE_ATTR_RW(mode);
> +static DEVICE_ATTR_RW(passive);
>  
>  /* These attributes are unconditionally added to a thermal zone */
>  static struct attribute *thermal_zone_dev_attrs[] = {
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-
> sci.c
> index d9f399c4e90c..7257c078e155 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct
> device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show,
> rx_fifo_timeout_store);
> +static DEVICE_ATTR_RW(rx_fifo_timeout);
>  
>  
>  #ifdef CONFIG_SERIAL_SH_SCI_DMA
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-
> dbgcap.c
> index 452df0f87d6e..a1ab8acf39ba 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
> +static DEVICE_ATTR_RW(dbc);
>  
>  int xhci_dbc_init(struct xhci_hcd *xhci)
>  {
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-
> tahvo.c
> index b3ce42edb373..7f7c5c82420d 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device
> *device,
>  
>  	return r;
>  }
> -static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
> +static DEVICE_ATTR_RW(otg_mode);
>  
>  static struct attribute *tahvo_attributes[] = {
>  	&dev_attr_vbus.attr,
> diff --git a/drivers/video/fbdev/auo_k190x.c
> b/drivers/video/fbdev/auo_k190x.c
> index 0d06038324e0..1e383c547633 100644
> --- a/drivers/video/fbdev/auo_k190x.c
> +++ b/drivers/video/fbdev/auo_k190x.c
> @@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev,
> struct device_attribute *attr,
>  	return sprintf(buf, "%d\n", temp);
>  }
>  
> -static DEVICE_ATTR(update_mode, 0644, update_mode_show,
> update_mode_store);
> -static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
> +static DEVICE_ATTR_RW(update_mode);
> +static DEVICE_ATTR_RW(flash);
>  static DEVICE_ATTR(temp, 0644, temp_show, NULL);
>  
>  static struct attribute *auok190x_attributes[] = {
> diff --git a/drivers/video/fbdev/w100fb.c
> b/drivers/video/fbdev/w100fb.c
> index d570e19a2864..035ff6e02894 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev,
> struct device_attribute *attr, con
>  	return count;
>  }
>  
> -static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
> +static DEVICE_ATTR_RW(flip);
>  
>  static ssize_t w100fb_reg_read(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t count)
>  {
> @@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device
> *dev, struct device_attribute *att
>  	return count;
>  }
>  
> -static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show,
> fastpllclk_store);
> +static DEVICE_ATTR_RW(fastpllclk);
>  
>  /*
>   * Some touchscreens need hsync information from the video driver to
> diff --git a/lib/test_firmware.c b/lib/test_firmware.c
> index 64a4c76cba2b..964784dc1602 100644
> --- a/lib/test_firmware.c
> +++ b/lib/test_firmware.c
> @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device
> *dev,
>  {
>  	return config_test_show_str(buf, test_fw_config->name);
>  }
> -static DEVICE_ATTR(config_name, 0644, config_name_show,
> config_name_store);
> +static DEVICE_ATTR_RW(config_name);
>  
>  static ssize_t config_num_requests_store(struct device *dev,
>  					 struct device_attribute
> *attr,
> @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >num_requests);
>  }
> -static DEVICE_ATTR(config_num_requests, 0644,
> config_num_requests_show,
> -		   config_num_requests_store);
> +static DEVICE_ATTR_RW(config_num_requests);
>  
>  static ssize_t config_sync_direct_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >sync_direct);
>  }
> -static DEVICE_ATTR(config_sync_direct, 0644,
> config_sync_direct_show,
> -		   config_sync_direct_store);
> +static DEVICE_ATTR_RW(config_sync_direct);
>  
>  static ssize_t config_send_uevent_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >send_uevent);
>  }
> -static DEVICE_ATTR(config_send_uevent, 0644,
> config_send_uevent_show,
> -		   config_send_uevent_store);
> +static DEVICE_ATTR_RW(config_send_uevent);
>  
>  static ssize_t config_read_fw_idx_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >read_fw_idx);
>  }
> -static DEVICE_ATTR(config_read_fw_idx, 0644,
> config_read_fw_idx_show,
> -		   config_read_fw_idx_store);
> +static DEVICE_ATTR_RW(config_read_fw_idx);
>  
>  
>  static ssize_t trigger_request_store(struct device *dev,
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index 337f408b4de6..e372b97eee13 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct
> device *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_driver);
>  }
> -static DEVICE_ATTR(config_test_driver, 0644,
> config_test_driver_show,
> -		   config_test_driver_store);
> +static DEVICE_ATTR_RW(config_test_driver);
>  
>  static ssize_t config_test_fs_store(struct device *dev,
>  				    struct device_attribute *attr,
> @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device
> *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_fs);
>  }
> -static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
> -		   config_test_fs_store);
> +static DEVICE_ATTR_RW(config_test_fs);
>  
>  static int trigger_config_run_type(struct kmod_test_device
> *test_dev,
>  				   enum kmod_test_case test_case,
> @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct
> device *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >num_threads);
>  }
> -static DEVICE_ATTR(config_num_threads, 0644,
> config_num_threads_show,
> -		   config_num_threads_store);
> +static DEVICE_ATTR_RW(config_num_threads);
>  
>  static ssize_t config_test_case_store(struct device *dev,
>  				      struct device_attribute *attr,
> @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct
> device *dev,
>  
>  	return test_dev_config_show_uint(test_dev, buf, config-
> >test_case);
>  }
> -static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
> -		   config_test_case_store);
> +static DEVICE_ATTR_RW(config_test_case);
>  
>  static ssize_t test_result_show(struct device *dev,
>  				struct device_attribute *attr,
> @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device
> *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >test_result);
>  }
> -static DEVICE_ATTR(test_result, 0644, test_result_show,
> test_result_store);
> +static DEVICE_ATTR_RW(test_result);
>  
>  #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.att
> r
>  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device
> *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show,
> dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
>  static const struct attribute *additional_attrs[] = {
>  	&dev_attr_max_tx_thres.attr,
> @@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
> +static DEVICE_ATTR_RW(st_taps);
>  
>  static const struct attribute *sidetone_attrs[] = {
>  	&dev_attr_st_taps.attr,
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2017-12-21  0:47     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:47 UTC (permalink / raw)
  To: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula
  Cc: alsa-devel, Liam Girdwood, David Airlie, Heiko Carstens,
	linux-fbdev, dri-devel, Takashi Iwai, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, linux-pm, linux-serial,
	Jiri Slaby, platform-driver-x86, Bartlomiej Zolnierkiewicz,
	intel-gfx, Mark Brown, Jaroslav Kysela, Martin K. Petersen,
	linux-usb, linux-kernel, Martin Schwidefsky

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------
> ------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----

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

thanks,
rui

>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)
> 
> diff --git a/arch/s390/kernel/topology.c
> b/arch/s390/kernel/topology.c
> index 4d5b65e527b5..4b6e0397f66d 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -404,8 +404,7 @@ static ssize_t dispatching_store(struct device
> *dev,
>  	put_online_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(dispatching, 0644, dispatching_show,
> -			 dispatching_store);
> +static DEVICE_ATTR_RW(dispatching);
>  
>  static ssize_t cpu_polarization_show(struct device *dev,
>  				     struct device_attribute *attr,
> char *buf)
> diff --git a/arch/tile/kernel/sysfs.c b/arch/tile/kernel/sysfs.c
> index 825867c53853..af5024f0fb5a 100644
> --- a/arch/tile/kernel/sysfs.c
> +++ b/arch/tile/kernel/sysfs.c
> @@ -184,7 +184,7 @@ static ssize_t hv_stats_store(struct device *dev,
>  	return n < 0 ? n : count;
>  }
>  
> -static DEVICE_ATTR(hv_stats, 0644, hv_stats_show, hv_stats_store);
> +static DEVICE_ATTR_RW(hv_stats);
>  
>  static int hv_stats_device_add(struct device *dev, struct
> subsys_interface *sif)
>  {
> diff --git a/drivers/gpu/drm/i915/i915_sysfs.c
> b/drivers/gpu/drm/i915/i915_sysfs.c
> index c74a20b80182..1d0ab8ff5915 100644
> --- a/drivers/gpu/drm/i915/i915_sysfs.c
> +++ b/drivers/gpu/drm/i915/i915_sysfs.c
> @@ -447,9 +447,9 @@ static ssize_t gt_min_freq_mhz_store(struct
> device *kdev,
>  
>  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(gt_boost_freq_mhz, S_IRUGO | S_IWUSR,
> gt_boost_freq_mhz_show, gt_boost_freq_mhz_store);
> -static DEVICE_ATTR(gt_max_freq_mhz, S_IRUGO | S_IWUSR,
> gt_max_freq_mhz_show, gt_max_freq_mhz_store);
> -static DEVICE_ATTR(gt_min_freq_mhz, S_IRUGO | S_IWUSR,
> gt_min_freq_mhz_show, gt_min_freq_mhz_store);
> +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);
>  
> diff --git a/drivers/platform/x86/compal-laptop.c
> b/drivers/platform/x86/compal-laptop.c
> index 6bcb750e1865..4f9bc72f0584 100644
> --- a/drivers/platform/x86/compal-laptop.c
> +++ b/drivers/platform/x86/compal-laptop.c
> @@ -679,18 +679,12 @@ static int bat_writeable_property(struct
> power_supply *psy,
>  /* ======= */
>  /* Driver Globals */
>  /* ======= */
> -static DEVICE_ATTR(wake_up_pme,
> -		0644, wake_up_pme_show,		wake_up_pme_s
> tore);
> -static DEVICE_ATTR(wake_up_modem,
> -		0644, wake_up_modem_show,	wake_up_modem_store
> );
> -static DEVICE_ATTR(wake_up_lan,
> -		0644, wake_up_lan_show,	wake_up_lan_store);
> -static DEVICE_ATTR(wake_up_wlan,
> -		0644, wake_up_wlan_show,	wake_up_wlan_store);
> -static DEVICE_ATTR(wake_up_key,
> -		0644, wake_up_key_show,	wake_up_key_store);
> -static DEVICE_ATTR(wake_up_mouse,
> -		0644, wake_up_mouse_show,	wake_up_mouse_store
> );
> +static DEVICE_ATTR_RW(wake_up_pme);
> +static DEVICE_ATTR_RW(wake_up_modem);
> +static DEVICE_ATTR_RW(wake_up_lan);
> +static DEVICE_ATTR_RW(wake_up_wlan);
> +static DEVICE_ATTR_RW(wake_up_key);
> +static DEVICE_ATTR_RW(wake_up_mouse);
>  
>  static DEVICE_ATTR(fan1_input,  S_IRUGO, fan_show,          NULL);
>  static DEVICE_ATTR(temp1_input, S_IRUGO, temp_cpu,          NULL);
> diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c
> index 75a245f38e2e..6eefb67b31f3 100644
> --- a/drivers/s390/cio/device.c
> +++ b/drivers/s390/cio/device.c
> @@ -600,7 +600,7 @@ static ssize_t vpm_show(struct device *dev,
> struct device_attribute *attr,
>  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(online, 0644, online_show, online_store);
> +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);
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 797bb42a6306..95f7ba3c3f1a 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2519,8 +2519,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
> @@ -2583,8 +2582,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
> @@ -3102,8 +3100,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] = {
> @@ -3336,8 +3333,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
> @@ -3386,8 +3382,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
> @@ -3580,8 +3575,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.
> @@ -3695,8 +3689,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
> @@ -3954,8 +3947,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.
> @@ -4194,8 +4186,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)
> @@ -4288,8 +4279,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
> @@ -4436,8 +4426,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
> @@ -4611,8 +4600,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.
> @@ -4772,8 +4760,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.
> @@ -4859,9 +4846,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index fb80c96d8f73..c008af7fb480 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -398,14 +398,13 @@ create_s32_tzp_attr(offset);
>   */
>  static DEVICE_ATTR(type, 0444, type_show, NULL);
>  static DEVICE_ATTR(temp, 0444, temp_show, NULL);
> -static DEVICE_ATTR(policy, S_IRUGO | S_IWUSR, policy_show,
> policy_store);
> +static DEVICE_ATTR_RW(policy);
>  static DEVICE_ATTR(available_policies, S_IRUGO,
> available_policies_show, NULL);
> -static DEVICE_ATTR(sustainable_power, S_IWUSR | S_IRUGO,
> sustainable_power_show,
> -		   sustainable_power_store);
> +static DEVICE_ATTR_RW(sustainable_power);
>  
>  /* These thermal zone device attributes are created based on
> conditions */
> -static DEVICE_ATTR(mode, 0644, mode_show, mode_store);
> -static DEVICE_ATTR(passive, S_IRUGO | S_IWUSR, passive_show,
> passive_store);
> +static DEVICE_ATTR_RW(mode);
> +static DEVICE_ATTR_RW(passive);
>  
>  /* These attributes are unconditionally added to a thermal zone */
>  static struct attribute *thermal_zone_dev_attrs[] = {
> diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-
> sci.c
> index d9f399c4e90c..7257c078e155 100644
> --- a/drivers/tty/serial/sh-sci.c
> +++ b/drivers/tty/serial/sh-sci.c
> @@ -1144,7 +1144,7 @@ static ssize_t rx_fifo_timeout_store(struct
> device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(rx_fifo_timeout, 0644, rx_fifo_timeout_show,
> rx_fifo_timeout_store);
> +static DEVICE_ATTR_RW(rx_fifo_timeout);
>  
>  
>  #ifdef CONFIG_SERIAL_SH_SCI_DMA
> diff --git a/drivers/usb/host/xhci-dbgcap.c b/drivers/usb/host/xhci-
> dbgcap.c
> index 452df0f87d6e..a1ab8acf39ba 100644
> --- a/drivers/usb/host/xhci-dbgcap.c
> +++ b/drivers/usb/host/xhci-dbgcap.c
> @@ -920,7 +920,7 @@ static ssize_t dbc_store(struct device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(dbc, 0644, dbc_show, dbc_store);
> +static DEVICE_ATTR_RW(dbc);
>  
>  int xhci_dbc_init(struct xhci_hcd *xhci)
>  {
> diff --git a/drivers/usb/phy/phy-tahvo.c b/drivers/usb/phy/phy-
> tahvo.c
> index b3ce42edb373..7f7c5c82420d 100644
> --- a/drivers/usb/phy/phy-tahvo.c
> +++ b/drivers/usb/phy/phy-tahvo.c
> @@ -310,7 +310,7 @@ static ssize_t otg_mode_store(struct device
> *device,
>  
>  	return r;
>  }
> -static DEVICE_ATTR(otg_mode, 0644, otg_mode_show, otg_mode_store);
> +static DEVICE_ATTR_RW(otg_mode);
>  
>  static struct attribute *tahvo_attributes[] = {
>  	&dev_attr_vbus.attr,
> diff --git a/drivers/video/fbdev/auo_k190x.c
> b/drivers/video/fbdev/auo_k190x.c
> index 0d06038324e0..1e383c547633 100644
> --- a/drivers/video/fbdev/auo_k190x.c
> +++ b/drivers/video/fbdev/auo_k190x.c
> @@ -708,8 +708,8 @@ static ssize_t temp_show(struct device *dev,
> struct device_attribute *attr,
>  	return sprintf(buf, "%d\n", temp);
>  }
>  
> -static DEVICE_ATTR(update_mode, 0644, update_mode_show,
> update_mode_store);
> -static DEVICE_ATTR(flash, 0644, flash_show, flash_store);
> +static DEVICE_ATTR_RW(update_mode);
> +static DEVICE_ATTR_RW(flash);
>  static DEVICE_ATTR(temp, 0644, temp_show, NULL);
>  
>  static struct attribute *auok190x_attributes[] = {
> diff --git a/drivers/video/fbdev/w100fb.c
> b/drivers/video/fbdev/w100fb.c
> index d570e19a2864..035ff6e02894 100644
> --- a/drivers/video/fbdev/w100fb.c
> +++ b/drivers/video/fbdev/w100fb.c
> @@ -110,7 +110,7 @@ static ssize_t flip_store(struct device *dev,
> struct device_attribute *attr, con
>  	return count;
>  }
>  
> -static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
> +static DEVICE_ATTR_RW(flip);
>  
>  static ssize_t w100fb_reg_read(struct device *dev, struct
> device_attribute *attr, const char *buf, size_t count)
>  {
> @@ -166,7 +166,7 @@ static ssize_t fastpllclk_store(struct device
> *dev, struct device_attribute *att
>  	return count;
>  }
>  
> -static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show,
> fastpllclk_store);
> +static DEVICE_ATTR_RW(fastpllclk);
>  
>  /*
>   * Some touchscreens need hsync information from the video driver to
> diff --git a/lib/test_firmware.c b/lib/test_firmware.c
> index 64a4c76cba2b..964784dc1602 100644
> --- a/lib/test_firmware.c
> +++ b/lib/test_firmware.c
> @@ -359,7 +359,7 @@ static ssize_t config_name_show(struct device
> *dev,
>  {
>  	return config_test_show_str(buf, test_fw_config->name);
>  }
> -static DEVICE_ATTR(config_name, 0644, config_name_show,
> config_name_store);
> +static DEVICE_ATTR_RW(config_name);
>  
>  static ssize_t config_num_requests_store(struct device *dev,
>  					 struct device_attribute
> *attr,
> @@ -388,8 +388,7 @@ static ssize_t config_num_requests_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >num_requests);
>  }
> -static DEVICE_ATTR(config_num_requests, 0644,
> config_num_requests_show,
> -		   config_num_requests_store);
> +static DEVICE_ATTR_RW(config_num_requests);
>  
>  static ssize_t config_sync_direct_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -411,8 +410,7 @@ static ssize_t config_sync_direct_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >sync_direct);
>  }
> -static DEVICE_ATTR(config_sync_direct, 0644,
> config_sync_direct_show,
> -		   config_sync_direct_store);
> +static DEVICE_ATTR_RW(config_sync_direct);
>  
>  static ssize_t config_send_uevent_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -428,8 +426,7 @@ static ssize_t config_send_uevent_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_bool(buf, test_fw_config-
> >send_uevent);
>  }
> -static DEVICE_ATTR(config_send_uevent, 0644,
> config_send_uevent_show,
> -		   config_send_uevent_store);
> +static DEVICE_ATTR_RW(config_send_uevent);
>  
>  static ssize_t config_read_fw_idx_store(struct device *dev,
>  					struct device_attribute
> *attr,
> @@ -445,8 +442,7 @@ static ssize_t config_read_fw_idx_show(struct
> device *dev,
>  {
>  	return test_dev_config_show_u8(buf, test_fw_config-
> >read_fw_idx);
>  }
> -static DEVICE_ATTR(config_read_fw_idx, 0644,
> config_read_fw_idx_show,
> -		   config_read_fw_idx_store);
> +static DEVICE_ATTR_RW(config_read_fw_idx);
>  
>  
>  static ssize_t trigger_request_store(struct device *dev,
> diff --git a/lib/test_kmod.c b/lib/test_kmod.c
> index 337f408b4de6..e372b97eee13 100644
> --- a/lib/test_kmod.c
> +++ b/lib/test_kmod.c
> @@ -694,8 +694,7 @@ static ssize_t config_test_driver_show(struct
> device *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_driver);
>  }
> -static DEVICE_ATTR(config_test_driver, 0644,
> config_test_driver_show,
> -		   config_test_driver_store);
> +static DEVICE_ATTR_RW(config_test_driver);
>  
>  static ssize_t config_test_fs_store(struct device *dev,
>  				    struct device_attribute *attr,
> @@ -726,8 +725,7 @@ static ssize_t config_test_fs_show(struct device
> *dev,
>  	return config_test_show_str(&test_dev->config_mutex, buf,
>  				    config->test_fs);
>  }
> -static DEVICE_ATTR(config_test_fs, 0644, config_test_fs_show,
> -		   config_test_fs_store);
> +static DEVICE_ATTR_RW(config_test_fs);
>  
>  static int trigger_config_run_type(struct kmod_test_device
> *test_dev,
>  				   enum kmod_test_case test_case,
> @@ -1012,8 +1010,7 @@ static ssize_t config_num_threads_show(struct
> device *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >num_threads);
>  }
> -static DEVICE_ATTR(config_num_threads, 0644,
> config_num_threads_show,
> -		   config_num_threads_store);
> +static DEVICE_ATTR_RW(config_num_threads);
>  
>  static ssize_t config_test_case_store(struct device *dev,
>  				      struct device_attribute *attr,
> @@ -1037,8 +1034,7 @@ static ssize_t config_test_case_show(struct
> device *dev,
>  
>  	return test_dev_config_show_uint(test_dev, buf, config-
> >test_case);
>  }
> -static DEVICE_ATTR(config_test_case, 0644, config_test_case_show,
> -		   config_test_case_store);
> +static DEVICE_ATTR_RW(config_test_case);
>  
>  static ssize_t test_result_show(struct device *dev,
>  				struct device_attribute *attr,
> @@ -1049,7 +1045,7 @@ static ssize_t test_result_show(struct device
> *dev,
>  
>  	return test_dev_config_show_int(test_dev, buf, config-
> >test_result);
>  }
> -static DEVICE_ATTR(test_result, 0644, test_result_show,
> test_result_store);
> +static DEVICE_ATTR_RW(test_result);
>  
>  #define TEST_KMOD_DEV_ATTR(name)		&dev_attr_##name.att
> r
>  
> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
> index 7a54e3083203..79d4dc785e5c 100644
> --- a/sound/soc/omap/mcbsp.c
> +++ b/sound/soc/omap/mcbsp.c
> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device
> *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show,
> dma_op_mode_store);
> +static DEVICE_ATTR_RW(dma_op_mode);
>  
>  static const struct attribute *additional_attrs[] = {
>  	&dev_attr_max_tx_thres.attr,
> @@ -923,7 +923,7 @@ static ssize_t st_taps_store(struct device *dev,
>  	return size;
>  }
>  
> -static DEVICE_ATTR(st_taps, 0644, st_taps_show, st_taps_store);
> +static DEVICE_ATTR_RW(st_taps);
>  
>  static const struct attribute *sidetone_attrs[] = {
>  	&dev_attr_st_taps.attr,

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-19 18:15   ` Joe Perches
  (?)
@ 2017-12-21  0:48     ` Zhang Rui
  -1 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:48 UTC (permalink / raw)
  To: Joe Perches, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Rafael J. Wysocki, Len Brown, Corey Minyard, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Sebastian Ott,
	Peter Oberparleiter, Harald Freudenberger, Don Brace,
	James E.J. Bottomley, Martin K. Petersen, James Smart,
	Dick Kennedy, Eduardo
  Cc: alsa-devel, Rich Felker, linux-sh, David Airlie, Heiko Carstens,
	dri-devel, Takashi Iwai, devel, linux-s390,
	Mauro Carvalho Chehab, Yoshinori Sato, esc.storagedev,
	Russell King, linux-acpi, linux-media, Arnd Bergmann, linux-pm,
	intel-gfx, linux-nvme, openipmi-developer, Jaroslav Kysela,
	linux-arm-kernel, Alan Cox, linux-scsi, Greg Kroah-Hartman,
	linux-kernel, Sakari

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@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 +++---

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

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,

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
@ 2017-12-21  0:48     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:48 UTC (permalink / raw)
  To: Joe Perches, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Rafael J. Wysocki, Len Brown, Corey Minyard, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Sebastian Ott,
	Peter Oberparleiter, Harald Freudenberger, Don Brace,
	James E.J. Bottomley, Martin K. Petersen, James Smart,
	Dick Kennedy, Eduardo
  Cc: alsa-devel, Rich Felker, linux-sh, David Airlie, Heiko Carstens,
	dri-devel, Takashi Iwai, devel, linux-s390,
	Mauro Carvalho Chehab, Yoshinori Sato, esc.storagedev,
	Russell King, linux-acpi, linux-media, Arnd Bergmann, linux-pm,
	intel-gfx, linux-nvme, openipmi-developer, Jaroslav Kysela,
	linux-arm-kernel, Alan Cox, linux-scsi, Greg Kroah-Hartman,
	linux-kernel, Sakari

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@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 +++---

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

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,
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
@ 2017-12-21  0:48     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:48 UTC (permalink / raw)
  To: Joe Perches, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Rafael J. Wysocki, Len Brown, Corey Minyard, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Sebastian Ott,
	Peter Oberparleiter, Harald Freudenberger, Don Brace,
	James E.J. Bottomley, Martin K. Petersen, James Smart,
	Dick Kennedy, Eduardo Valentin, Liam Girdwood, Mark Brown
  Cc: Russell King, Yoshinori Sato, Rich Felker, Arnd Bergmann,
	Greg Kroah-Hartman, David Airlie, Martin Schwidefsky,
	Heiko Carstens, Alan Cox, Sakari Ailus, Mauro Carvalho Chehab,
	Jaroslav Kysela, Takashi Iwai, linux-arm-kernel, linux-kernel,
	linux-sh, linux-acpi, openipmi-developer, intel-gfx, dri-devel,
	linux-nvme, linux-s390, esc.storagedev, linux-scsi, linux-media,
	devel, linux-pm, alsa-devel

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@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 +++---

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

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,

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
  2017-12-19 18:15 ` [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO Joe Perches
@ 2017-12-21  0:50     ` Zhang Rui
  2017-12-21  0:50     ` Zhang Rui
  1 sibling, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:50 UTC (permalink / raw)
  To: Joe Perches, Borislav Petkov, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Thomas Falcon, John Allen,
	Inaky Perez-Gonzalez, linux-wimax, James Smart, Dick Kennedy,
	Eduardo Valentin
  Cc: Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/smp.c                 | 2 +-
>  arch/x86/kernel/cpu/microcode/core.c   | 2 +-
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
>  drivers/net/wimax/i2400m/sysfs.c       | 3 +--
>  drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
>  drivers/thermal/thermal_sysfs.c        | 2 +-

For the thermal part,
Acked-by: Zhang Rui <rui.zhang@intel.com>

thanks,
rui

>  7 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index b8c1a85bcf2d..a919b2f0141d 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device
> *dev,
>  	rc = smp_rescan_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
> +static DEVICE_ATTR_WO(rescan);
>  #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static int __init s390_smp_init(void)
> diff --git a/arch/x86/kernel/cpu/microcode/core.c
> b/arch/x86/kernel/cpu/microcode/core.c
> index c4fa4a85d4cb..09c74b0560dd 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
>  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
>  }
>  
> -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> +static DEVICE_ATTR_WO(reload);
>  static DEVICE_ATTR(version, 0400, version_show, NULL);
>  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
>  
> diff --git a/drivers/input/touchscreen/elants_i2c.c
> b/drivers/input/touchscreen/elants_i2c.c
> index a458e5ec9e41..819213e88f32 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1000,7 +1000,7 @@ static ssize_t show_iap_mode(struct device
> *dev,
>  				"Normal" : "Recovery");
>  }
>  
> -static DEVICE_ATTR(calibrate, S_IWUSR, NULL, calibrate_store);
> +static DEVICE_ATTR_WO(calibrate);
>  static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
>  static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw);
>  
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 1dc4aef37d3a..42b96e1a1b13 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -4411,7 +4411,7 @@ static ssize_t failover_store(struct device
> *dev, struct device_attribute *attr,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(failover, 0200, NULL, failover_store);
> +static DEVICE_ATTR_WO(failover);
>  
>  static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev)
>  {
> diff --git a/drivers/net/wimax/i2400m/sysfs.c
> b/drivers/net/wimax/i2400m/sysfs.c
> index 1237109f251a..8c67df11105c 100644
> --- a/drivers/net/wimax/i2400m/sysfs.c
> +++ b/drivers/net/wimax/i2400m/sysfs.c
> @@ -65,8 +65,7 @@ ssize_t i2400m_idle_timeout_store(struct device
> *dev,
>  }
>  
>  static
> -DEVICE_ATTR(i2400m_idle_timeout, S_IWUSR,
> -	    NULL, i2400m_idle_timeout_store);
> +DEVICE_ATTR_WO(i2400m_idle_timeout);
>  
>  static
>  struct attribute *i2400m_dev_attrs[] = {
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 517ff203cfde..6ddaf51a23f6 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2418,8 +2418,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index 2bc964392924..ba81c9080f6e 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -317,7 +317,7 @@ emul_temp_store(struct device *dev, struct
> device_attribute *attr,
>  
>  	return ret ? ret : count;
>  }
> -static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store);
> +static DEVICE_ATTR_WO(emul_temp);
>  #endif
>  
>  static ssize_t

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO
@ 2017-12-21  0:50     ` Zhang Rui
  0 siblings, 0 replies; 99+ messages in thread
From: Zhang Rui @ 2017-12-21  0:50 UTC (permalink / raw)
  To: Joe Perches, Borislav Petkov, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Thomas Falcon, John Allen,
	Inaky Perez-Gonzalez, linux-wimax, James Smart, Dick Kennedy,
	Eduardo Valentin
  Cc: Martin Schwidefsky, Heiko Carstens, Thomas Gleixner,
	H. Peter Anvin, x86, Dmitry Torokhov, James E.J. Bottomley,
	Martin K. Petersen, linux-s390, linux-kernel, linux-input,
	netdev, linuxppc-dev, linux-scsi, linux-pm

On Tue, 2017-12-19 at 10:15 -0800, Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/smp.c                 | 2 +-
>  arch/x86/kernel/cpu/microcode/core.c   | 2 +-
>  drivers/input/touchscreen/elants_i2c.c | 2 +-
>  drivers/net/ethernet/ibm/ibmvnic.c     | 2 +-
>  drivers/net/wimax/i2400m/sysfs.c       | 3 +--
>  drivers/scsi/lpfc/lpfc_attr.c          | 3 +--
>  drivers/thermal/thermal_sysfs.c        | 2 +-

For the thermal part,
Acked-by: Zhang Rui <rui.zhang@intel.com>

thanks,
rui

>  7 files changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index b8c1a85bcf2d..a919b2f0141d 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -1151,7 +1151,7 @@ static ssize_t __ref rescan_store(struct device
> *dev,
>  	rc = smp_rescan_cpus();
>  	return rc ? rc : count;
>  }
> -static DEVICE_ATTR(rescan, 0200, NULL, rescan_store);
> +static DEVICE_ATTR_WO(rescan);
>  #endif /* CONFIG_HOTPLUG_CPU */
>  
>  static int __init s390_smp_init(void)
> diff --git a/arch/x86/kernel/cpu/microcode/core.c
> b/arch/x86/kernel/cpu/microcode/core.c
> index c4fa4a85d4cb..09c74b0560dd 100644
> --- a/arch/x86/kernel/cpu/microcode/core.c
> +++ b/arch/x86/kernel/cpu/microcode/core.c
> @@ -560,7 +560,7 @@ static ssize_t pf_show(struct device *dev,
>  	return sprintf(buf, "0x%x\n", uci->cpu_sig.pf);
>  }
>  
> -static DEVICE_ATTR(reload, 0200, NULL, reload_store);
> +static DEVICE_ATTR_WO(reload);
>  static DEVICE_ATTR(version, 0400, version_show, NULL);
>  static DEVICE_ATTR(processor_flags, 0400, pf_show, NULL);
>  
> diff --git a/drivers/input/touchscreen/elants_i2c.c
> b/drivers/input/touchscreen/elants_i2c.c
> index a458e5ec9e41..819213e88f32 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1000,7 +1000,7 @@ static ssize_t show_iap_mode(struct device
> *dev,
>  				"Normal" : "Recovery");
>  }
>  
> -static DEVICE_ATTR(calibrate, S_IWUSR, NULL, calibrate_store);
> +static DEVICE_ATTR_WO(calibrate);
>  static DEVICE_ATTR(iap_mode, S_IRUGO, show_iap_mode, NULL);
>  static DEVICE_ATTR(update_fw, S_IWUSR, NULL, write_update_fw);
>  
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 1dc4aef37d3a..42b96e1a1b13 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -4411,7 +4411,7 @@ static ssize_t failover_store(struct device
> *dev, struct device_attribute *attr,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(failover, 0200, NULL, failover_store);
> +static DEVICE_ATTR_WO(failover);
>  
>  static unsigned long ibmvnic_get_desired_dma(struct vio_dev *vdev)
>  {
> diff --git a/drivers/net/wimax/i2400m/sysfs.c
> b/drivers/net/wimax/i2400m/sysfs.c
> index 1237109f251a..8c67df11105c 100644
> --- a/drivers/net/wimax/i2400m/sysfs.c
> +++ b/drivers/net/wimax/i2400m/sysfs.c
> @@ -65,8 +65,7 @@ ssize_t i2400m_idle_timeout_store(struct device
> *dev,
>  }
>  
>  static
> -DEVICE_ATTR(i2400m_idle_timeout, S_IWUSR,
> -	    NULL, i2400m_idle_timeout_store);
> +DEVICE_ATTR_WO(i2400m_idle_timeout);
>  
>  static
>  struct attribute *i2400m_dev_attrs[] = {
> diff --git a/drivers/scsi/lpfc/lpfc_attr.c
> b/drivers/scsi/lpfc/lpfc_attr.c
> index 517ff203cfde..6ddaf51a23f6 100644
> --- a/drivers/scsi/lpfc/lpfc_attr.c
> +++ b/drivers/scsi/lpfc/lpfc_attr.c
> @@ -2418,8 +2418,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
> diff --git a/drivers/thermal/thermal_sysfs.c
> b/drivers/thermal/thermal_sysfs.c
> index 2bc964392924..ba81c9080f6e 100644
> --- a/drivers/thermal/thermal_sysfs.c
> +++ b/drivers/thermal/thermal_sysfs.c
> @@ -317,7 +317,7 @@ emul_temp_store(struct device *dev, struct
> device_attribute *attr,
>  
>  	return ret ? ret : count;
>  }
> -static DEVICE_ATTR(emul_temp, S_IWUSR, NULL, emul_temp_store);
> +static DEVICE_ATTR_WO(emul_temp);
>  #endif
>  
>  static ssize_t

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-19 18:15   ` Joe Perches
                     ` (3 preceding siblings ...)
  (?)
@ 2017-12-21  7:55   ` Harald Freudenberger
  -1 siblings, 0 replies; 99+ messages in thread
From: Harald Freudenberger @ 2017-12-21  7:55 UTC (permalink / raw)
  To: Joe Perches, Daniel Mack, Haojian Zhuang, Robert Jarzmik,
	Rafael J. Wysocki, Len Brown, Corey Minyard, Jani Nikula,
	Joonas Lahtinen, Rodrigo Vivi, Keith Busch, Jens Axboe,
	Christoph Hellwig, Sagi Grimberg, Sebastian Ott,
	Peter Oberparleiter, Harald Freudenberger, Don Brace,
	James E.J. Bottomley, Martin K. Petersen, James Smart,
	Dick Kennedy
  Cc: alsa-devel, Rich Felker, linux-sh, David Airlie, Heiko Carstens,
	dri-devel, Takashi Iwai, devel, linux-s390,
	Mauro Carvalho Chehab, Yoshinori Sato, esc.storagedev,
	Russell King, linux-acpi, linux-media, Arnd Bergmann, linux-pm,
	intel-gfx, linux-nvme, openipmi-developer, Jaroslav Kysela,
	linux-arm-kernel, Alan Cox, linux-scsi, Greg Kroah-Hartman,
	linux-kernel, Sakari


[-- Attachment #1.1: Type: text/plain, Size: 20837 bytes --]

On 12/19/2017 07:15 PM, 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 +-

For the s390 AP part,

ACK-by: Harald Freudenberger <freude@linux.vnet.ibm.com> Thanks

>  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,
> 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,


[-- Attachment #1.2: Type: text/html, Size: 20829 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-19 18:15   ` Joe Perches
                     ` (4 preceding siblings ...)
  (?)
@ 2017-12-21  9:34   ` Sakari Ailus
  2018-01-09 15:34       ` Greg Kroah-Hartman
  -1 siblings, 1 reply; 99+ messages in thread
From: Sakari Ailus @ 2017-12-21  9:34 UTC (permalink / raw)
  To: Joe Perches
  Cc: Don Brace, linux-nvme, Rich Felker, linux-sh, David Airlie,
	esc.storagedev, Heiko Carstens, alsa-devel, dri-devel,
	Russell King, Keith Busch, Robert Jarzmik, Christoph Hellwig,
	devel, linux-s390, James E.J. Bottomley, Sagi Grimberg,
	Yoshinori Sato, Takashi Iwai, Sebastian Ott, James Smart,
	linux-acpi, Zhang Rui, Len Brown, Dick Kennedy, Corey

Hi Joe,

On Tue, Dec 19, 2017 at 10:15:08AM -0800, Joe Perches wrote:
> 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,

I have the exact same changes queued up in my tree. As there seem to be no
dependencies to other patches in your set, how about dropping this chunk?

Thanks.

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-19 18:15   ` [-next PATCH 2/4] " Joe Perches
  (?)
  (?)
@ 2018-01-03 15:16     ` Bartlomiej Zolnierkiewicz
  -1 siblings, 0 replies; 99+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-01-03 15:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tuesday, December 19, 2017 10:15:07 AM Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----
>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)

For fbdev changes:

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-03 15:16     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 99+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-01-03 15:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman, linux-pm,
	Peter Oberparleiter, intel-gfx, Eduardo Valentin

On Tuesday, December 19, 2017 10:15:07 AM Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----
>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)

For fbdev changes:

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-03 15:16     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 99+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-01-03 15:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Cezary Jackiewicz,
	Darren Hart, Andy Shevchenko, Sebastian Ott, Peter Oberparleiter,
	James Smart, Dick Kennedy, Zhang Rui, Eduardo Valentin,
	Greg Kroah-Hartman, Mathias Nyman, Felipe Balbi,
	Luis R. Rodriguez, Peter Ujfalusi, Jarkko Nikula,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Liam Girdwood, Mark Brown, Jaroslav Kysela, Takashi Iwai,
	linux-s390, linux-kernel, intel-gfx, dri-devel,
	platform-driver-x86, linux-scsi, linux-pm, linux-serial,
	linux-usb, linux-fbdev, alsa-devel, linux-omap

On Tuesday, December 19, 2017 10:15:07 AM Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----
>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)

For fbdev changes:

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
---
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-03 15:16     ` Bartlomiej Zolnierkiewicz
  0 siblings, 0 replies; 99+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2018-01-03 15:16 UTC (permalink / raw)
  To: Joe Perches
  Cc: linux-fbdev, David Airlie, Heiko Carstens, alsa-devel, dri-devel,
	Jaroslav Kysela, Peter Ujfalusi, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman, linux-pm,
	Peter Oberparleiter, intel-gfx, Eduardo Valentin

On Tuesday, December 19, 2017 10:15:07 AM Joe Perches wrote:
> 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 <joe@perches.com>
> ---
>  arch/s390/kernel/topology.c          |  3 +--
>  arch/tile/kernel/sysfs.c             |  2 +-
>  drivers/gpu/drm/i915/i915_sysfs.c    |  6 ++---
>  drivers/platform/x86/compal-laptop.c | 18 +++++----------
>  drivers/s390/cio/device.c            |  2 +-
>  drivers/scsi/lpfc/lpfc_attr.c        | 43 ++++++++++++------------------------
>  drivers/thermal/thermal_sysfs.c      |  9 ++++----
>  drivers/tty/serial/sh-sci.c          |  2 +-
>  drivers/usb/host/xhci-dbgcap.c       |  2 +-
>  drivers/usb/phy/phy-tahvo.c          |  2 +-
>  drivers/video/fbdev/auo_k190x.c      |  4 ++--
>  drivers/video/fbdev/w100fb.c         |  4 ++--
>  lib/test_firmware.c                  | 14 +++++-------
>  lib/test_kmod.c                      | 14 +++++-------
>  sound/soc/omap/mcbsp.c               |  4 ++--
>  15 files changed, 49 insertions(+), 80 deletions(-)

For fbdev changes:

Acked-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics


^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
  2017-12-21  9:34   ` Sakari Ailus
@ 2018-01-09 15:34       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-09 15:34 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Don Brace, alsa-devel, Rich Felker, linux-sh, David Airlie,
	Sebastian Ott, Heiko Carstens, linux-nvme, James Smart,
	Keith Busch, Robert Jarzmik, Christoph Hellwig, devel,
	linux-s390, Mauro Carvalho Chehab, James E.J. Bottomley,
	Sagi Grimberg, Yoshinori Sato, esc.storagedev, Russell King,
	linux-acpi, Zhang Rui, Len Brown, Dick Kennedy, Corey Minyard

On Thu, Dec 21, 2017 at 11:34:10AM +0200, Sakari Ailus wrote:
> Hi Joe,
> 
> On Tue, Dec 19, 2017 at 10:15:08AM -0800, Joe Perches wrote:
> > 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,
> 
> I have the exact same changes queued up in my tree. As there seem to be no
> dependencies to other patches in your set, how about dropping this chunk?

I've now dropped it, thanks.

greg k-h
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO
@ 2018-01-09 15:34       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 99+ messages in thread
From: Greg Kroah-Hartman @ 2018-01-09 15:34 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Joe Perches, Don Brace, linux-nvme, Rich Felker, linux-sh,
	David Airlie, esc.storagedev, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Russell King, Keith Busch, Robert Jarzmik,
	Christoph Hellwig, devel, linux-s390, James E.J. Bottomley,
	Sagi Grimberg, Yoshinori Sato, Takashi Iwai, Sebastian Ott,
	James Smart, linux-acpi, Zhang Rui, Len Brown, Dick Kennedy,
	Corey Minyard, linux-pm, Peter Oberparleiter, intel-gfx,
	Haojian Zhuang, Jens Axboe, Mark Brown, Harald Freudenberger,
	Jani Nikula, Rodrigo Vivi, Jaroslav Kysela, openipmi-developer,
	Mauro Carvalho Chehab, linux-arm-kernel, Alan Cox,
	Eduardo Valentin, linux-scsi, Martin K. Petersen,
	Rafael J. Wysocki, Liam Girdwood, linux-kernel, Arnd Bergmann,
	Sakari Ailus, Martin Schwidefsky, linux-media, Daniel Mack

On Thu, Dec 21, 2017 at 11:34:10AM +0200, Sakari Ailus wrote:
> Hi Joe,
> 
> On Tue, Dec 19, 2017 at 10:15:08AM -0800, Joe Perches wrote:
> > 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,
> 
> I have the exact same changes queued up in my tree. As there seem to be no
> dependencies to other patches in your set, how about dropping this chunk?

I've now dropped it, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
  2017-12-20 10:54           ` [-next PATCH 2/4] " Jarkko Nikula
  (?)
  (?)
@ 2018-01-10 14:43             ` Peter Ujfalusi
  -1 siblings, 0 replies; 99+ messages in thread
From: Peter Ujfalusi @ 2018-01-10 14:43 UTC (permalink / raw)
  To: Jarkko Nikula, Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap



On 2017-12-20 12:54, Jarkko Nikula wrote:
> On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
>> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
>>> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
>>>> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
>>>>> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
>>> [] 
>>>>> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
>>> []
>>>>> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>>>>>  	return size;
>>>>>  }
>>>>>  
>>>>> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
>>>>> +static DEVICE_ATTR_RW(dma_op_mode);
>>>>>  
>>>>
>>>> While I can ack this part here if it helps generic cleanup effort I
>>>> don't understart would it improve code readability in general? Mode 644
>>>> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
>>>> through all of these files in order to see what does it mean:
>>
>> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
>> get rid of all of the "non-standard" users that set random modes of
>> sysfs files, as we get it wrong too many times.  Using the "defaults" is
>> much better.
>>
> Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
> previous reply):
> 
> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

And from me to the same file (sound/soc/omap/mcbsp.c):

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-10 14:43             ` Peter Ujfalusi
  0 siblings, 0 replies; 99+ messages in thread
From: Peter Ujfalusi @ 2018-01-10 14:43 UTC (permalink / raw)
  To: Jarkko Nikula, Greg Kroah-Hartman
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx



On 2017-12-20 12:54, Jarkko Nikula wrote:
> On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
>> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
>>> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
>>>> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
>>>>> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
>>> [] 
>>>>> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
>>> []
>>>>> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>>>>>  	return size;
>>>>>  }
>>>>>  
>>>>> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
>>>>> +static DEVICE_ATTR_RW(dma_op_mode);
>>>>>  
>>>>
>>>> While I can ack this part here if it helps generic cleanup effort I
>>>> don't understart would it improve code readability in general? Mode 644
>>>> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
>>>> through all of these files in order to see what does it mean:
>>
>> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
>> get rid of all of the "non-standard" users that set random modes of
>> sysfs files, as we get it wrong too many times.  Using the "defaults" is
>> much better.
>>
> Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
> previous reply):
> 
> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

And from me to the same file (sound/soc/omap/mcbsp.c):

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 99+ messages in thread

* [-next,2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-10 14:43             ` Peter Ujfalusi
  0 siblings, 0 replies; 99+ messages in thread
From: Peter Ujfalusi @ 2018-01-10 14:43 UTC (permalink / raw)
  To: Jarkko Nikula, Greg Kroah-Hartman
  Cc: Joe Perches, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi,
	Cezary Jackiewicz, Darren Hart, Andy Shevchenko, Sebastian Ott,
	Peter Oberparleiter, James Smart, Dick Kennedy, Zhang Rui,
	Eduardo Valentin, Mathias Nyman, Felipe Balbi, Luis R. Rodriguez,
	Martin Schwidefsky, Heiko Carstens, David Airlie,
	James E.J. Bottomley, Martin K. Petersen, Jiri Slaby,
	Bartlomiej Zolnierkiewicz, Liam Girdwood, Mark Brown,
	Jaroslav Kysela, Takashi Iwai, linux-s390, linux-kernel,
	intel-gfx, dri-devel, platform-driver-x86, linux-scsi, linux-pm,
	linux-serial, linux-usb, linux-fbdev, alsa-devel, linux-omap

On 2017-12-20 12:54, Jarkko Nikula wrote:
> On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
>> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
>>> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
>>>> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
>>>>> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
>>> [] 
>>>>> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
>>> []
>>>>> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>>>>>  	return size;
>>>>>  }
>>>>>  
>>>>> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
>>>>> +static DEVICE_ATTR_RW(dma_op_mode);
>>>>>  
>>>>
>>>> While I can ack this part here if it helps generic cleanup effort I
>>>> don't understart would it improve code readability in general? Mode 644
>>>> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
>>>> through all of these files in order to see what does it mean:
>>
>> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
>> get rid of all of the "non-standard" users that set random modes of
>> sysfs files, as we get it wrong too many times.  Using the "defaults" is
>> much better.
>>
> Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
> previous reply):
> 
> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

And from me to the same file (sound/soc/omap/mcbsp.c):

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 99+ messages in thread

* Re: [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW
@ 2018-01-10 14:43             ` Peter Ujfalusi
  0 siblings, 0 replies; 99+ messages in thread
From: Peter Ujfalusi @ 2018-01-10 14:43 UTC (permalink / raw)
  To: Jarkko Nikula, Greg Kroah-Hartman
  Cc: linux-fbdev, David Airlie, Joonas Lahtinen, Heiko Carstens,
	alsa-devel, dri-devel, Jaroslav Kysela, linux-s390, linux-omap,
	James E.J. Bottomley, linux-scsi, Takashi Iwai, Sebastian Ott,
	James Smart, Cezary Jackiewicz, linux-serial, Jiri Slaby,
	Darren Hart, Zhang Rui, Dick Kennedy, Mathias Nyman,
	Bartlomiej Zolnierkiewicz, Peter Oberparleiter, intel-gfx



On 2017-12-20 12:54, Jarkko Nikula wrote:
> On Wed, Dec 20, 2017 at 10:32:11AM +0100, Greg Kroah-Hartman wrote:
>> On Wed, Dec 20, 2017 at 01:24:44AM -0800, Joe Perches wrote:
>>> On Wed, 2017-12-20 at 10:34 +0200, Jarkko Nikula wrote:
>>>> On Tue, Dec 19, 2017 at 10:15:07AM -0800, Joe Perches wrote:
>>>>> Convert DEVICE_ATTR uses to DEVICE_ATTR_RW where possible.
>>> [] 
>>>>> diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
>>> []
>>>>> @@ -854,7 +854,7 @@ static ssize_t dma_op_mode_store(struct device *dev,
>>>>>  	return size;
>>>>>  }
>>>>>  
>>>>> -static DEVICE_ATTR(dma_op_mode, 0644, dma_op_mode_show, dma_op_mode_store);
>>>>> +static DEVICE_ATTR_RW(dma_op_mode);
>>>>>  
>>>>
>>>> While I can ack this part here if it helps generic cleanup effort I
>>>> don't understart would it improve code readability in general? Mode 644
>>>> is clear and don't need any grepping but for DEVICE_ATTR_RW() I had to go
>>>> through all of these files in order to see what does it mean:
>>
>> Yeah, 644 is "clear", but _RW() is even more clear.  Ideally I want to
>> get rid of all of the "non-standard" users that set random modes of
>> sysfs files, as we get it wrong too many times.  Using the "defaults" is
>> much better.
>>
> Fair enough. For the sound/soc/omap/ (Acked-by was missing from my
> previous reply):
> 
> Acked-by: Jarkko Nikula <jarkko.nikula@bitmer.com>

And from me to the same file (sound/soc/omap/mcbsp.c):

Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>


- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply	[flat|nested] 99+ messages in thread

end of thread, other threads:[~2018-01-10 14:44 UTC | newest]

Thread overview: 99+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-19 18:15 [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo> Joe Perches
2017-12-19 18:15 ` Joe Perches
2017-12-19 18:15 ` Joe Perches
2017-12-19 18:15 ` Joe Perches
2017-12-19 18:15 ` Joe Perches
2017-12-19 18:15 ` [-next PATCH 1/4] sysfs.h: Use octal permissions Joe Perches
2017-12-19 18:15 ` [-next PATCH 2/4] treewide: Use DEVICE_ATTR_RW Joe Perches
2017-12-19 18:15   ` Joe Perches
2017-12-19 18:15   ` [-next,2/4] " Joe Perches
2017-12-19 18:15   ` [-next PATCH 2/4] " Joe Perches
2017-12-19 18:41   ` Andy Shevchenko
2017-12-19 18:41     ` Andy Shevchenko
2017-12-19 18:41     ` [-next,2/4] " Andy Shevchenko
2017-12-19 18:41     ` [-next PATCH 2/4] " Andy Shevchenko
2017-12-20  7:19     ` [alsa-devel] " Jidong Zhang
2017-12-20  8:34   ` Jarkko Nikula
2017-12-20  8:34     ` Jarkko Nikula
2017-12-20  8:34     ` [-next,2/4] " Jarkko Nikula
2017-12-20  8:34     ` [-next PATCH 2/4] " Jarkko Nikula
2017-12-20  9:24     ` Joe Perches
2017-12-20  9:24       ` Joe Perches
2017-12-20  9:24       ` [-next,2/4] " Joe Perches
2017-12-20  9:24       ` [-next PATCH 2/4] " Joe Perches
2017-12-20  9:32       ` Greg Kroah-Hartman
2017-12-20  9:32         ` Greg Kroah-Hartman
2017-12-20  9:32         ` [-next,2/4] " Greg Kroah-Hartman
2017-12-20  9:32         ` [-next PATCH 2/4] " Greg Kroah-Hartman
2017-12-20  9:54         ` Joe Perches
2017-12-20  9:54           ` Joe Perches
2017-12-20  9:54           ` [-next,2/4] " Joe Perches
2017-12-20  9:54           ` [-next PATCH 2/4] " Joe Perches
2017-12-20  9:59           ` Greg Kroah-Hartman
2017-12-20  9:59             ` Greg Kroah-Hartman
2017-12-20  9:59             ` [-next,2/4] " Greg Kroah-Hartman
2017-12-20  9:59             ` [-next PATCH 2/4] " Greg Kroah-Hartman
2017-12-20 10:55             ` Joe Perches
2017-12-20 10:55               ` Joe Perches
2017-12-20 10:55               ` [-next,2/4] " Joe Perches
2017-12-20 10:55               ` [-next PATCH 2/4] " Joe Perches
2017-12-20 13:26               ` Julia Lawall
2017-12-20 13:26                 ` Julia Lawall
2017-12-20 13:26                 ` [-next,2/4] " Julia Lawall
2017-12-20 13:26                 ` [-next PATCH 2/4] " Julia Lawall
2017-12-20 10:54         ` Jarkko Nikula
2017-12-20 10:54           ` Jarkko Nikula
2017-12-20 10:54           ` [-next,2/4] " Jarkko Nikula
2017-12-20 10:54           ` [-next PATCH 2/4] " Jarkko Nikula
2018-01-10 14:43           ` Peter Ujfalusi
2018-01-10 14:43             ` Peter Ujfalusi
2018-01-10 14:43             ` [-next,2/4] " Peter Ujfalusi
2018-01-10 14:43             ` [-next PATCH 2/4] " Peter Ujfalusi
2017-12-21  0:47   ` Zhang Rui
2017-12-21  0:47     ` Zhang Rui
2017-12-21  0:47     ` [-next,2/4] " Zhang, Rui
2017-12-21  0:47     ` [-next PATCH 2/4] " Zhang Rui
2018-01-03 15:16   ` Bartlomiej Zolnierkiewicz
2018-01-03 15:16     ` Bartlomiej Zolnierkiewicz
2018-01-03 15:16     ` [-next,2/4] " Bartlomiej Zolnierkiewicz
2018-01-03 15:16     ` [-next PATCH 2/4] " Bartlomiej Zolnierkiewicz
2017-12-19 18:15 ` [-next PATCH 3/4] treewide: Use DEVICE_ATTR_RO Joe Perches
2017-12-19 18:15   ` Joe Perches
2017-12-19 18:15   ` Joe Perches
2017-12-20 19:00   ` Rafael J. Wysocki
2017-12-20 20:26     ` Sagi Grimberg
2017-12-20 21:38     ` Robert Jarzmik
2017-12-21  0:48   ` Zhang Rui
2017-12-21  0:48     ` Zhang Rui
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
2018-01-09 15:34       ` Greg Kroah-Hartman
2017-12-19 18:15 ` [-next PATCH 4/4] treewide: Use DEVICE_ATTR_WO Joe Perches
2017-12-19 18:44   ` Borislav Petkov
2017-12-19 18:44     ` Borislav Petkov
2017-12-19 18:44     ` Borislav Petkov
2017-12-19 18:51     ` Joe Perches
2017-12-19 18:51       ` Joe Perches
2017-12-19 18:51       ` Joe Perches
2017-12-19 18:51       ` Joe Perches
2017-12-19 18:54       ` Borislav Petkov
2017-12-19 18:54         ` Borislav Petkov
2017-12-19 18:54         ` Borislav Petkov
2017-12-21  0:50   ` Zhang Rui
2017-12-21  0:50     ` Zhang Rui
2017-12-19 18:54 ` [-next PATCH 0/4] sysfs and DEVICE_ATTR_<foo> Jani Nikula
2017-12-19 18:54   ` Jani Nikula
2017-12-19 18:54   ` Jani Nikula
2017-12-19 18:54   ` Jani Nikula
2017-12-19 19:26 ` Corey Minyard
2017-12-19 19:26   ` Corey Minyard
2017-12-19 19:26   ` Corey Minyard
2017-12-19 19:26   ` Corey Minyard
2017-12-19 19:26   ` Corey Minyard
2017-12-20  9:46 ` Felipe Balbi
2017-12-20  9:46   ` Felipe Balbi
2017-12-20  9:46   ` Felipe Balbi
2017-12-20  9:46   ` Felipe Balbi
2017-12-20  9:46   ` Felipe Balbi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.