1DEVICE_CREATE_WITH_G(9)  Device drivers infrastructure DEVICE_CREATE_WITH_G(9)
2
3
4

NAME

6       device_create_with_groups - creates a device and registers it with
7       sysfs
8

SYNOPSIS

10       struct device * device_create_with_groups(struct class * class,
11                                                 struct device * parent,
12                                                 dev_t devt, void * drvdata,
13                                                 const struct attribute_group ** groups,
14                                                 const char * fmt, ...);
15

ARGUMENTS

17       class
18           pointer to the struct class that this device should be registered
19           to
20
21       parent
22           pointer to the parent struct device of this new device, if any
23
24       devt
25           the dev_t for the char device to be added
26
27       drvdata
28           the data to be added to the device for callbacks
29
30       groups
31           NULL-terminated list of attribute groups to be created
32
33       fmt
34           string for the device's name
35
36       ...
37           variable arguments
38

DESCRIPTION

40       This function can be used by char device classes. A struct device will
41       be created in sysfs, registered to the specified class. Additional
42       attributes specified in the groups parameter will also be created
43       automatically.
44
45       A “dev” file will be created, showing the dev_t for the device, if the
46       dev_t is not 0,0. If a pointer to a parent struct device is passed in,
47       the newly created struct device will be a child of that device in
48       sysfs. The pointer to the struct device will be returned from the call.
49       Any further sysfs files that might be required can be created using
50       this pointer.
51
52       Returns struct device pointer on success, or ERR_PTR on error.
53

NOTE

55       the struct class passed to this function must have previously been
56       created with a call to class_create.
57
59Kernel Hackers Manual 3.10         June 2019           DEVICE_CREATE_WITH_G(9)
Impressum