zorro: stop creating attributes by hand

Instead of creating attributes one by one, define attribute_group array
and attach it to bus->dev_groups, so that all needed attributes are created
automatically when a new device is registered on the bus.

Also switch to using standard DEVICE_ATTR_RO() macros.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Dmitry Torokhov
2017-02-14 12:24:09 -08:00
committed by Greg Kroah-Hartman
parent a553910fba
commit 87e715deb8
4 changed files with 50 additions and 47 deletions

View File

@@ -14,6 +14,8 @@
#include <linux/module.h>
#include <linux/zorro.h>
#include "zorro.h"
/**
* zorro_match_device - Tell if a Zorro device structure has a matching
@@ -161,12 +163,13 @@ static int zorro_uevent(struct device *dev, struct kobj_uevent_env *env)
}
struct bus_type zorro_bus_type = {
.name = "zorro",
.dev_name = "zorro",
.match = zorro_bus_match,
.uevent = zorro_uevent,
.probe = zorro_device_probe,
.remove = zorro_device_remove,
.name = "zorro",
.dev_name = "zorro",
.dev_groups = zorro_device_attribute_groups,
.match = zorro_bus_match,
.uevent = zorro_uevent,
.probe = zorro_device_probe,
.remove = zorro_device_remove,
};
EXPORT_SYMBOL(zorro_bus_type);