“46a82b2d5591335277ed2930611f6acb4ce654ed”上不存在“arch/x86/include/asm/pgtable-3level.h”
提交 459d7ed8 编写于 作者: G Geert Uytterhoeven 提交者: Jonathan Corbet

docs: driver-model: device: Add ATTRIBUTE_GROUPS() example

Add a paragraph about the ATTRIBUTE_GROUPS() helper macro, and use it in
the example.  Retain the old description, as it is still useful in case
of multiple groups.  Change the names of the group(s) structures, to
match the ATTRIBUTE_GROUPS() macro.
Signed-off-by: NGeert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://lore.kernel.org/r/20210303133845.3939403-3-geert+renesas@glider.beSigned-off-by: NJonathan Corbet <corbet@lwn.net>
上级 d944f0b1
...@@ -82,19 +82,24 @@ organized as follows into a group:: ...@@ -82,19 +82,24 @@ organized as follows into a group::
NULL, NULL,
}; };
static struct attribute_group dev_attr_group = { static struct attribute_group dev_group = {
.attrs = dev_attrs, .attrs = dev_attrs,
}; };
static const struct attribute_group *dev_attr_groups[] = { static const struct attribute_group *dev_groups[] = {
&dev_attr_group, &dev_group,
NULL, NULL,
}; };
A helper macro is available for the common case of a single group, so the
above two structures can be declared using:::
ATTRIBUTE_GROUPS(dev);
This array of groups can then be associated with a device by setting the This array of groups can then be associated with a device by setting the
group pointer in struct device before device_register() is invoked:: group pointer in struct device before device_register() is invoked::
dev->groups = dev_attr_groups; dev->groups = dev_groups;
device_register(dev); device_register(dev);
The device_register() function will use the 'groups' pointer to create the The device_register() function will use the 'groups' pointer to create the
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册