linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/16] Driver core: remove bus_type.dev_attrs
@ 2017-06-06 19:22 Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 01/16] arm: ecard: use dev_groups and not dev_attrs for bus_type Greg Kroah-Hartman
                   ` (15 more replies)
  0 siblings, 16 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, David S. Miller, James E.J. Bottomley,
	Alexander Shishkin, Alexey Kardashevskiy, Bart Van Assche,
	Benjamin Herrenschmidt, Benjamin Tissoires, Bhumika Goyal,
	Bjorn Andersson, Doug Ledford, Geoff Levand, Helge Deller,
	Jiri Kosina, Jiri Slaby, Joerg Roedel, Johan Hovold,
	Krzysztof Kozlowski, Lars-Peter Clausen, Michael Ellerman,
	Ohad Ben-Cohen, Paul Mackerras, Ralf Baechle, Rasmus Villemoes,
	Rich Felker, Rob Herring, Robin Murphy, Russell King,
	Srinivas Pandruvada, Vineet Gupta, Wei Yongjun, Yoshinori Sato

These are some patches that have been in my local trees for years, time
to finally get them flushed out.

The struct bus_type has a dev_attrs field, that duplicates the
dev_groups field (dev_groups is newer).  This patch series moves the few
remaining users of this field over to use dev_groups, and then finally
removes the dev_attrs field from the structure, and the driver core
logic.

Subsystem maintainers, I'm glad to take this series in my driver core
tree, if you just want to ack your respective patches, that's fine with
me.

This series has passed 0-day so I know it at least builds properly :)

thanks,

greg k-h

Greg Kroah-Hartman (16):
  arm: ecard: use dev_groups and not dev_attrs for bus_type
  mips: sgi-ip22: ecard: use dev_groups and not dev_attrs for bus_type
  parisc: parisc_bus_type: use dev_groups and not dev_attrs for bus_type
  amba: use dev_groups and not dev_attrs for bus_type
  rpmsg: use dev_groups and not dev_attrs for bus_type
  sh: superhyway: use dev_groups and not dev_attrs for bus_type
  macintosh: use dev_groups and not dev_attrs for bus_type
  powerpc: ps3: use dev_groups and not dev_attrs for bus_type
  powerpc: ibmebus: use dev_groups and not dev_attrs for bus_type
  powerpc: vio: use dev_groups and not dev_attrs for bus_type
  powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  hwtracing: intel_th: use dev_groups and not dev_attrs for bus_type
  hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
  sparc: vio: use dev_groups and not dev_attrs for bus_type
  tty: serdev: use dev_groups and not dev_attrs for bus_type
  driver-core: remove struct bus_type.dev_attrs

 arch/arm/mach-rpc/ecard.c                | 40 +++++++++++++++-----------
 arch/mips/sgi-ip22/ip22-gio.c            | 16 +++++++----
 arch/parisc/kernel/drivers.c             | 23 ++++++++-------
 arch/powerpc/platforms/ps3/system-bus.c  | 10 ++++---
 arch/powerpc/platforms/pseries/ibmebus.c | 16 +++++++----
 arch/powerpc/platforms/pseries/vio.c     | 49 +++++++++++++++++++++-----------
 arch/sparc/kernel/vio.c                  | 18 +++++++-----
 drivers/amba/bus.c                       | 25 ++++++++--------
 drivers/base/bus.c                       | 37 +-----------------------
 drivers/hid/intel-ish-hid/ishtp/bus.c    | 10 ++++---
 drivers/hwtracing/intel_th/core.c        |  1 -
 drivers/macintosh/macio_asic.c           |  4 +--
 drivers/macintosh/macio_sysfs.c          | 29 +++++++++++++------
 drivers/rpmsg/rpmsg_core.c               | 23 ++++++++-------
 drivers/sh/superhyway/superhyway-sysfs.c | 29 ++++++++++++-------
 drivers/sh/superhyway/superhyway.c       |  2 +-
 drivers/tty/serdev/core.c                | 10 ++++---
 include/linux/device.h                   |  2 --
 include/linux/superhyway.h               |  2 +-
 19 files changed, 188 insertions(+), 158 deletions(-)

-- 
2.13.0

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

* [PATCH 01/16] arm: ecard: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 02/16] mips: sgi-ip22: " Greg Kroah-Hartman
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Russell King, linux-arm-kernel

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Russell King <linux@armlinux.org.uk>
Cc: <linux-arm-kernel@lists.infradead.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/arm/mach-rpc/ecard.c | 40 +++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-rpc/ecard.c b/arch/arm/mach-rpc/ecard.c
index 6b279d037774..f75b8b562d57 100644
--- a/arch/arm/mach-rpc/ecard.c
+++ b/arch/arm/mach-rpc/ecard.c
@@ -761,19 +761,21 @@ static struct expansion_card *__init ecard_alloc_card(int type, int slot)
 	return ec;
 }
 
-static ssize_t ecard_show_irq(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t irq_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->irq);
 }
+static DEVICE_ATTR_RO(irq);
 
-static ssize_t ecard_show_dma(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t dma_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->dma);
 }
+static DEVICE_ATTR_RO(dma);
 
-static ssize_t ecard_show_resources(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t resource_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	char *str = buf;
@@ -787,35 +789,39 @@ static ssize_t ecard_show_resources(struct device *dev, struct device_attribute
 
 	return str - buf;
 }
+static DEVICE_ATTR_RO(resource_show)
 
-static ssize_t ecard_show_vendor(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t vendor_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->cid.manufacturer);
 }
+static DEVICE_ATTR_RO(vendor);
 
-static ssize_t ecard_show_device(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t device_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%u\n", ec->cid.product);
 }
+static DEVICE_ATTR_RO(device);
 
-static ssize_t ecard_show_type(struct device *dev, struct device_attribute *attr, char *buf)
+static ssize_t type_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
 	struct expansion_card *ec = ECARD_DEV(dev);
 	return sprintf(buf, "%s\n", ec->easi ? "EASI" : "IOC");
 }
-
-static struct device_attribute ecard_dev_attrs[] = {
-	__ATTR(device,   S_IRUGO, ecard_show_device,    NULL),
-	__ATTR(dma,      S_IRUGO, ecard_show_dma,       NULL),
-	__ATTR(irq,      S_IRUGO, ecard_show_irq,       NULL),
-	__ATTR(resource, S_IRUGO, ecard_show_resources, NULL),
-	__ATTR(type,     S_IRUGO, ecard_show_type,      NULL),
-	__ATTR(vendor,   S_IRUGO, ecard_show_vendor,    NULL),
-	__ATTR_NULL,
+static DEVICE_ATTR_RO(type);
+
+static struct attribute *ecard_dev_attrs[] = {
+	&dev_attr_device.attr,
+	&dev_attr_dma.attr,
+	&dev_attr_irq.attr,
+	&dev_attr_resource.attr,
+	&dev_attr_type.attr,
+	&dev_attr_vendor.attr,
+	NULL,
 };
-
+ATTRIBUTE_GROUPS(ecard_dev);
 
 int ecard_request_resources(struct expansion_card *ec)
 {
@@ -1120,7 +1126,7 @@ static int ecard_match(struct device *_dev, struct device_driver *_drv)
 
 struct bus_type ecard_bus_type = {
 	.name		= "ecard",
-	.dev_attrs	= ecard_dev_attrs,
+	.dev_groups	= ecard_dev_groups,
 	.match		= ecard_match,
 	.probe		= ecard_drv_probe,
 	.remove		= ecard_drv_remove,
-- 
2.13.0

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

* [PATCH 02/16] mips: sgi-ip22: ecard: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 01/16] arm: ecard: use dev_groups and not dev_attrs for bus_type Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 03/16] parisc: parisc_bus_type: " Greg Kroah-Hartman
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Ralf Baechle, linux-mips

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/mips/sgi-ip22/ip22-gio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/mips/sgi-ip22/ip22-gio.c b/arch/mips/sgi-ip22/ip22-gio.c
index cdf187600010..b225033aade6 100644
--- a/arch/mips/sgi-ip22/ip22-gio.c
+++ b/arch/mips/sgi-ip22/ip22-gio.c
@@ -169,6 +169,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
+static DEVICE_ATTR_RO(modalias);
 
 static ssize_t name_show(struct device *dev,
 			 struct device_attribute *attr, char *buf)
@@ -178,6 +179,7 @@ static ssize_t name_show(struct device *dev,
 	giodev = to_gio_device(dev);
 	return sprintf(buf, "%s", giodev->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t id_show(struct device *dev,
 		       struct device_attribute *attr, char *buf)
@@ -187,13 +189,15 @@ static ssize_t id_show(struct device *dev,
 	giodev = to_gio_device(dev);
 	return sprintf(buf, "%x", giodev->id.id);
 }
+static DEVICE_ATTR_RO(id);
 
-static struct device_attribute gio_dev_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_RO(name),
-	__ATTR_RO(id),
-	__ATTR_NULL,
+static struct attribute *gio_dev_attrs[] = {
+	&dev_attr_modalias.attr,
+	&dev_attr_name.attr,
+	&dev_attr_id.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(gio_dev);
 
 static int gio_device_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
@@ -374,7 +378,7 @@ static void ip22_check_gio(int slotno, unsigned long addr, int irq)
 
 static struct bus_type gio_bus_type = {
 	.name	   = "gio",
-	.dev_attrs = gio_dev_attrs,
+	.dev_groups = gio_dev_groups,
 	.match	   = gio_bus_match,
 	.probe	   = gio_device_probe,
 	.remove	   = gio_device_remove,
-- 
2.13.0

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

* [PATCH 03/16] parisc: parisc_bus_type: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 01/16] arm: ecard: use dev_groups and not dev_attrs for bus_type Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 02/16] mips: sgi-ip22: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 04/16] amba: " Greg Kroah-Hartman
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, James E.J. Bottomley, Helge Deller,
	Bart Van Assche, Doug Ledford, linux-parisc

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Doug Ledford <dledford@redhat.com>
Cc: <linux-parisc@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/parisc/kernel/drivers.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/arch/parisc/kernel/drivers.c b/arch/parisc/kernel/drivers.c
index fa78419100c8..d8f77358e2ba 100644
--- a/arch/parisc/kernel/drivers.c
+++ b/arch/parisc/kernel/drivers.c
@@ -575,7 +575,8 @@ static ssize_t name##_show(struct device *dev, struct device_attribute *attr, ch
 {									\
 	struct parisc_device *padev = to_parisc_device(dev);		\
 	return sprintf(buf, format_string, padev->field);		\
-}
+}									\
+static DEVICE_ATTR_RO(name);
 
 #define pa_dev_attr_id(field, format) pa_dev_attr(field, id.field, format)
 
@@ -589,22 +590,24 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 {
 	return make_modalias(dev, buf);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute parisc_device_attrs[] = {
-	__ATTR_RO(irq),
-	__ATTR_RO(hw_type),
-	__ATTR_RO(rev),
-	__ATTR_RO(hversion),
-	__ATTR_RO(sversion),
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static struct attribute *parisc_device_attrs[] = {
+	&dev_attr_irq.attr,
+	&dev_attr_hw_type.attr,
+	&dev_attr_rev.attr,
+	&dev_attr_hversion.attr,
+	&dev_attr_sversion.attr,
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(parisc_device);
 
 struct bus_type parisc_bus_type = {
 	.name = "parisc",
 	.match = parisc_generic_match,
 	.uevent = parisc_uevent,
-	.dev_attrs = parisc_device_attrs,
+	.dev_groups = parisc_device_groups,
 	.probe = parisc_driver_probe,
 	.remove = parisc_driver_remove,
 };
-- 
2.13.0

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

* [PATCH 04/16] amba: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (2 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 03/16] parisc: parisc_bus_type: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 05/16] rpmsg: " Greg Kroah-Hartman
                   ` (11 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Russell King

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Russell King <linux@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/amba/bus.c | 25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/drivers/amba/bus.c b/drivers/amba/bus.c
index a56fa2a1e9aa..e0f74ddc22b7 100644
--- a/drivers/amba/bus.c
+++ b/drivers/amba/bus.c
@@ -105,6 +105,7 @@ static ssize_t driver_override_store(struct device *_dev,
 
 	return count;
 }
+static DEVICE_ATTR_RW(driver_override);
 
 #define amba_attr_func(name,fmt,arg...)					\
 static ssize_t name##_show(struct device *_dev,				\
@@ -112,25 +113,23 @@ static ssize_t name##_show(struct device *_dev,				\
 {									\
 	struct amba_device *dev = to_amba_device(_dev);			\
 	return sprintf(buf, fmt, arg);					\
-}
-
-#define amba_attr(name,fmt,arg...)	\
-amba_attr_func(name,fmt,arg)		\
-static DEVICE_ATTR(name, S_IRUGO, name##_show, NULL)
+}									\
+static DEVICE_ATTR_RO(name)
 
 amba_attr_func(id, "%08x\n", dev->periphid);
-amba_attr(irq0, "%u\n", dev->irq[0]);
-amba_attr(irq1, "%u\n", dev->irq[1]);
+amba_attr_func(irq0, "%u\n", dev->irq[0]);
+amba_attr_func(irq1, "%u\n", dev->irq[1]);
 amba_attr_func(resource, "\t%016llx\t%016llx\t%016lx\n",
 	 (unsigned long long)dev->res.start, (unsigned long long)dev->res.end,
 	 dev->res.flags);
 
-static struct device_attribute amba_dev_attrs[] = {
-	__ATTR_RO(id),
-	__ATTR_RO(resource),
-	__ATTR_RW(driver_override),
-	__ATTR_NULL,
+static struct attribute *amba_dev_attrs[] = {
+	&dev_attr_id.attr,
+	&dev_attr_resource.attr,
+	&dev_attr_driver_override.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(amba_dev);
 
 #ifdef CONFIG_PM
 /*
@@ -192,7 +191,7 @@ static const struct dev_pm_ops amba_pm = {
  */
 struct bus_type amba_bustype = {
 	.name		= "amba",
-	.dev_attrs	= amba_dev_attrs,
+	.dev_groups	= amba_dev_groups,
 	.match		= amba_match,
 	.uevent		= amba_uevent,
 	.pm		= &amba_pm,
-- 
2.13.0

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

* [PATCH 05/16] rpmsg: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (3 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 04/16] amba: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:33   ` Bjorn Andersson
  2017-06-06 19:22 ` [PATCH 06/16] sh: superhyway: " Greg Kroah-Hartman
                   ` (10 subsequent siblings)
  15 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Ohad Ben-Cohen, Bjorn Andersson, linux-remoteproc

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Ohad Ben-Cohen <ohad@wizery.com>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: <linux-remoteproc@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/rpmsg/rpmsg_core.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index 600f5f9f7431..ad3d2a9df287 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -330,7 +330,8 @@ field##_show(struct device *dev,					\
 	struct rpmsg_device *rpdev = to_rpmsg_device(dev);		\
 									\
 	return sprintf(buf, format_string, rpdev->path);		\
-}
+}									\
+static DEVICE_ATTR_RO(field);
 
 /* for more info, see Documentation/ABI/testing/sysfs-bus-rpmsg */
 rpmsg_show_attr(name, id.name, "%s\n");
@@ -345,15 +346,17 @@ static ssize_t modalias_show(struct device *dev,
 
 	return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name);
 }
-
-static struct device_attribute rpmsg_dev_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_RO(modalias),
-	__ATTR_RO(dst),
-	__ATTR_RO(src),
-	__ATTR_RO(announce),
-	__ATTR_NULL
+static DEVICE_ATTR_RO(modalias);
+
+static struct attribute *rpmsg_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_modalias.attr,
+	&dev_attr_dst.attr,
+	&dev_attr_src.attr,
+	&dev_attr_announce.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(rpmsg_dev);
 
 /* rpmsg devices and drivers are matched using the service name */
 static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
@@ -455,7 +458,7 @@ static int rpmsg_dev_remove(struct device *dev)
 static struct bus_type rpmsg_bus = {
 	.name		= "rpmsg",
 	.match		= rpmsg_dev_match,
-	.dev_attrs	= rpmsg_dev_attrs,
+	.dev_groups	= rpmsg_dev_groups,
 	.uevent		= rpmsg_uevent,
 	.probe		= rpmsg_dev_probe,
 	.remove		= rpmsg_dev_remove,
-- 
2.13.0

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

* [PATCH 06/16] sh: superhyway: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (4 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 05/16] rpmsg: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 07/16] macintosh: " Greg Kroah-Hartman
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Yoshinori Sato, Rich Felker, linux-sh

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: <linux-sh@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/sh/superhyway/superhyway-sysfs.c | 29 +++++++++++++++++++----------
 drivers/sh/superhyway/superhyway.c       |  2 +-
 include/linux/superhyway.h               |  2 +-
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/drivers/sh/superhyway/superhyway-sysfs.c b/drivers/sh/superhyway/superhyway-sysfs.c
index 55434330867b..774f31b564f8 100644
--- a/drivers/sh/superhyway/superhyway-sysfs.c
+++ b/drivers/sh/superhyway/superhyway-sysfs.c
@@ -19,7 +19,8 @@ static ssize_t name##_show(struct device *dev, struct device_attribute *attr, ch
 {									\
 	struct superhyway_device *s = to_superhyway_device(dev);	\
 	return sprintf(buf, fmt, s->field);				\
-}
+}									\
+static DEVICE_ATTR_RO(name);
 
 /* VCR flags */
 superhyway_ro_attr(perr_flags, "0x%02x\n", vcr.perr_flags);
@@ -32,14 +33,22 @@ superhyway_ro_attr(top_mb, "0x%02x\n", vcr.top_mb);
 /* Misc */
 superhyway_ro_attr(resource, "0x%08lx\n", resource[0].start);
 
-struct device_attribute superhyway_dev_attrs[] = {
-	__ATTR_RO(perr_flags),
-	__ATTR_RO(merr_flags),
-	__ATTR_RO(mod_vers),
-	__ATTR_RO(mod_id),
-	__ATTR_RO(bot_mb),
-	__ATTR_RO(top_mb),
-	__ATTR_RO(resource),
-	__ATTR_NULL,
+static struct attribute *superhyway_dev_attrs[] = {
+	&dev_attr_perr_flags.attr,
+	&dev_attr_merr_flags.attr,
+	&dev_attr_mod_vers.attr,
+	&dev_attr_mod_id.attr,
+	&dev_attr_bot_mb.attr,
+	&dev_attr_top_mb.attr,
+	&dev_attr_resource.attr,
+	NULL,
 };
 
+static const struct attribute_group superhyway_dev_group = {
+	.attrs = superhyway_dev_attrs,
+};
+
+const struct attribute_group *superhyway_dev_groups[] = {
+	&superhyway_dev_group,
+	NULL,
+};
diff --git a/drivers/sh/superhyway/superhyway.c b/drivers/sh/superhyway/superhyway.c
index bb1fb7712134..348836b90605 100644
--- a/drivers/sh/superhyway/superhyway.c
+++ b/drivers/sh/superhyway/superhyway.c
@@ -209,7 +209,7 @@ struct bus_type superhyway_bus_type = {
 	.name		= "superhyway",
 	.match		= superhyway_bus_match,
 #ifdef CONFIG_SYSFS
-	.dev_attrs	= superhyway_dev_attrs,
+	.dev_groups	= superhyway_dev_groups,
 #endif
 	.probe		= superhyway_device_probe,
 	.remove		= superhyway_device_remove,
diff --git a/include/linux/superhyway.h b/include/linux/superhyway.h
index 17ea468fa362..8d3376775813 100644
--- a/include/linux/superhyway.h
+++ b/include/linux/superhyway.h
@@ -101,7 +101,7 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *, struct
 int superhyway_add_devices(struct superhyway_bus *bus, struct superhyway_device **devices, int nr_devices);
 
 /* drivers/sh/superhyway/superhyway-sysfs.c */
-extern struct device_attribute superhyway_dev_attrs[];
+extern const struct attribute_group *superhyway_dev_groups[];
 
 #endif /* __LINUX_SUPERHYWAY_H */
 
-- 
2.13.0

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

* [PATCH 07/16] macintosh: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (5 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 06/16] sh: superhyway: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 08/16] powerpc: ps3: " Greg Kroah-Hartman
                   ` (8 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, linuxppc-dev

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/macintosh/macio_asic.c  |  4 ++--
 drivers/macintosh/macio_sysfs.c | 29 +++++++++++++++++++++--------
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/drivers/macintosh/macio_asic.c b/drivers/macintosh/macio_asic.c
index f757cef293f8..62f541f968f6 100644
--- a/drivers/macintosh/macio_asic.c
+++ b/drivers/macintosh/macio_asic.c
@@ -133,7 +133,7 @@ static int macio_device_resume(struct device * dev)
 	return 0;
 }
 
-extern struct device_attribute macio_dev_attrs[];
+extern const struct attribute_group *macio_dev_groups[];
 
 struct bus_type macio_bus_type = {
        .name	= "macio",
@@ -144,7 +144,7 @@ struct bus_type macio_bus_type = {
        .shutdown = macio_device_shutdown,
        .suspend	= macio_device_suspend,
        .resume	= macio_device_resume,
-       .dev_attrs = macio_dev_attrs,
+       .dev_groups = macio_dev_groups,
 };
 
 static int __init macio_bus_driver_init(void)
diff --git a/drivers/macintosh/macio_sysfs.c b/drivers/macintosh/macio_sysfs.c
index 0b1f9c76c68d..2445274f7e4b 100644
--- a/drivers/macintosh/macio_sysfs.c
+++ b/drivers/macintosh/macio_sysfs.c
@@ -10,7 +10,8 @@ field##_show (struct device *dev, struct device_attribute *attr,	\
 {									\
 	struct macio_dev *mdev = to_macio_device (dev);			\
 	return sprintf (buf, format_string, mdev->ofdev.dev.of_node->field); \
-}
+}									\
+static DEVICE_ATTR_RO(field);
 
 static ssize_t
 compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
@@ -37,6 +38,7 @@ compatible_show (struct device *dev, struct device_attribute *attr, char *buf)
 
 	return length;
 }
+static DEVICE_ATTR_RO(compatible);
 
 static ssize_t modalias_show (struct device *dev, struct device_attribute *attr,
 			      char *buf)
@@ -52,15 +54,26 @@ static ssize_t devspec_show(struct device *dev,
 	ofdev = to_platform_device(dev);
 	return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
 }
+static DEVICE_ATTR_RO(modalias);
+static DEVICE_ATTR_RO(devspec);
 
 macio_config_of_attr (name, "%s\n");
 macio_config_of_attr (type, "%s\n");
 
-struct device_attribute macio_dev_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_RO(type),
-	__ATTR_RO(compatible),
-	__ATTR_RO(modalias),
-	__ATTR_RO(devspec),
-	__ATTR_NULL
+static struct attribute *macio_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_type.attr,
+	&dev_attr_compatible.attr,
+	&dev_attr_modalias.attr,
+	&dev_attr_devspec.attr,
+	NULL,
+};
+
+static const struct attribute_group macio_dev_group = {
+	.attrs = macio_dev_attrs,
+};
+
+const struct attribute_group *macio_dev_groups[] = {
+	&macio_dev_group,
+	NULL,
 };
-- 
2.13.0

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

* [PATCH 08/16] powerpc: ps3: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (6 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 07/16] macintosh: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 21:33   ` Geoff Levand
  2017-06-07 10:17   ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 09/16] powerpc: ibmebus: " Greg Kroah-Hartman
                   ` (7 subsequent siblings)
  15 siblings, 2 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Geoff Levand, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, linuxppc-dev

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Geoff Levand <geoff@infradead.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/ps3/system-bus.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
index 2d2e5f80a3d3..3e98b4ea3df9 100644
--- a/arch/powerpc/platforms/ps3/system-bus.c
+++ b/arch/powerpc/platforms/ps3/system-bus.c
@@ -471,11 +471,13 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
 
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute ps3_system_bus_dev_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static struct attribute *ps3_system_bus_dev_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ps3_system_bus);
 
 struct bus_type ps3_system_bus_type = {
 	.name = "ps3_system_bus",
@@ -484,7 +486,7 @@ struct bus_type ps3_system_bus_type = {
 	.probe = ps3_system_bus_probe,
 	.remove = ps3_system_bus_remove,
 	.shutdown = ps3_system_bus_shutdown,
-	.dev_attrs = ps3_system_bus_dev_attrs,
+	.dev_groups = ps3_system_bus_dev_groups,
 };
 
 static int __init ps3_system_bus_init(void)
-- 
2.13.0

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

* [PATCH 09/16] powerpc: ibmebus: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (7 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 08/16] powerpc: ps3: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 10/16] powerpc: vio: " Greg Kroah-Hartman
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Bart Van Assche, Johan Hovold, Robin Murphy,
	Rob Herring, Lars-Peter Clausen, linuxppc-dev

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Rob Herring <robh@kernel.org>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/pseries/ibmebus.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/ibmebus.c b/arch/powerpc/platforms/pseries/ibmebus.c
index b363e439ddb9..52146b1356d2 100644
--- a/arch/powerpc/platforms/pseries/ibmebus.c
+++ b/arch/powerpc/platforms/pseries/ibmebus.c
@@ -397,6 +397,7 @@ static ssize_t devspec_show(struct device *dev,
 	ofdev = to_platform_device(dev);
 	return sprintf(buf, "%s\n", ofdev->dev.of_node->full_name);
 }
+static DEVICE_ATTR_RO(devspec);
 
 static ssize_t name_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
@@ -406,19 +407,22 @@ static ssize_t name_show(struct device *dev,
 	ofdev = to_platform_device(dev);
 	return sprintf(buf, "%s\n", ofdev->dev.of_node->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t modalias_show(struct device *dev,
 				struct device_attribute *attr, char *buf)
 {
 	return of_device_modalias(dev, buf, PAGE_SIZE);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute ibmebus_bus_device_attrs[] = {
-	__ATTR_RO(devspec),
-	__ATTR_RO(name),
-	__ATTR_RO(modalias),
-	__ATTR_NULL
+static struct attribute *ibmebus_bus_device_attrs[] = {
+	&dev_attr_devspec.attr,
+	&dev_attr_name.attr,
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ibmebus_bus_device);
 
 struct bus_type ibmebus_bus_type = {
 	.name      = "ibmebus",
@@ -428,7 +432,7 @@ struct bus_type ibmebus_bus_type = {
 	.probe     = ibmebus_bus_device_probe,
 	.remove    = ibmebus_bus_device_remove,
 	.shutdown  = ibmebus_bus_device_shutdown,
-	.dev_attrs = ibmebus_bus_device_attrs,
+	.dev_groups = ibmebus_bus_device_groups,
 };
 EXPORT_SYMBOL(ibmebus_bus_type);
 
-- 
2.13.0

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

* [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (8 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 09/16] powerpc: ibmebus: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:30   ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 11/16] powerpc: vio_cmo: " Greg Kroah-Hartman
                   ` (5 subsequent siblings)
  15 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Vineet Gupta, Bart Van Assche, Robin Murphy,
	Joerg Roedel, Johan Hovold, Alexey Kardashevskiy,
	Krzysztof Kozlowski, linuxppc-dev

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/pseries/vio.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 28b09fd797ec..fd6595598662 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1537,6 +1537,7 @@ static ssize_t name_show(struct device *dev,
 {
 	return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t devspec_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -1545,6 +1546,7 @@ static ssize_t devspec_show(struct device *dev,
 
 	return sprintf(buf, "%s\n", of_node_full_name(of_node));
 }
+static DEVICE_ATTR_RO(devspec);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -1566,6 +1568,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 
 	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
 }
+static DEVICE_ATTR_RO(modalias);
 
 static struct device_attribute vio_dev_attrs[] = {
 	__ATTR_RO(name),
@@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
 	__ATTR_RO(modalias),
 	__ATTR_NULL
 };
+static struct attribute *vio_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_devspec.attr,
+	&dev_attr_modalias.attr,
+	NULL,
+};
+ATTRIBUTE_GROUPS(vio_dev);
 
 void vio_unregister_device(struct vio_dev *viodev)
 {
@@ -1608,7 +1618,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
 
 struct bus_type vio_bus_type = {
 	.name = "vio",
-	.dev_attrs = vio_dev_attrs,
+	.dev_groups = vio_dev_groups,
 	.uevent = vio_hotplug,
 	.match = vio_bus_match,
 	.probe = vio_bus_probe,
-- 
2.13.0

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

* [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (9 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 10/16] powerpc: vio: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-08 13:12   ` Michael Ellerman
  2017-06-06 19:22 ` [PATCH 12/16] hwtracing: intel_th: " Greg Kroah-Hartman
                   ` (4 subsequent siblings)
  15 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, Vineet Gupta, Bart Van Assche, Robin Murphy,
	Joerg Roedel, Johan Hovold, Alexey Kardashevskiy,
	Krzysztof Kozlowski, linuxppc-dev

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index fd6595598662..176edf422867 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -948,7 +948,7 @@ static void vio_cmo_bus_init(void)
 /* sysfs device functions and data structures for CMO */
 
 #define viodev_cmo_rd_attr(name)                                        \
-static ssize_t viodev_cmo_##name##_show(struct device *dev,             \
+static ssize_t cmo_##name##_show(struct device *dev,                    \
                                         struct device_attribute *attr,  \
                                          char *buf)                     \
 {                                                                       \
@@ -962,7 +962,7 @@ static ssize_t viodev_cmo_allocs_failed_show(struct device *dev,
 	return sprintf(buf, "%d\n", atomic_read(&viodev->cmo.allocs_failed));
 }
 
-static ssize_t viodev_cmo_allocs_failed_reset(struct device *dev,
+static ssize_t cmo_allocs_failed_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct vio_dev *viodev = to_vio_dev(dev);
@@ -970,7 +970,7 @@ static ssize_t viodev_cmo_allocs_failed_reset(struct device *dev,
 	return count;
 }
 
-static ssize_t viodev_cmo_desired_set(struct device *dev,
+static ssize_t cmo_desired_store(struct device *dev,
 		struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct vio_dev *viodev = to_vio_dev(dev);
@@ -993,18 +993,25 @@ static ssize_t name_show(struct device *, struct device_attribute *, char *);
 static ssize_t devspec_show(struct device *, struct device_attribute *, char *);
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf);
-static struct device_attribute vio_cmo_dev_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_RO(devspec),
-	__ATTR_RO(modalias),
-	__ATTR(cmo_desired,       S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
-	       viodev_cmo_desired_show, viodev_cmo_desired_set),
-	__ATTR(cmo_entitled,      S_IRUGO, viodev_cmo_entitled_show,      NULL),
-	__ATTR(cmo_allocated,     S_IRUGO, viodev_cmo_allocated_show,     NULL),
-	__ATTR(cmo_allocs_failed, S_IWUSR|S_IRUSR|S_IWGRP|S_IRGRP|S_IROTH,
-	       viodev_cmo_allocs_failed_show, viodev_cmo_allocs_failed_reset),
-	__ATTR_NULL
+static DEVICE_ATTR_RO(name);
+static DEVICE_ATTR_RO(devspec);
+static DEVICE_ATTR_RO(modalias);
+static DEVICE_ATTR_RO(cmo_entitled);
+static DEVICE_ATTR_RO(cmo_allocated);
+static DEVICE_ATTR_RW(cmo_desired);
+static DEVICE_ATTR_RW(cmo_allocs_failed);
+
+static struct attribute *vio_cmo_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_devspec.attr,
+	&dev_attr_modalias.attr,
+	&dev_attr_cmo_entitled.attr,
+	&dev_attr_cmo_allocated.attr,
+	&dev_attr_cmo_desired.attr,
+	&dev_attr_cmo_allocs_failed.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(vio_cmo_dev);
 
 /* sysfs bus functions and data structures for CMO */
 
@@ -1066,7 +1073,7 @@ ATTRIBUTE_GROUPS(vio_bus);
 
 static void vio_cmo_sysfs_init(void)
 {
-	vio_bus_type.dev_attrs = vio_cmo_dev_attrs;
+	vio_bus_type.dev_groups = vio_cmo_dev_groups;
 	vio_bus_type.bus_groups = vio_bus_groups;
 }
 #else /* CONFIG_PPC_SMLPAR */
-- 
2.13.0

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

* [PATCH 12/16] hwtracing: intel_th: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (10 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 11/16] powerpc: vio_cmo: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 13/16] hid: intel-ish-hid: " Greg Kroah-Hartman
                   ` (3 subsequent siblings)
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Alexander Shishkin

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hwtracing/intel_th/core.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/hwtracing/intel_th/core.c b/drivers/hwtracing/intel_th/core.c
index 7563eceeaaea..8da567abc0ce 100644
--- a/drivers/hwtracing/intel_th/core.c
+++ b/drivers/hwtracing/intel_th/core.c
@@ -139,7 +139,6 @@ static int intel_th_remove(struct device *dev)
 
 static struct bus_type intel_th_bus = {
 	.name		= "intel_th",
-	.dev_attrs	= NULL,
 	.match		= intel_th_match,
 	.probe		= intel_th_probe,
 	.remove		= intel_th_remove,
-- 
2.13.0

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

* [PATCH 13/16] hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (11 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 12/16] hwtracing: intel_th: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 22:33   ` Srinivas Pandruvada
  2017-06-07 13:40   ` Jiri Kosina
  2017-06-06 19:22 ` [PATCH 14/16] sparc: vio: " Greg Kroah-Hartman
                   ` (2 subsequent siblings)
  15 siblings, 2 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel
  Cc: Greg Kroah-Hartman, Srinivas Pandruvada, Jiri Kosina,
	Benjamin Tissoires, Wei Yongjun, Bhumika Goyal, Rasmus Villemoes,
	linux-input

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: Jiri Kosina <jikos@kernel.org>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Cc: Wei Yongjun <weiyj.lk@gmail.com>
Cc: Bhumika Goyal <bhumirks@gmail.com>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Cc: <linux-input@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/hid/intel-ish-hid/ishtp/bus.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c b/drivers/hid/intel-ish-hid/ishtp/bus.c
index 5f382fedc2ab..f272cdd9bd55 100644
--- a/drivers/hid/intel-ish-hid/ishtp/bus.c
+++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
@@ -321,11 +321,13 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,
 	len = snprintf(buf, PAGE_SIZE, "ishtp:%s\n", dev_name(dev));
 	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute ishtp_cl_dev_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_NULL,
+static struct attribute *ishtp_cl_dev_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(ishtp_cl_dev);
 
 static int ishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
 {
@@ -346,7 +348,7 @@ static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = {
 
 static struct bus_type ishtp_cl_bus_type = {
 	.name		= "ishtp",
-	.dev_attrs	= ishtp_cl_dev_attrs,
+	.dev_groups	= ishtp_cl_dev_groups,
 	.probe		= ishtp_cl_device_probe,
 	.remove		= ishtp_cl_device_remove,
 	.pm		= &ishtp_cl_bus_dev_pm_ops,
-- 
2.13.0

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

* [PATCH 14/16] sparc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (12 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 13/16] hid: intel-ish-hid: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-06 19:36   ` David Miller
  2017-06-06 19:22 ` [PATCH 15/16] tty: serdev: " Greg Kroah-Hartman
  2017-06-06 19:22 ` [PATCH 16/16] driver-core: remove struct bus_type.dev_attrs Greg Kroah-Hartman
  15 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, David S. Miller, sparclinux

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: "David S. Miller" <davem@davemloft.net>
Cc: <sparclinux@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 arch/sparc/kernel/vio.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/arch/sparc/kernel/vio.c b/arch/sparc/kernel/vio.c
index f6bb857254fc..78bf2cc60924 100644
--- a/arch/sparc/kernel/vio.c
+++ b/arch/sparc/kernel/vio.c
@@ -105,6 +105,7 @@ static ssize_t devspec_show(struct device *dev,
 
 	return sprintf(buf, "%s\n", str);
 }
+static DEVICE_ATTR_RO(devspec);
 
 static ssize_t type_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -112,6 +113,7 @@ static ssize_t type_show(struct device *dev,
 	struct vio_dev *vdev = to_vio_dev(dev);
 	return sprintf(buf, "%s\n", vdev->type);
 }
+static DEVICE_ATTR_RO(type);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -120,17 +122,19 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 
 	return sprintf(buf, "vio:T%sS%s\n", vdev->type, vdev->compat);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute vio_dev_attrs[] = {
-	__ATTR_RO(devspec),
-	__ATTR_RO(type),
-	__ATTR_RO(modalias),
-	__ATTR_NULL
-};
+static struct attribute *vio_dev_attrs[] = {
+	&dev_attr_devspec.attr,
+	&dev_attr_type.attr,
+	&dev_attr_modalias.attr,
+	NULL,
+ };
+ATTRIBUTE_GROUPS(vio_dev);
 
 static struct bus_type vio_bus_type = {
 	.name		= "vio",
-	.dev_attrs	= vio_dev_attrs,
+	.dev_groups	= vio_dev_groups,
 	.uevent         = vio_hotplug,
 	.match		= vio_bus_match,
 	.probe		= vio_device_probe,
-- 
2.13.0

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

* [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (13 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 14/16] sparc: vio: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  2017-06-09 23:56   ` Stephen Rothwell
  2017-06-06 19:22 ` [PATCH 16/16] driver-core: remove struct bus_type.dev_attrs Greg Kroah-Hartman
  15 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman, Rob Herring, Jiri Slaby

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Rob Herring <robh@kernel.org>
Cc: Jiri Slaby <jslaby@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/tty/serdev/core.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
index 433de5ea9b02..e454162d8c6e 100644
--- a/drivers/tty/serdev/core.c
+++ b/drivers/tty/serdev/core.c
@@ -250,11 +250,13 @@ static ssize_t modalias_show(struct device *dev,
 {
 	return of_device_modalias(dev, buf, PAGE_SIZE);
 }
+DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute serdev_device_attrs[] = {
-	__ATTR_RO(modalias),
-	__ATTR_NULL
+static struct attribute *serdev_device_attrs[] = {
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(serdev_device);
 
 static struct bus_type serdev_bus_type = {
 	.name		= "serial",
@@ -262,7 +264,7 @@ static struct bus_type serdev_bus_type = {
 	.probe		= serdev_drv_probe,
 	.remove		= serdev_drv_remove,
 	.uevent		= serdev_uevent,
-	.dev_attrs	= serdev_device_attrs,
+	.dev_groups	= serdev_device_groups,
 };
 
 /**
-- 
2.13.0

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

* [PATCH 16/16] driver-core: remove struct bus_type.dev_attrs
  2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
                   ` (14 preceding siblings ...)
  2017-06-06 19:22 ` [PATCH 15/16] tty: serdev: " Greg Kroah-Hartman
@ 2017-06-06 19:22 ` Greg Kroah-Hartman
  15 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:22 UTC (permalink / raw)
  To: linux-kernel; +Cc: Greg Kroah-Hartman

Now that all in-kernel users of bus_type.dev_attrs have been converted
to use dev_groups instead, the dev_attrs field, and logic surrounding
it, can be removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/base/bus.c     | 37 +------------------------------------
 include/linux/device.h |  2 --
 2 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 6470eb8088f4..66efc4b806c2 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -466,35 +466,6 @@ int bus_for_each_drv(struct bus_type *bus, struct device_driver *start,
 }
 EXPORT_SYMBOL_GPL(bus_for_each_drv);
 
-static int device_add_attrs(struct bus_type *bus, struct device *dev)
-{
-	int error = 0;
-	int i;
-
-	if (!bus->dev_attrs)
-		return 0;
-
-	for (i = 0; bus->dev_attrs[i].attr.name; i++) {
-		error = device_create_file(dev, &bus->dev_attrs[i]);
-		if (error) {
-			while (--i >= 0)
-				device_remove_file(dev, &bus->dev_attrs[i]);
-			break;
-		}
-	}
-	return error;
-}
-
-static void device_remove_attrs(struct bus_type *bus, struct device *dev)
-{
-	int i;
-
-	if (bus->dev_attrs) {
-		for (i = 0; bus->dev_attrs[i].attr.name; i++)
-			device_remove_file(dev, &bus->dev_attrs[i]);
-	}
-}
-
 /**
  * bus_add_device - add device to bus
  * @dev: device being added
@@ -510,12 +481,9 @@ int bus_add_device(struct device *dev)
 
 	if (bus) {
 		pr_debug("bus: '%s': add device %s\n", bus->name, dev_name(dev));
-		error = device_add_attrs(bus, dev);
-		if (error)
-			goto out_put;
 		error = device_add_groups(dev, bus->dev_groups);
 		if (error)
-			goto out_id;
+			goto out_put;
 		error = sysfs_create_link(&bus->p->devices_kset->kobj,
 						&dev->kobj, dev_name(dev));
 		if (error)
@@ -532,8 +500,6 @@ int bus_add_device(struct device *dev)
 	sysfs_remove_link(&bus->p->devices_kset->kobj, dev_name(dev));
 out_groups:
 	device_remove_groups(dev, bus->dev_groups);
-out_id:
-	device_remove_attrs(bus, dev);
 out_put:
 	bus_put(dev->bus);
 	return error;
@@ -590,7 +556,6 @@ void bus_remove_device(struct device *dev)
 	sysfs_remove_link(&dev->kobj, "subsystem");
 	sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
 			  dev_name(dev));
-	device_remove_attrs(dev->bus, dev);
 	device_remove_groups(dev, dev->bus->dev_groups);
 	if (klist_node_attached(&dev->p->knode_bus))
 		klist_del(&dev->p->knode_bus);
diff --git a/include/linux/device.h b/include/linux/device.h
index 9ef518af5515..a04860932ceb 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -66,7 +66,6 @@ extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  * @name:	The name of the bus.
  * @dev_name:	Used for subsystems to enumerate devices like ("foo%u", dev->id).
  * @dev_root:	Default device to use as the parent.
- * @dev_attrs:	Default attributes of the devices on the bus.
  * @bus_groups:	Default attributes of the bus.
  * @dev_groups:	Default attributes of the devices on the bus.
  * @drv_groups: Default attributes of the device drivers on the bus.
@@ -112,7 +111,6 @@ struct bus_type {
 	const char		*name;
 	const char		*dev_name;
 	struct device		*dev_root;
-	struct device_attribute	*dev_attrs;	/* use dev_groups instead */
 	const struct attribute_group **bus_groups;
 	const struct attribute_group **dev_groups;
 	const struct attribute_group **drv_groups;
-- 
2.13.0

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

* Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 10/16] powerpc: vio: " Greg Kroah-Hartman
@ 2017-06-06 19:30   ` Greg Kroah-Hartman
  2017-06-06 23:04     ` Benjamin Herrenschmidt
  2017-06-07  8:58     ` [PATCH 10/16 v2] " Greg Kroah-Hartman
  0 siblings, 2 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-06 19:30 UTC (permalink / raw)
  To: linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

On Tue, Jun 06, 2017 at 09:22:15PM +0200, Greg Kroah-Hartman wrote:
> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: <linuxppc-dev@lists.ozlabs.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/powerpc/platforms/pseries/vio.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
> index 28b09fd797ec..fd6595598662 100644
> --- a/arch/powerpc/platforms/pseries/vio.c
> +++ b/arch/powerpc/platforms/pseries/vio.c
> @@ -1537,6 +1537,7 @@ static ssize_t name_show(struct device *dev,
>  {
>  	return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
>  }
> +static DEVICE_ATTR_RO(name);
>  
>  static ssize_t devspec_show(struct device *dev,
>  		struct device_attribute *attr, char *buf)
> @@ -1545,6 +1546,7 @@ static ssize_t devspec_show(struct device *dev,
>  
>  	return sprintf(buf, "%s\n", of_node_full_name(of_node));
>  }
> +static DEVICE_ATTR_RO(devspec);
>  
>  static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>  			     char *buf)
> @@ -1566,6 +1568,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
>  
>  	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
>  }
> +static DEVICE_ATTR_RO(modalias);
>  
>  static struct device_attribute vio_dev_attrs[] = {
>  	__ATTR_RO(name),
> @@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
>  	__ATTR_RO(modalias),
>  	__ATTR_NULL
>  };
> +static struct attribute *vio_dev_attrs[] = {

Hm, this feels wrong, odd that 0-day passed it.  I should be deleting
the above vio_dev_attrs field as well.  Is powerpc really a dead
platform?  :)

thanks,

greg k-h

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

* Re: [PATCH 05/16] rpmsg: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 05/16] rpmsg: " Greg Kroah-Hartman
@ 2017-06-06 19:33   ` Bjorn Andersson
  0 siblings, 0 replies; 39+ messages in thread
From: Bjorn Andersson @ 2017-06-06 19:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Ohad Ben-Cohen, linux-remoteproc

On Tue 06 Jun 12:22 PDT 2017, Greg Kroah-Hartman wrote:

> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: Ohad Ben-Cohen <ohad@wizery.com>
> Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
> Cc: <linux-remoteproc@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Thanks for cleaning this up.

Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>

Regards,
Bjorn

> ---
>  drivers/rpmsg/rpmsg_core.c | 23 +++++++++++++----------
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
> index 600f5f9f7431..ad3d2a9df287 100644
> --- a/drivers/rpmsg/rpmsg_core.c
> +++ b/drivers/rpmsg/rpmsg_core.c
> @@ -330,7 +330,8 @@ field##_show(struct device *dev,					\
>  	struct rpmsg_device *rpdev = to_rpmsg_device(dev);		\
>  									\
>  	return sprintf(buf, format_string, rpdev->path);		\
> -}
> +}									\
> +static DEVICE_ATTR_RO(field);
>  
>  /* for more info, see Documentation/ABI/testing/sysfs-bus-rpmsg */
>  rpmsg_show_attr(name, id.name, "%s\n");
> @@ -345,15 +346,17 @@ static ssize_t modalias_show(struct device *dev,
>  
>  	return sprintf(buf, RPMSG_DEVICE_MODALIAS_FMT "\n", rpdev->id.name);
>  }
> -
> -static struct device_attribute rpmsg_dev_attrs[] = {
> -	__ATTR_RO(name),
> -	__ATTR_RO(modalias),
> -	__ATTR_RO(dst),
> -	__ATTR_RO(src),
> -	__ATTR_RO(announce),
> -	__ATTR_NULL
> +static DEVICE_ATTR_RO(modalias);
> +
> +static struct attribute *rpmsg_dev_attrs[] = {
> +	&dev_attr_name.attr,
> +	&dev_attr_modalias.attr,
> +	&dev_attr_dst.attr,
> +	&dev_attr_src.attr,
> +	&dev_attr_announce.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(rpmsg_dev);
>  
>  /* rpmsg devices and drivers are matched using the service name */
>  static inline int rpmsg_id_match(const struct rpmsg_device *rpdev,
> @@ -455,7 +458,7 @@ static int rpmsg_dev_remove(struct device *dev)
>  static struct bus_type rpmsg_bus = {
>  	.name		= "rpmsg",
>  	.match		= rpmsg_dev_match,
> -	.dev_attrs	= rpmsg_dev_attrs,
> +	.dev_groups	= rpmsg_dev_groups,
>  	.uevent		= rpmsg_uevent,
>  	.probe		= rpmsg_dev_probe,
>  	.remove		= rpmsg_dev_remove,
> -- 
> 2.13.0
> 

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

* Re: [PATCH 14/16] sparc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 14/16] sparc: vio: " Greg Kroah-Hartman
@ 2017-06-06 19:36   ` David Miller
  0 siblings, 0 replies; 39+ messages in thread
From: David Miller @ 2017-06-06 19:36 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, sparclinux

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: Tue,  6 Jun 2017 21:22:19 +0200

> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: <sparclinux@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: David S. Miller <davem@davemloft.net>

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

* Re: [PATCH 08/16] powerpc: ps3: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 08/16] powerpc: ps3: " Greg Kroah-Hartman
@ 2017-06-06 21:33   ` Geoff Levand
  2017-06-07 10:17   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Geoff Levand @ 2017-06-06 21:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, linuxppc-dev

On 06/06/2017 12:22 PM, Greg Kroah-Hartman wrote:
> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.

>  arch/powerpc/platforms/ps3/system-bus.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)

Seems OK.

-Geoff

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

* Re: [PATCH 13/16] hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 13/16] hid: intel-ish-hid: " Greg Kroah-Hartman
@ 2017-06-06 22:33   ` Srinivas Pandruvada
  2017-06-07 13:40   ` Jiri Kosina
  1 sibling, 0 replies; 39+ messages in thread
From: Srinivas Pandruvada @ 2017-06-06 22:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Jiri Kosina, Benjamin Tissoires, Wei Yongjun, Bhumika Goyal,
	Rasmus Villemoes, linux-input

On Tue, 2017-06-06 at 21:22 +0200, Greg Kroah-Hartman wrote:
> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: Wei Yongjun <weiyj.lk@gmail.com>
> Cc: Bhumika Goyal <bhumirks@gmail.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: <linux-input@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>

> ---
>  drivers/hid/intel-ish-hid/ishtp/bus.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/hid/intel-ish-hid/ishtp/bus.c
> b/drivers/hid/intel-ish-hid/ishtp/bus.c
> index 5f382fedc2ab..f272cdd9bd55 100644
> --- a/drivers/hid/intel-ish-hid/ishtp/bus.c
> +++ b/drivers/hid/intel-ish-hid/ishtp/bus.c
> @@ -321,11 +321,13 @@ static ssize_t modalias_show(struct device
> *dev, struct device_attribute *a,
>  	len = snprintf(buf, PAGE_SIZE, "ishtp:%s\n", dev_name(dev));
>  	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
>  }
> +static DEVICE_ATTR_RO(modalias);
>  
> -static struct device_attribute ishtp_cl_dev_attrs[] = {
> -	__ATTR_RO(modalias),
> -	__ATTR_NULL,
> +static struct attribute *ishtp_cl_dev_attrs[] = {
> +	&dev_attr_modalias.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(ishtp_cl_dev);
>  
>  static int ishtp_cl_uevent(struct device *dev, struct
> kobj_uevent_env *env)
>  {
> @@ -346,7 +348,7 @@ static const struct dev_pm_ops
> ishtp_cl_bus_dev_pm_ops = {
>  
>  static struct bus_type ishtp_cl_bus_type = {
>  	.name		= "ishtp",
> -	.dev_attrs	= ishtp_cl_dev_attrs,
> +	.dev_groups	= ishtp_cl_dev_groups,
>  	.probe		= ishtp_cl_device_probe,
>  	.remove		= ishtp_cl_device_remove,
>  	.pm		= &ishtp_cl_bus_dev_pm_ops,

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

* Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:30   ` Greg Kroah-Hartman
@ 2017-06-06 23:04     ` Benjamin Herrenschmidt
  2017-06-07  5:45       ` Greg Kroah-Hartman
  2017-06-07  8:58     ` [PATCH 10/16 v2] " Greg Kroah-Hartman
  1 sibling, 1 reply; 39+ messages in thread
From: Benjamin Herrenschmidt @ 2017-06-06 23:04 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Paul Mackerras, Michael Ellerman, Vineet Gupta, Bart Van Assche,
	Robin Murphy, Joerg Roedel, Johan Hovold, Alexey Kardashevskiy,
	Krzysztof Kozlowski, linuxppc-dev

On Tue, 2017-06-06 at 21:30 +0200, Greg Kroah-Hartman wrote:
> >   
> >   static struct device_attribute vio_dev_attrs[] = {
> >        __ATTR_RO(name),
> > @@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
> >        __ATTR_RO(modalias),
> >        __ATTR_NULL
> >   };
> > +static struct attribute *vio_dev_attrs[] = {
> 
> Hm, this feels wrong, odd that 0-day passed it.  I should be deleting
> the above vio_dev_attrs field as well.  Is powerpc really a dead
> platform?  :)

Haha, not yet no, and the above is actually still quite actively
in use as it's part of our hypervisor virtual IO infrastructure.

Cheers,
Ben.

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

* Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 23:04     ` Benjamin Herrenschmidt
@ 2017-06-07  5:45       ` Greg Kroah-Hartman
  2017-06-07  5:56         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-07  5:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: linux-kernel, Paul Mackerras, Michael Ellerman, Vineet Gupta,
	Bart Van Assche, Robin Murphy, Joerg Roedel, Johan Hovold,
	Alexey Kardashevskiy, Krzysztof Kozlowski, linuxppc-dev

On Wed, Jun 07, 2017 at 09:04:41AM +1000, Benjamin Herrenschmidt wrote:
> On Tue, 2017-06-06 at 21:30 +0200, Greg Kroah-Hartman wrote:
> > >   
> > >   static struct device_attribute vio_dev_attrs[] = {
> > >        __ATTR_RO(name),
> > > @@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
> > >        __ATTR_RO(modalias),
> > >        __ATTR_NULL
> > >   };
> > > +static struct attribute *vio_dev_attrs[] = {
> > 
> > Hm, this feels wrong, odd that 0-day passed it.  I should be deleting
> > the above vio_dev_attrs field as well.  Is powerpc really a dead
> > platform?  :)
> 
> Haha, not yet no, and the above is actually still quite actively
> in use as it's part of our hypervisor virtual IO infrastructure.

Ok, let me fix this, right after I emailed 0-day sent me the build error :)

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

* Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-07  5:45       ` Greg Kroah-Hartman
@ 2017-06-07  5:56         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 39+ messages in thread
From: Benjamin Herrenschmidt @ 2017-06-07  5:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Paul Mackerras, Michael Ellerman, Vineet Gupta,
	Bart Van Assche, Robin Murphy, Joerg Roedel, Johan Hovold,
	Alexey Kardashevskiy, Krzysztof Kozlowski, linuxppc-dev

On Wed, 2017-06-07 at 07:45 +0200, Greg Kroah-Hartman wrote:
> On Wed, Jun 07, 2017 at 09:04:41AM +1000, Benjamin Herrenschmidt wrote:
> > On Tue, 2017-06-06 at 21:30 +0200, Greg Kroah-Hartman wrote:
> > > >   
> > > >   static struct device_attribute vio_dev_attrs[] = {
> > > >        __ATTR_RO(name),
> > > > @@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
> > > >        __ATTR_RO(modalias),
> > > >        __ATTR_NULL
> > > >   };
> > > > +static struct attribute *vio_dev_attrs[] = {
> > > 
> > > Hm, this feels wrong, odd that 0-day passed it.  I should be deleting
> > > the above vio_dev_attrs field as well.  Is powerpc really a dead
> > > platform?  :)
> > 
> > Haha, not yet no, and the above is actually still quite actively
> > in use as it's part of our hypervisor virtual IO infrastructure.
> 
> Ok, let me fix this, right after I emailed 0-day sent me the build error :)

Thanks !

Cheers,
Ben.

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

* [PATCH 10/16 v2] powerpc: vio: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:30   ` Greg Kroah-Hartman
  2017-06-06 23:04     ` Benjamin Herrenschmidt
@ 2017-06-07  8:58     ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-07  8:58 UTC (permalink / raw)
  To: linux-kernel
  Cc: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

The dev_attrs field has long been "depreciated" and is finally being
removed, so move the driver to use the "correct" dev_groups field
instead for struct bus_type.

Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Vineet Gupta <vgupta@synopsys.com>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Johan Hovold <johan@kernel.org>
Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Cc: <linuxppc-dev@lists.ozlabs.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

v2 - actually remove the old attribute list

 arch/powerpc/platforms/pseries/vio.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 28b09fd797ec..b4f679e3ca3a 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -1537,6 +1537,7 @@ static ssize_t name_show(struct device *dev,
 {
 	return sprintf(buf, "%s\n", to_vio_dev(dev)->name);
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t devspec_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
@@ -1545,6 +1546,7 @@ static ssize_t devspec_show(struct device *dev,
 
 	return sprintf(buf, "%s\n", of_node_full_name(of_node));
 }
+static DEVICE_ATTR_RO(devspec);
 
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -1566,13 +1568,15 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 
 	return sprintf(buf, "vio:T%sS%s\n", vio_dev->type, cp);
 }
+static DEVICE_ATTR_RO(modalias);
 
-static struct device_attribute vio_dev_attrs[] = {
-	__ATTR_RO(name),
-	__ATTR_RO(devspec),
-	__ATTR_RO(modalias),
-	__ATTR_NULL
+static struct attribute *vio_dev_attrs[] = {
+	&dev_attr_name.attr,
+	&dev_attr_devspec.attr,
+	&dev_attr_modalias.attr,
+	NULL,
 };
+ATTRIBUTE_GROUPS(vio_dev);
 
 void vio_unregister_device(struct vio_dev *viodev)
 {
@@ -1608,7 +1612,7 @@ static int vio_hotplug(struct device *dev, struct kobj_uevent_env *env)
 
 struct bus_type vio_bus_type = {
 	.name = "vio",
-	.dev_attrs = vio_dev_attrs,
+	.dev_groups = vio_dev_groups,
 	.uevent = vio_hotplug,
 	.match = vio_bus_match,
 	.probe = vio_bus_probe,
-- 
2.13.0

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

* Re: [PATCH 08/16] powerpc: ps3: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 08/16] powerpc: ps3: " Greg Kroah-Hartman
  2017-06-06 21:33   ` Geoff Levand
@ 2017-06-07 10:17   ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-07 10:17 UTC (permalink / raw)
  To: linux-kernel
  Cc: Geoff Levand, Benjamin Herrenschmidt, Paul Mackerras,
	Michael Ellerman, linuxppc-dev

On Tue, Jun 06, 2017 at 09:22:13PM +0200, Greg Kroah-Hartman wrote:
> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: Geoff Levand <geoff@infradead.org>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: <linuxppc-dev@lists.ozlabs.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/powerpc/platforms/ps3/system-bus.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/ps3/system-bus.c b/arch/powerpc/platforms/ps3/system-bus.c
> index 2d2e5f80a3d3..3e98b4ea3df9 100644
> --- a/arch/powerpc/platforms/ps3/system-bus.c
> +++ b/arch/powerpc/platforms/ps3/system-bus.c
> @@ -471,11 +471,13 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,
>  
>  	return (len >= PAGE_SIZE) ? (PAGE_SIZE - 1) : len;
>  }
> +static DEVICE_ATTR_RO(modalias);
>  
> -static struct device_attribute ps3_system_bus_dev_attrs[] = {
> -	__ATTR_RO(modalias),
> -	__ATTR_NULL,
> +static struct attribute *ps3_system_bus_dev_attrs[] = {
> +	&dev_attr_modalias.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(ps3_system_bus);

This should be:
ATTRIBUTE_GROUPS(ps3_system_bus_dev);

I've fixed it up and am now running it through 0-day.

thanks,

greg k-h

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

* Re: [PATCH 13/16] hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 13/16] hid: intel-ish-hid: " Greg Kroah-Hartman
  2017-06-06 22:33   ` Srinivas Pandruvada
@ 2017-06-07 13:40   ` Jiri Kosina
  1 sibling, 0 replies; 39+ messages in thread
From: Jiri Kosina @ 2017-06-07 13:40 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Srinivas Pandruvada, Benjamin Tissoires,
	Wei Yongjun, Bhumika Goyal, Rasmus Villemoes, linux-input

On Tue, 6 Jun 2017, Greg Kroah-Hartman wrote:

> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
> 
> Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: Jiri Kosina <jikos@kernel.org>
> Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>
> Cc: Wei Yongjun <weiyj.lk@gmail.com>
> Cc: Bhumika Goyal <bhumirks@gmail.com>
> Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
> Cc: <linux-input@vger.kernel.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Acked-by: Jiri Kosina <jkosina@suse.cz>

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 11/16] powerpc: vio_cmo: " Greg Kroah-Hartman
@ 2017-06-08 13:12   ` Michael Ellerman
  2017-06-08 13:39     ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Michael Ellerman @ 2017-06-08 13:12 UTC (permalink / raw)
  To: Greg Kroah-Hartman, linux-kernel
  Cc: Greg Kroah-Hartman, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> The dev_attrs field has long been "depreciated" and is finally being
> removed, so move the driver to use the "correct" dev_groups field
> instead for struct bus_type.
>
> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Cc: Paul Mackerras <paulus@samba.org>
> Cc: Michael Ellerman <mpe@ellerman.id.au>
> Cc: Vineet Gupta <vgupta@synopsys.com>
> Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> Cc: Robin Murphy <robin.murphy@arm.com>
> Cc: Joerg Roedel <jroedel@suse.de>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> Cc: Krzysztof Kozlowski <krzk@kernel.org>
> Cc: <linuxppc-dev@lists.ozlabs.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
>  1 file changed, 22 insertions(+), 15 deletions(-)

This one needed a bit more work to get building, the incremental diff is
below. We need a forward declaration of name, devspec and modalias,
which is a bit weird, but that's how the code is currently structured.
And there's dev and bus attributes with the same name, so that needed an
added "bus".

I booted v2 of patch 10 and this one and everything looks identical to
upstream.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>

cheers


diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 738196fd7e57..9d5bdb0594ed 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -955,7 +955,7 @@ static ssize_t cmo_##name##_show(struct device *dev,                    \
 	return sprintf(buf, "%lu\n", to_vio_dev(dev)->cmo.name);        \
 }
 
-static ssize_t viodev_cmo_allocs_failed_show(struct device *dev,
+static ssize_t cmo_allocs_failed_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct vio_dev *viodev = to_vio_dev(dev);
@@ -993,9 +993,11 @@ static ssize_t name_show(struct device *, struct device_attribute *, char *);
 static ssize_t devspec_show(struct device *, struct device_attribute *, char *);
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf);
-static DEVICE_ATTR_RO(name);
-static DEVICE_ATTR_RO(devspec);
-static DEVICE_ATTR_RO(modalias);
+
+static struct device_attribute dev_attr_name;
+static struct device_attribute dev_attr_devspec;
+static struct device_attribute dev_attr_modalias;
+
 static DEVICE_ATTR_RO(cmo_entitled);
 static DEVICE_ATTR_RO(cmo_allocated);
 static DEVICE_ATTR_RW(cmo_desired);
@@ -1016,19 +1018,19 @@ ATTRIBUTE_GROUPS(vio_cmo_dev);
 /* sysfs bus functions and data structures for CMO */
 
 #define viobus_cmo_rd_attr(name)                                        \
-static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf)        \
+static ssize_t cmo_bus_##name##_show(struct bus_type *bt, char *buf)    \
 {                                                                       \
 	return sprintf(buf, "%lu\n", vio_cmo.name);                     \
 }                                                                       \
-static BUS_ATTR_RO(cmo_##name)
+static BUS_ATTR_RO(cmo_bus_##name)
 
 #define viobus_cmo_pool_rd_attr(name, var)                              \
 static ssize_t                                                          \
-cmo_##name##_##var##_show(struct bus_type *bt, char *buf)               \
+cmo_bus_##name##_##var##_show(struct bus_type *bt, char *buf)           \
 {                                                                       \
 	return sprintf(buf, "%lu\n", vio_cmo.name.var);                 \
 }                                                                       \
-static BUS_ATTR_RO(cmo_##name##_##var)
+static BUS_ATTR_RO(cmo_bus_##name##_##var)
 
 viobus_cmo_rd_attr(entitled);
 viobus_cmo_rd_attr(spare);
@@ -1039,12 +1041,12 @@ viobus_cmo_pool_rd_attr(reserve, size);
 viobus_cmo_pool_rd_attr(excess, size);
 viobus_cmo_pool_rd_attr(excess, free);
 
-static ssize_t cmo_high_show(struct bus_type *bt, char *buf)
+static ssize_t cmo_bus_high_show(struct bus_type *bt, char *buf)
 {
 	return sprintf(buf, "%lu\n", vio_cmo.high);
 }
 
-static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
+static ssize_t cmo_bus_high_store(struct bus_type *bt, const char *buf,
 			      size_t count)
 {
 	unsigned long flags;
@@ -1055,18 +1057,18 @@ static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
 
 	return count;
 }
-static BUS_ATTR_RW(cmo_high);
+static BUS_ATTR_RW(cmo_bus_high);
 
 static struct attribute *vio_bus_attrs[] = {
-	&bus_attr_cmo_entitled.attr,
-	&bus_attr_cmo_spare.attr,
-	&bus_attr_cmo_min.attr,
-	&bus_attr_cmo_desired.attr,
-	&bus_attr_cmo_curr.attr,
-	&bus_attr_cmo_high.attr,
-	&bus_attr_cmo_reserve_size.attr,
-	&bus_attr_cmo_excess_size.attr,
-	&bus_attr_cmo_excess_free.attr,
+	&bus_attr_cmo_bus_entitled.attr,
+	&bus_attr_cmo_bus_spare.attr,
+	&bus_attr_cmo_bus_min.attr,
+	&bus_attr_cmo_bus_desired.attr,
+	&bus_attr_cmo_bus_curr.attr,
+	&bus_attr_cmo_bus_high.attr,
+	&bus_attr_cmo_bus_reserve_size.attr,
+	&bus_attr_cmo_bus_excess_size.attr,
+	&bus_attr_cmo_bus_excess_free.attr,
 	NULL,
 };
 ATTRIBUTE_GROUPS(vio_bus);

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-08 13:12   ` Michael Ellerman
@ 2017-06-08 13:39     ` Greg Kroah-Hartman
  2017-06-08 22:53       ` Michael Ellerman
  0 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-08 13:39 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > The dev_attrs field has long been "depreciated" and is finally being
> > removed, so move the driver to use the "correct" dev_groups field
> > instead for struct bus_type.
> >
> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> > Cc: Paul Mackerras <paulus@samba.org>
> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> > Cc: Vineet Gupta <vgupta@synopsys.com>
> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> > Cc: Robin Murphy <robin.murphy@arm.com>
> > Cc: Joerg Roedel <jroedel@suse.de>
> > Cc: Johan Hovold <johan@kernel.org>
> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
> > Cc: <linuxppc-dev@lists.ozlabs.org>
> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > ---
> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
> >  1 file changed, 22 insertions(+), 15 deletions(-)
> 
> This one needed a bit more work to get building, the incremental diff is
> below. We need a forward declaration of name, devspec and modalias,
> which is a bit weird, but that's how the code is currently structured.
> And there's dev and bus attributes with the same name, so that needed an
> added "bus".
> 
> I booted v2 of patch 10 and this one and everything looks identical to
> upstream.

Ah, many thanks, this was on my todo list to fix up today.

But you renamed the sysfs files when you added "bus" to the function
names, are you sure you want to do that?  I don't mind, but if you
happen to have userspace tools that look at those files, they just broke
:(

thanks,

greg k-h

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-08 13:39     ` Greg Kroah-Hartman
@ 2017-06-08 22:53       ` Michael Ellerman
  2017-06-09  5:44         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Michael Ellerman @ 2017-06-08 22:53 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
>> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> 
>> > The dev_attrs field has long been "depreciated" and is finally being
>> > removed, so move the driver to use the "correct" dev_groups field
>> > instead for struct bus_type.
>> >
>> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> > Cc: Paul Mackerras <paulus@samba.org>
>> > Cc: Michael Ellerman <mpe@ellerman.id.au>
>> > Cc: Vineet Gupta <vgupta@synopsys.com>
>> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
>> > Cc: Robin Murphy <robin.murphy@arm.com>
>> > Cc: Joerg Roedel <jroedel@suse.de>
>> > Cc: Johan Hovold <johan@kernel.org>
>> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
>> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
>> > Cc: <linuxppc-dev@lists.ozlabs.org>
>> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> > ---
>> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
>> >  1 file changed, 22 insertions(+), 15 deletions(-)
>> 
>> This one needed a bit more work to get building, the incremental diff is
>> below. We need a forward declaration of name, devspec and modalias,
>> which is a bit weird, but that's how the code is currently structured.
>> And there's dev and bus attributes with the same name, so that needed an
>> added "bus".
>> 
>> I booted v2 of patch 10 and this one and everything looks identical to
>> upstream.
>
> Ah, many thanks, this was on my todo list to fix up today.
>
> But you renamed the sysfs files when you added "bus" to the function
> names, are you sure you want to do that?  I don't mind, but if you
> happen to have userspace tools that look at those files, they just broke
> :(

Ugh crap, no that won't work.

I didn't see it when I tested because my machine doesn't have the CMO
feature enabled.

I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
avoid the name clash.

I'll try and get it fixed later today.

cheers

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-08 22:53       ` Michael Ellerman
@ 2017-06-09  5:44         ` Greg Kroah-Hartman
  2017-06-09 11:23           ` Michael Ellerman
  0 siblings, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-09  5:44 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> >> 
> >> > The dev_attrs field has long been "depreciated" and is finally being
> >> > removed, so move the driver to use the "correct" dev_groups field
> >> > instead for struct bus_type.
> >> >
> >> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> > Cc: Paul Mackerras <paulus@samba.org>
> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> >> > Cc: Vineet Gupta <vgupta@synopsys.com>
> >> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> >> > Cc: Robin Murphy <robin.murphy@arm.com>
> >> > Cc: Joerg Roedel <jroedel@suse.de>
> >> > Cc: Johan Hovold <johan@kernel.org>
> >> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> >> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
> >> > Cc: <linuxppc-dev@lists.ozlabs.org>
> >> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> > ---
> >> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
> >> 
> >> This one needed a bit more work to get building, the incremental diff is
> >> below. We need a forward declaration of name, devspec and modalias,
> >> which is a bit weird, but that's how the code is currently structured.
> >> And there's dev and bus attributes with the same name, so that needed an
> >> added "bus".
> >> 
> >> I booted v2 of patch 10 and this one and everything looks identical to
> >> upstream.
> >
> > Ah, many thanks, this was on my todo list to fix up today.
> >
> > But you renamed the sysfs files when you added "bus" to the function
> > names, are you sure you want to do that?  I don't mind, but if you
> > happen to have userspace tools that look at those files, they just broke
> > :(
> 
> Ugh crap, no that won't work.
> 
> I didn't see it when I tested because my machine doesn't have the CMO
> feature enabled.
> 
> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
> avoid the name clash.

Or split it into multiple files, I've solved this that way in the past.
You shouldn't have to "open code" BUS_ATTR_RO().

thanks,

greg k-h

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-09  5:44         ` Greg Kroah-Hartman
@ 2017-06-09 11:23           ` Michael Ellerman
  2017-06-10 12:48             ` Greg Kroah-Hartman
  2017-06-12  6:58             ` Greg Kroah-Hartman
  0 siblings, 2 replies; 39+ messages in thread
From: Michael Ellerman @ 2017-06-09 11:23 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
>> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> 
>> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
>> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> >> 
>> >> > The dev_attrs field has long been "depreciated" and is finally being
>> >> > removed, so move the driver to use the "correct" dev_groups field
>> >> > instead for struct bus_type.
>> >> >
>> >> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> >> > Cc: Paul Mackerras <paulus@samba.org>
>> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
>> >> > Cc: Vineet Gupta <vgupta@synopsys.com>
>> >> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
>> >> > Cc: Robin Murphy <robin.murphy@arm.com>
>> >> > Cc: Joerg Roedel <jroedel@suse.de>
>> >> > Cc: Johan Hovold <johan@kernel.org>
>> >> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
>> >> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
>> >> > Cc: <linuxppc-dev@lists.ozlabs.org>
>> >> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> >> > ---
>> >> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
>> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
>> >> 
>> >> This one needed a bit more work to get building, the incremental diff is
>> >> below. We need a forward declaration of name, devspec and modalias,
>> >> which is a bit weird, but that's how the code is currently structured.
>> >> And there's dev and bus attributes with the same name, so that needed an
>> >> added "bus".
>> >> 
>> >> I booted v2 of patch 10 and this one and everything looks identical to
>> >> upstream.
>> >
>> > Ah, many thanks, this was on my todo list to fix up today.
>> >
>> > But you renamed the sysfs files when you added "bus" to the function
>> > names, are you sure you want to do that?  I don't mind, but if you
>> > happen to have userspace tools that look at those files, they just broke
>> > :(
>> 
>> Ugh crap, no that won't work.
>> 
>> I didn't see it when I tested because my machine doesn't have the CMO
>> feature enabled.
>> 
>> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
>> avoid the name clash.
>
> Or split it into multiple files, I've solved this that way in the past.
> You shouldn't have to "open code" BUS_ATTR_RO().

It just requires one use of __ATTR(), which seems simpler than splitting
the file in two.

Here's a new incremental diff against your patch.

I confirmed none of the cmo names changed, result after is:

./devices/vio/cmo_desired
./devices/vio/cmo_allocated
./devices/vio/cmo_entitled
./devices/vio/cmo_allocs_failed
./devices/vio/71000000/cmo_desired
./devices/vio/71000000/cmo_allocated
./devices/vio/71000000/cmo_entitled
./devices/vio/71000000/cmo_allocs_failed
./devices/vio/30000000/cmo_desired
./devices/vio/30000000/cmo_allocated
./devices/vio/30000000/cmo_entitled
./devices/vio/30000000/cmo_allocs_failed
./devices/vio/2000/cmo_desired
./devices/vio/2000/cmo_allocated
./devices/vio/2000/cmo_entitled
./devices/vio/2000/cmo_allocs_failed
./bus/vio/cmo_high
./bus/vio/cmo_spare
./bus/vio/cmo_reserve_size
./bus/vio/cmo_desired
./bus/vio/cmo_entitled
./bus/vio/cmo_excess_free
./bus/vio/cmo_excess_size
./bus/vio/cmo_min
./bus/vio/cmo_curr


cheers


diff --git a/arch/powerpc/platforms/pseries/vio.c b/arch/powerpc/platforms/pseries/vio.c
index 738196fd7e57..117beb9e8786 100644
--- a/arch/powerpc/platforms/pseries/vio.c
+++ b/arch/powerpc/platforms/pseries/vio.c
@@ -955,7 +955,7 @@ static ssize_t cmo_##name##_show(struct device *dev,                    \
 	return sprintf(buf, "%lu\n", to_vio_dev(dev)->cmo.name);        \
 }
 
-static ssize_t viodev_cmo_allocs_failed_show(struct device *dev,
+static ssize_t cmo_allocs_failed_show(struct device *dev,
 		struct device_attribute *attr, char *buf)
 {
 	struct vio_dev *viodev = to_vio_dev(dev);
@@ -993,9 +993,11 @@ static ssize_t name_show(struct device *, struct device_attribute *, char *);
 static ssize_t devspec_show(struct device *, struct device_attribute *, char *);
 static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
 			     char *buf);
-static DEVICE_ATTR_RO(name);
-static DEVICE_ATTR_RO(devspec);
-static DEVICE_ATTR_RO(modalias);
+
+static struct device_attribute dev_attr_name;
+static struct device_attribute dev_attr_devspec;
+static struct device_attribute dev_attr_modalias;
+
 static DEVICE_ATTR_RO(cmo_entitled);
 static DEVICE_ATTR_RO(cmo_allocated);
 static DEVICE_ATTR_RW(cmo_desired);
@@ -1016,11 +1018,12 @@ ATTRIBUTE_GROUPS(vio_cmo_dev);
 /* sysfs bus functions and data structures for CMO */
 
 #define viobus_cmo_rd_attr(name)                                        \
-static ssize_t cmo_##name##_show(struct bus_type *bt, char *buf)        \
+static ssize_t cmo_bus_##name##_show(struct bus_type *bt, char *buf)    \
 {                                                                       \
 	return sprintf(buf, "%lu\n", vio_cmo.name);                     \
 }                                                                       \
-static BUS_ATTR_RO(cmo_##name)
+static struct bus_attribute bus_attr_cmo_bus_##name =			\
+	__ATTR(cmo_##name, S_IRUGO, cmo_bus_##name##_show, NULL)
 
 #define viobus_cmo_pool_rd_attr(name, var)                              \
 static ssize_t                                                          \
@@ -1058,11 +1061,11 @@ static ssize_t cmo_high_store(struct bus_type *bt, const char *buf,
 static BUS_ATTR_RW(cmo_high);
 
 static struct attribute *vio_bus_attrs[] = {
-	&bus_attr_cmo_entitled.attr,
-	&bus_attr_cmo_spare.attr,
-	&bus_attr_cmo_min.attr,
-	&bus_attr_cmo_desired.attr,
-	&bus_attr_cmo_curr.attr,
+	&bus_attr_cmo_bus_entitled.attr,
+	&bus_attr_cmo_bus_spare.attr,
+	&bus_attr_cmo_bus_min.attr,
+	&bus_attr_cmo_bus_desired.attr,
+	&bus_attr_cmo_bus_curr.attr,
 	&bus_attr_cmo_high.attr,
 	&bus_attr_cmo_reserve_size.attr,
 	&bus_attr_cmo_excess_size.attr,

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

* Re: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
  2017-06-06 19:22 ` [PATCH 15/16] tty: serdev: " Greg Kroah-Hartman
@ 2017-06-09 23:56   ` Stephen Rothwell
  2017-06-10  0:01     ` Stephen Rothwell
  0 siblings, 1 reply; 39+ messages in thread
From: Stephen Rothwell @ 2017-06-09 23:56 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rob Herring, Jiri Slaby

Hi Greg,

On Tue,  6 Jun 2017 21:22:20 +0200 Greg Kroah-Hartman <gregkh@linuxfoundation.org> wrote:
>
> -static struct device_attribute serdev_device_attrs[] = {
> -	__ATTR_RO(modalias),
> -	__ATTR_NULL
> +static struct attribute *serdev_device_attrs[] = {
                            ^^^^^^^^^^^^^^^^^^^
Should have been "serdev_device_groups"

> +	&dev_attr_modalias.attr,
> +	NULL,
>  };
> +ATTRIBUTE_GROUPS(serdev_device);
>  
>  static struct bus_type serdev_bus_type = {
>  	.name		= "serial",
> @@ -262,7 +264,7 @@ static struct bus_type serdev_bus_type = {
>  	.probe		= serdev_drv_probe,
>  	.remove		= serdev_drv_remove,
>  	.uevent		= serdev_uevent,
> -	.dev_attrs	= serdev_device_attrs,
> +	.dev_groups	= serdev_device_groups,
>  };
-- 
Cheers,
Stephen Rothwell

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

* Re: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
  2017-06-09 23:56   ` Stephen Rothwell
@ 2017-06-10  0:01     ` Stephen Rothwell
  2017-06-10 11:58       ` Greg Kroah-Hartman
  0 siblings, 1 reply; 39+ messages in thread
From: Stephen Rothwell @ 2017-06-10  0:01 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Rob Herring, Jiri Slaby

Hi Greg,

On Sat, 10 Jun 2017 09:56:49 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
>
> > +static struct attribute *serdev_device_attrs[] = {  
>                             ^^^^^^^^^^^^^^^^^^^
> Should have been "serdev_device_groups"

Sorry, my mistake.

> > +	&dev_attr_modalias.attr,
> > +	NULL,
> >  };
> > +ATTRIBUTE_GROUPS(serdev_device);

I really hate macros that create symbols by concatenating parts. :-(

-- 
Cheers,
Stephen Rothwell

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

* Re: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
  2017-06-10  0:01     ` Stephen Rothwell
@ 2017-06-10 11:58       ` Greg Kroah-Hartman
  0 siblings, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-10 11:58 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-kernel, Rob Herring, Jiri Slaby

On Sat, Jun 10, 2017 at 10:01:22AM +1000, Stephen Rothwell wrote:
> Hi Greg,
> 
> On Sat, 10 Jun 2017 09:56:49 +1000 Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> >
> > > +static struct attribute *serdev_device_attrs[] = {  
> >                             ^^^^^^^^^^^^^^^^^^^
> > Should have been "serdev_device_groups"
> 
> Sorry, my mistake.
> 
> > > +	&dev_attr_modalias.attr,
> > > +	NULL,
> > >  };
> > > +ATTRIBUTE_GROUPS(serdev_device);
> 
> I really hate macros that create symbols by concatenating parts. :-(

I totally agree, but it's the only way I could come up with at the time
to make this type of macro to simplify a lot of boiler-plate code.

sorry,

greg k-h

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-09 11:23           ` Michael Ellerman
@ 2017-06-10 12:48             ` Greg Kroah-Hartman
  2017-06-12  6:58             ` Greg Kroah-Hartman
  1 sibling, 0 replies; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-10 12:48 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

On Fri, Jun 09, 2017 at 09:23:10PM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> >> 
> >> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
> >> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> >> >> 
> >> >> > The dev_attrs field has long been "depreciated" and is finally being
> >> >> > removed, so move the driver to use the "correct" dev_groups field
> >> >> > instead for struct bus_type.
> >> >> >
> >> >> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> >> > Cc: Paul Mackerras <paulus@samba.org>
> >> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> >> >> > Cc: Vineet Gupta <vgupta@synopsys.com>
> >> >> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> >> >> > Cc: Robin Murphy <robin.murphy@arm.com>
> >> >> > Cc: Joerg Roedel <jroedel@suse.de>
> >> >> > Cc: Johan Hovold <johan@kernel.org>
> >> >> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> >> >> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
> >> >> > Cc: <linuxppc-dev@lists.ozlabs.org>
> >> >> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> >> > ---
> >> >> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
> >> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
> >> >> 
> >> >> This one needed a bit more work to get building, the incremental diff is
> >> >> below. We need a forward declaration of name, devspec and modalias,
> >> >> which is a bit weird, but that's how the code is currently structured.
> >> >> And there's dev and bus attributes with the same name, so that needed an
> >> >> added "bus".
> >> >> 
> >> >> I booted v2 of patch 10 and this one and everything looks identical to
> >> >> upstream.
> >> >
> >> > Ah, many thanks, this was on my todo list to fix up today.
> >> >
> >> > But you renamed the sysfs files when you added "bus" to the function
> >> > names, are you sure you want to do that?  I don't mind, but if you
> >> > happen to have userspace tools that look at those files, they just broke
> >> > :(
> >> 
> >> Ugh crap, no that won't work.
> >> 
> >> I didn't see it when I tested because my machine doesn't have the CMO
> >> feature enabled.
> >> 
> >> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
> >> avoid the name clash.
> >
> > Or split it into multiple files, I've solved this that way in the past.
> > You shouldn't have to "open code" BUS_ATTR_RO().
> 
> It just requires one use of __ATTR(), which seems simpler than splitting
> the file in two.

Ah, yes, nice work, thanks.  If you wanted to be really "tricky", you
could just use __ATTR_RO() there, but I'll leave it as-is :)

Let's see what 0-day says about this version.

Many thanks for working on this, much appreciated.

greg k-h

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-09 11:23           ` Michael Ellerman
  2017-06-10 12:48             ` Greg Kroah-Hartman
@ 2017-06-12  6:58             ` Greg Kroah-Hartman
  2017-06-13 10:09               ` Michael Ellerman
  1 sibling, 1 reply; 39+ messages in thread
From: Greg Kroah-Hartman @ 2017-06-12  6:58 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

On Fri, Jun 09, 2017 at 09:23:10PM +1000, Michael Ellerman wrote:
> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> 
> > On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> >> 
> >> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
> >> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
> >> >> 
> >> >> > The dev_attrs field has long been "depreciated" and is finally being
> >> >> > removed, so move the driver to use the "correct" dev_groups field
> >> >> > instead for struct bus_type.
> >> >> >
> >> >> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> >> >> > Cc: Paul Mackerras <paulus@samba.org>
> >> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
> >> >> > Cc: Vineet Gupta <vgupta@synopsys.com>
> >> >> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
> >> >> > Cc: Robin Murphy <robin.murphy@arm.com>
> >> >> > Cc: Joerg Roedel <jroedel@suse.de>
> >> >> > Cc: Johan Hovold <johan@kernel.org>
> >> >> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
> >> >> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
> >> >> > Cc: <linuxppc-dev@lists.ozlabs.org>
> >> >> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> >> >> > ---
> >> >> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
> >> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
> >> >> 
> >> >> This one needed a bit more work to get building, the incremental diff is
> >> >> below. We need a forward declaration of name, devspec and modalias,
> >> >> which is a bit weird, but that's how the code is currently structured.
> >> >> And there's dev and bus attributes with the same name, so that needed an
> >> >> added "bus".
> >> >> 
> >> >> I booted v2 of patch 10 and this one and everything looks identical to
> >> >> upstream.
> >> >
> >> > Ah, many thanks, this was on my todo list to fix up today.
> >> >
> >> > But you renamed the sysfs files when you added "bus" to the function
> >> > names, are you sure you want to do that?  I don't mind, but if you
> >> > happen to have userspace tools that look at those files, they just broke
> >> > :(
> >> 
> >> Ugh crap, no that won't work.
> >> 
> >> I didn't see it when I tested because my machine doesn't have the CMO
> >> feature enabled.
> >> 
> >> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
> >> avoid the name clash.
> >
> > Or split it into multiple files, I've solved this that way in the past.
> > You shouldn't have to "open code" BUS_ATTR_RO().
> 
> It just requires one use of __ATTR(), which seems simpler than splitting
> the file in two.
> 
> Here's a new incremental diff against your patch.
> 
> I confirmed none of the cmo names changed, result after is:
> 
> ./devices/vio/cmo_desired
> ./devices/vio/cmo_allocated
> ./devices/vio/cmo_entitled
> ./devices/vio/cmo_allocs_failed
> ./devices/vio/71000000/cmo_desired
> ./devices/vio/71000000/cmo_allocated
> ./devices/vio/71000000/cmo_entitled
> ./devices/vio/71000000/cmo_allocs_failed
> ./devices/vio/30000000/cmo_desired
> ./devices/vio/30000000/cmo_allocated
> ./devices/vio/30000000/cmo_entitled
> ./devices/vio/30000000/cmo_allocs_failed
> ./devices/vio/2000/cmo_desired
> ./devices/vio/2000/cmo_allocated
> ./devices/vio/2000/cmo_entitled
> ./devices/vio/2000/cmo_allocs_failed
> ./bus/vio/cmo_high
> ./bus/vio/cmo_spare
> ./bus/vio/cmo_reserve_size
> ./bus/vio/cmo_desired
> ./bus/vio/cmo_entitled
> ./bus/vio/cmo_excess_free
> ./bus/vio/cmo_excess_size
> ./bus/vio/cmo_min
> ./bus/vio/cmo_curr

Thanks for this, it seems to have passed all of the 0-day testing.  I'll
go apply it to my "real" tree now, thanks again for the help.

greg k-h

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

* Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
  2017-06-12  6:58             ` Greg Kroah-Hartman
@ 2017-06-13 10:09               ` Michael Ellerman
  0 siblings, 0 replies; 39+ messages in thread
From: Michael Ellerman @ 2017-06-13 10:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel, Benjamin Herrenschmidt, Paul Mackerras,
	Vineet Gupta, Bart Van Assche, Robin Murphy, Joerg Roedel,
	Johan Hovold, Alexey Kardashevskiy, Krzysztof Kozlowski,
	linuxppc-dev

Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:

> On Fri, Jun 09, 2017 at 09:23:10PM +1000, Michael Ellerman wrote:
>> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> 
>> > On Fri, Jun 09, 2017 at 08:53:22AM +1000, Michael Ellerman wrote:
>> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> >> 
>> >> > On Thu, Jun 08, 2017 at 11:12:10PM +1000, Michael Ellerman wrote:
>> >> >> Greg Kroah-Hartman <gregkh@linuxfoundation.org> writes:
>> >> >> 
>> >> >> > The dev_attrs field has long been "depreciated" and is finally being
>> >> >> > removed, so move the driver to use the "correct" dev_groups field
>> >> >> > instead for struct bus_type.
>> >> >> >
>> >> >> > Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> >> >> > Cc: Paul Mackerras <paulus@samba.org>
>> >> >> > Cc: Michael Ellerman <mpe@ellerman.id.au>
>> >> >> > Cc: Vineet Gupta <vgupta@synopsys.com>
>> >> >> > Cc: Bart Van Assche <bart.vanassche@sandisk.com>
>> >> >> > Cc: Robin Murphy <robin.murphy@arm.com>
>> >> >> > Cc: Joerg Roedel <jroedel@suse.de>
>> >> >> > Cc: Johan Hovold <johan@kernel.org>
>> >> >> > Cc: Alexey Kardashevskiy <aik@ozlabs.ru>
>> >> >> > Cc: Krzysztof Kozlowski <krzk@kernel.org>
>> >> >> > Cc: <linuxppc-dev@lists.ozlabs.org>
>> >> >> > Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> >> >> > ---
>> >> >> >  arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++---------------
>> >> >> >  1 file changed, 22 insertions(+), 15 deletions(-)
>> >> >> 
>> >> >> This one needed a bit more work to get building, the incremental diff is
>> >> >> below. We need a forward declaration of name, devspec and modalias,
>> >> >> which is a bit weird, but that's how the code is currently structured.
>> >> >> And there's dev and bus attributes with the same name, so that needed an
>> >> >> added "bus".
>> >> >> 
>> >> >> I booted v2 of patch 10 and this one and everything looks identical to
>> >> >> upstream.
>> >> >
>> >> > Ah, many thanks, this was on my todo list to fix up today.
>> >> >
>> >> > But you renamed the sysfs files when you added "bus" to the function
>> >> > names, are you sure you want to do that?  I don't mind, but if you
>> >> > happen to have userspace tools that look at those files, they just broke
>> >> > :(
>> >> 
>> >> Ugh crap, no that won't work.
>> >> 
>> >> I didn't see it when I tested because my machine doesn't have the CMO
>> >> feature enabled.
>> >> 
>> >> I guess we have to open code some of the BUS_ATTR_RO() etc. so we can
>> >> avoid the name clash.
>> >
>> > Or split it into multiple files, I've solved this that way in the past.
>> > You shouldn't have to "open code" BUS_ATTR_RO().
>> 
>> It just requires one use of __ATTR(), which seems simpler than splitting
>> the file in two.
>> 
>> Here's a new incremental diff against your patch.
>> 
>> I confirmed none of the cmo names changed, result after is:
>> 
>> ./devices/vio/cmo_desired
>> ./devices/vio/cmo_allocated
>> ./devices/vio/cmo_entitled
>> ./devices/vio/cmo_allocs_failed
>> ./devices/vio/71000000/cmo_desired
>> ./devices/vio/71000000/cmo_allocated
>> ./devices/vio/71000000/cmo_entitled
>> ./devices/vio/71000000/cmo_allocs_failed
>> ./devices/vio/30000000/cmo_desired
>> ./devices/vio/30000000/cmo_allocated
>> ./devices/vio/30000000/cmo_entitled
>> ./devices/vio/30000000/cmo_allocs_failed
>> ./devices/vio/2000/cmo_desired
>> ./devices/vio/2000/cmo_allocated
>> ./devices/vio/2000/cmo_entitled
>> ./devices/vio/2000/cmo_allocs_failed
>> ./bus/vio/cmo_high
>> ./bus/vio/cmo_spare
>> ./bus/vio/cmo_reserve_size
>> ./bus/vio/cmo_desired
>> ./bus/vio/cmo_entitled
>> ./bus/vio/cmo_excess_free
>> ./bus/vio/cmo_excess_size
>> ./bus/vio/cmo_min
>> ./bus/vio/cmo_curr
>
> Thanks for this, it seems to have passed all of the 0-day testing.  I'll
> go apply it to my "real" tree now, thanks again for the help.

No worries. It'll get some more build & boot testing from my CI once it's
in linux-next.

cheers

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

end of thread, other threads:[~2017-06-13 10:09 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-06 19:22 [PATCH 00/16] Driver core: remove bus_type.dev_attrs Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 01/16] arm: ecard: use dev_groups and not dev_attrs for bus_type Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 02/16] mips: sgi-ip22: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 03/16] parisc: parisc_bus_type: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 04/16] amba: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 05/16] rpmsg: " Greg Kroah-Hartman
2017-06-06 19:33   ` Bjorn Andersson
2017-06-06 19:22 ` [PATCH 06/16] sh: superhyway: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 07/16] macintosh: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 08/16] powerpc: ps3: " Greg Kroah-Hartman
2017-06-06 21:33   ` Geoff Levand
2017-06-07 10:17   ` Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 09/16] powerpc: ibmebus: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 10/16] powerpc: vio: " Greg Kroah-Hartman
2017-06-06 19:30   ` Greg Kroah-Hartman
2017-06-06 23:04     ` Benjamin Herrenschmidt
2017-06-07  5:45       ` Greg Kroah-Hartman
2017-06-07  5:56         ` Benjamin Herrenschmidt
2017-06-07  8:58     ` [PATCH 10/16 v2] " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 11/16] powerpc: vio_cmo: " Greg Kroah-Hartman
2017-06-08 13:12   ` Michael Ellerman
2017-06-08 13:39     ` Greg Kroah-Hartman
2017-06-08 22:53       ` Michael Ellerman
2017-06-09  5:44         ` Greg Kroah-Hartman
2017-06-09 11:23           ` Michael Ellerman
2017-06-10 12:48             ` Greg Kroah-Hartman
2017-06-12  6:58             ` Greg Kroah-Hartman
2017-06-13 10:09               ` Michael Ellerman
2017-06-06 19:22 ` [PATCH 12/16] hwtracing: intel_th: " Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 13/16] hid: intel-ish-hid: " Greg Kroah-Hartman
2017-06-06 22:33   ` Srinivas Pandruvada
2017-06-07 13:40   ` Jiri Kosina
2017-06-06 19:22 ` [PATCH 14/16] sparc: vio: " Greg Kroah-Hartman
2017-06-06 19:36   ` David Miller
2017-06-06 19:22 ` [PATCH 15/16] tty: serdev: " Greg Kroah-Hartman
2017-06-09 23:56   ` Stephen Rothwell
2017-06-10  0:01     ` Stephen Rothwell
2017-06-10 11:58       ` Greg Kroah-Hartman
2017-06-06 19:22 ` [PATCH 16/16] driver-core: remove struct bus_type.dev_attrs Greg Kroah-Hartman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).