Driver core: remove bus_type.dev_attrs
Subsystems (19)
Greg Kroah-Hartman
maintainerPATCH 1/16 arm: ecard: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/arm/mach-rpc/ecard.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-)
arch/arm/mach-rpc/ecard.c +23 -17
@@ -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_attributereturn 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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 3/16 parisc: parisc_bus_type: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/parisc/kernel/drivers.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
arch/parisc/kernel/drivers.c +13 -10
@@ -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, };
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 5/16 rpmsg: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/rpmsg/rpmsg_core.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)
drivers/rpmsg/rpmsg_core.c +13 -10
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 6/16 sh: superhyway: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- 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(-)
drivers/sh/superhyway/superhyway-sysfs.c +19 -10
@@ -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 , +};
drivers/sh/superhyway/superhyway.c +1 -1
@@ -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,
include/linux/superhyway.h +1 -1
@@ -101,7 +101,7 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *, structint 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 */
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 13/16 hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/hid/intel-ish-hid/ishtp/bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/hid/intel-ish-hid/ishtp/bus.c +6 -4
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 14/16 sparc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/sparc/kernel/vio.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-)
arch/sparc/kernel/vio.c +11 -7
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainercover Driver core: remove bus_type.dev_attrs
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(-)
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 2/16 mips: sgi-ip22: ecard: use dev_groups and not dev_attrs for bus_type
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/mips/sgi-ip22/ip22-gio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/mips/sgi-ip22/ip22-gio.c +10 -6
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 16/16 driver-core: remove struct bus_type.dev_attrs
In reply to Greg Kroah-HartmanNow 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.
--- drivers/base/bus.c | 37 +------------------------------------ include/linux/device.h | 2 -- 2 files changed, 1 insertion(+), 38 deletions(-)
drivers/base/bus.c +1 -36
@@ -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);
include/linux/device.h +0 -2
@@ -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;
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 4/16 amba: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/amba/bus.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/amba/bus.c +12 -13
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 7/16 macintosh: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/macintosh/macio_asic.c | 4 ++-- drivers/macintosh/macio_sysfs.c | 29 +++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 10 deletions(-)
drivers/macintosh/macio_asic.c +2 -2
@@ -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 )
drivers/macintosh/macio_sysfs.c +21 -8
@@ -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 , };
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 8/16 powerpc: ps3: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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(-)
arch/powerpc/platforms/ps3/system-bus.c +6 -4
@@ -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 )
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 9/16 powerpc: ibmebus: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/pseries/ibmebus.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/ibmebus.c +10 -6
@@ -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);
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 10/16 powerpc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/pseries/vio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
arch/powerpc/platforms/pseries/vio.c +11 -1
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 11/16 powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
arch/powerpc/platforms/pseries/vio.c +22 -15
@@ -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 */
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 12/16 hwtracing: intel_th: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/hwtracing/intel_th/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/hwtracing/intel_th/core.c +0 -1
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerPATCH 15/16 tty: serdev: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanThe 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.
--- drivers/tty/serdev/core.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/tty/serdev/core.c +6 -4
@@ -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, };/**
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerRe: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 49 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/powerpc/platforms/pseries/vio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)arch/powerpc/platforms/pseries/vio.c +3
-0@@ -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),
arch/powerpc/platforms/pseries/vio.c static struct device_attribute vio_dev_attrs[] = { · line 1579
Quoted 4 lines
arch/powerpc/platforms/pseries/vio.c +1
-0@@ -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
Re: [PATCH 05/16] rpmsg: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 8 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Ohad Ben-Cohen <[email protected]>Cc Bjorn Andersson <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Thanks for cleaning this up.
Regards,
Bjorn
Quoted 56 lines
--- drivers/rpmsg/rpmsg_core.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-)drivers/rpmsg/rpmsg_core.c +13
-10@@ -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,Signature · 1 line
2.13.0
Re: [PATCH 14/16] sparc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
Date: Tue, 6 Jun 2017 21:22:19 +0200
Quoted 7 lines
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc "David S. Miller" <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Geoff Levand
maintainerRe: [PATCH 08/16] powerpc: ps3: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 6 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.arch/powerpc/platforms/ps3/system-bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
Seems OK.
-Geoff
Re: [PATCH 13/16] hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.
Quoted 8 lines
Cc Srinivas Pandruvada <[email protected]>Cc Jiri Kosina <[email protected]>Cc Benjamin Tissoires <[email protected]>Cc Wei Yongjun <[email protected]>Cc Bhumika Goyal <[email protected]>Cc Rasmus Villemoes <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 38 lines
---
drivers/hid/intel-ish-hid/ishtp/bus.c | 10 ++++++----1 file changed, 6 insertions(+), 4 deletions(-)drivers/hid/intel-ish-hid/ishtp/bus.c +1
-0@@ -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);drivers/hid/intel-ish-hid/ishtp/bus.c +3
-3-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 intishtp_cl_uevent(struct device *dev, struct kobj_uevent_env *env)
{drivers/hid/intel-ish-hid/ishtp/bus.c +0
-0@@ -346,7 +348,7 @@ static const struct dev_pm_ops ishtp_cl_bus_dev_pm_ops = {
static structbus_typeishtp_cl_bus_type= {
.name = "ishtp",drivers/hid/intel-ish-hid/ishtp/bus.c +1
-1- .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,
Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
Quoted 4 lines
static structdevice_attributevio_dev_attrs[] = {__ATTR_RO(name),(quoted diff) +0
-0@@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {
Quoted 8 lines
Quoted 4 lines
arch/powerpc/platforms/pseries/vio.c +0
-0__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_attrsfield 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.
Greg Kroah-Hartman
maintainerRe: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 4 lines · Greg Kroah-Hartman
Quoted 4 lines
static structdevice_attributevio_dev_attrs[] = {__ATTR_RO(name),(quoted diff) +0
-0@@ -1573,6 +1576,13 @@ static struct device_attribute vio_dev_attrs[] = {Quoted 8 lines
Quoted 4 lines
arch/powerpc/platforms/pseries/vio.c +0
-0__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_attrsfield as well. Is powerpc really a dead platform? :)
Quoted 2 lines
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 :)
Re: [PATCH 10/16] powerpc: vio: use dev_groups and not dev_attrs for bus_type
Quoted 15 lines · Greg Kroah-Hartman
Quoted 14 lines · Benjamin Herrenschmidt
Quoted 12 lines · Greg Kroah-Hartman
Quoted 8 lines
static structdevice_attributevio_dev_attrs[] = {__ATTR_RO(name),arch/powerpc/platforms/pseries/vio.c +0
-0@@ -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_attrsfield as well. Is powerpc really a dead platform? :)
Quoted 4 lines
Quoted 2 lines
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.
Greg Kroah-Hartman
maintainerPATCH v2 10/16 powerpc: vio: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
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.
---
v2 - actually remove the old attribute list
arch/powerpc/platforms/pseries/vio.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/powerpc/platforms/pseries/vio.c +10 -6
@@ -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,
Signature · 1 line
2.13.0
Greg Kroah-Hartman
maintainerRe: [PATCH 08/16] powerpc: ps3: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 22 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Geoff Levand <[email protected]>Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- arch/powerpc/platforms/ps3/system-bus.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)arch/powerpc/platforms/ps3/system-bus.c +0
-0@@ -471,11 +471,13 @@ static ssize_t modalias_show(struct device *_dev, struct device_attribute *a,return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; }
arch/powerpc/platforms/ps3/system-bus.c static ssize_t modalias_show(struct device *_dev, struct device_attribute *a, · line 480
Quoted 10 lines
arch/powerpc/platforms/ps3/system-bus.c +5
-3+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
Re: [PATCH 13/16] hid: intel-ish-hid: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 4 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.
Quoted 8 lines
Cc Srinivas Pandruvada <[email protected]>Cc Jiri Kosina <[email protected]>Cc Benjamin Tissoires <[email protected]>Cc Wei Yongjun <[email protected]>Cc Bhumika Goyal <[email protected]>Cc Rasmus Villemoes <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Signature · 2 lines
Jiri Kosina SUSE Labs
Re: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanQuoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Quoted 3 lines
--- 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.
cheers
arch/powerpc/platforms/pseries/vio.c +22 -20
@@ -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);
Greg Kroah-Hartman
maintainerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)
Quoted 8 lines
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
Michael Ellerman
reviewerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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
Greg Kroah-Hartman
maintainerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
Quoted 41 lines · Michael Ellerman
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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 :(
Quoted 7 lines
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
Michael Ellerman
reviewerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
Quoted 44 lines · Greg Kroah-Hartman
Quoted 43 lines · Michael Ellerman
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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.
Quoted 8 lines
Quoted 5 lines
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
arch/powerpc/platforms/pseries/vio.c +14 -11
@@ -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,
Re: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
In reply to Greg Kroah-HartmanHi Greg,
drivers/tty/serdev/core.c static ssize_t modalias_show(struct device *dev, · line 255
Quoted 5 lines · On Tue, 6 Jun 2017 21:22:20 +0200 Greg Kroah-Hartman…
drivers/tty/serdev/core.c +1
-3-static struct device_attribute serdev_device_attrs[] = { -__ATTR_RO (modalias), - __ATTR_NULL +static struct attribute *serdev_device_attrs[] = {
^^^^^^^^^^^^^^^^^^^
Should have been "serdev_device_groups"
Quoted 14 lines
drivers/tty/serdev/core.c +4
-1+ &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, };
Signature · 2 lines
Cheers, Stephen Rothwell
Re: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
Hi Greg,
Quoted 4 lines · On Sat, 10 Jun 2017 09:56:49 +1000 Stephen Rothwell <[email protected]>…
Quoted 2 lines
+static struct attribute *serdev_device_attrs[] = {
^^^^^^^^^^^^^^^^^^^Should have been "
serdev_device_groups"
Sorry, my mistake.
Quoted 4 lines
drivers/tty/serdev/core.c static ssize_t modalias_show(struct device *dev, · line 259
Quoted 4 lines
drivers/tty/serdev/core.c +3
-0+ &dev_attr_modalias.attr, +NULL , }; +ATTRIBUTE_GROUPS (serdev_device);
I really hate macros that create symbols by concatenating parts. :-(
Signature · 2 lines
Cheers, Stephen Rothwell
Greg Kroah-Hartman
maintainerRe: [PATCH 15/16] tty: serdev: use dev_groups and not dev_attrs for bus_type
Quoted 8 lines · Stephen Rothwell
Hi Greg,
Quoted 4 lines · On Sat, 10 Jun 2017 09:56:49 +1000 Stephen Rothwell <[email protected]>…
Quoted 2 lines
+static struct attribute *serdev_device_attrs[] = {
^^^^^^^^^^^^^^^^^^^Should have been "
serdev_device_groups"
Quoted 8 lines
Sorry, my mistake.
Quoted 4 lines
drivers/tty/serdev/core.c static ssize_t modalias_show(struct device *dev, · line 259
Quoted 4 lines
drivers/tty/serdev/core.c +3
-0+ &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
Greg Kroah-Hartman
maintainerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
In reply to Michael EllermanQuoted 49 lines · Michael Ellerman
Quoted 47 lines · Greg Kroah-Hartman
Quoted 46 lines · Michael Ellerman
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
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
Greg Kroah-Hartman
maintainerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
In reply to Michael EllermanQuoted 79 lines · Michael Ellerman
Quoted 44 lines · Greg Kroah-Hartman
Quoted 43 lines · Michael Ellerman
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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.
Quoted 8 lines
Quoted 5 lines
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
Quoted 8 lines
./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
Michael Ellerman
reviewerRe: [PATCH 11/16] powerpc: vio_cmo: use dev_groups and not dev_attrs for bus_type
Quoted 89 lines · Greg Kroah-Hartman
Quoted 79 lines · Michael Ellerman
Quoted 44 lines · Greg Kroah-Hartman
Quoted 43 lines · Michael Ellerman
Quoted 32 lines · Greg Kroah-Hartman
Quoted 22 lines · Michael Ellerman
Quoted 16 lines · Greg Kroah-Hartman
The
dev_attrsfield has long been "depreciated" and is finally being removed, so move the driver to use the "correct"dev_groupsfield instead for structbus_type.Cc Benjamin Herrenschmidt <[email protected]>Cc Paul Mackerras <[email protected]>Cc Michael Ellerman <[email protected]>Cc Vineet Gupta <[email protected]>Cc Bart Van Assche <[email protected]>Cc Robin Murphy <[email protected]>Cc Joerg Roedel <[email protected]>Cc Johan Hovold <[email protected]>Cc Alexey Kardashevskiy <[email protected]>Cc Krzysztof Kozlowski <[email protected]>Cc <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Quoted 3 lines
--- arch/powerpc/platforms/pseries/vio.c | 37 +++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-)Quoted 8 lines
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.
Quoted 6 lines
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.
Quoted 8 lines
Quoted 5 lines
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_highQuoted 8 lines
./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
Quoted 2 lines
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