Skip to content

Commit 63dc355

Browse files
gaowanlonggregkh
authored andcommitted
driver core: remove the driver-model structures from the documentation
Remove the struct bus_type, class, device, device_driver from the driver-model docs. With another patch add them to device.h, since they are out of date. That will keep things up to date and provide a better way to document this stuff. Signed-off-by: Wanlong Gao <wanlong.gao@gmail.com> Acked-by: Harry Wei <harryxiyou@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent 880ffb5 commit 63dc355

4 files changed

Lines changed: 4 additions & 141 deletions

File tree

‎Documentation/driver-model/bus.txt‎

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,7 @@ Bus Types
33

44
Definition
55
~~~~~~~~~~
6-
7-
struct bus_type {
8-
char * name;
9-
10-
struct subsystem subsys;
11-
struct kset drivers;
12-
struct kset devices;
13-
14-
struct bus_attribute * bus_attrs;
15-
struct device_attribute * dev_attrs;
16-
struct driver_attribute * drv_attrs;
17-
18-
int (*match)(struct device * dev, struct device_driver * drv);
19-
int (*hotplug) (struct device *dev, char **envp,
20-
int num_envp, char *buffer, int buffer_size);
21-
int (*suspend)(struct device * dev, pm_message_t state);
22-
int (*resume)(struct device * dev);
23-
};
6+
See the kerneldoc for the struct bus_type.
247

258
int bus_register(struct bus_type * bus);
269

‎Documentation/driver-model/class.txt‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,7 @@ The device class structure looks like:
2727
typedef int (*devclass_add)(struct device *);
2828
typedef void (*devclass_remove)(struct device *);
2929

30-
struct device_class {
31-
char * name;
32-
rwlock_t lock;
33-
u32 devnum;
34-
struct list_head node;
35-
36-
struct list_head drivers;
37-
struct list_head intf_list;
38-
39-
struct driver_dir_entry dir;
40-
struct driver_dir_entry device_dir;
41-
struct driver_dir_entry driver_dir;
42-
43-
devclass_add add_device;
44-
devclass_remove remove_device;
45-
};
30+
See the kerneldoc for the struct class.
4631

4732
A typical device class definition would look like:
4833

‎Documentation/driver-model/device.txt‎

Lines changed: 1 addition & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,7 @@
22
The Basic Device Structure
33
~~~~~~~~~~~~~~~~~~~~~~~~~~
44

5-
struct device {
6-
struct list_head g_list;
7-
struct list_head node;
8-
struct list_head bus_list;
9-
struct list_head driver_list;
10-
struct list_head intf_list;
11-
struct list_head children;
12-
struct device * parent;
13-
14-
char name[DEVICE_NAME_SIZE];
15-
char bus_id[BUS_ID_SIZE];
16-
17-
spinlock_t lock;
18-
atomic_t refcount;
19-
20-
struct bus_type * bus;
21-
struct driver_dir_entry dir;
22-
23-
u32 class_num;
24-
25-
struct device_driver *driver;
26-
void *driver_data;
27-
void *platform_data;
28-
29-
u32 current_state;
30-
unsigned char *saved_state;
31-
32-
void (*release)(struct device * dev);
33-
};
34-
35-
Fields
36-
~~~~~~
37-
g_list: Node in the global device list.
38-
39-
node: Node in device's parent's children list.
40-
41-
bus_list: Node in device's bus's devices list.
42-
43-
driver_list: Node in device's driver's devices list.
44-
45-
intf_list: List of intf_data. There is one structure allocated for
46-
each interface that the device supports.
47-
48-
children: List of child devices.
49-
50-
parent: *** FIXME ***
51-
52-
name: ASCII description of device.
53-
Example: " 3Com Corporation 3c905 100BaseTX [Boomerang]"
54-
55-
bus_id: ASCII representation of device's bus position. This
56-
field should be a name unique across all devices on the
57-
bus type the device belongs to.
58-
59-
Example: PCI bus_ids are in the form of
60-
<bus number>:<slot number>.<function number>
61-
This name is unique across all PCI devices in the system.
62-
63-
lock: Spinlock for the device.
64-
65-
refcount: Reference count on the device.
66-
67-
bus: Pointer to struct bus_type that device belongs to.
68-
69-
dir: Device's sysfs directory.
70-
71-
class_num: Class-enumerated value of the device.
72-
73-
driver: Pointer to struct device_driver that controls the device.
74-
75-
driver_data: Driver-specific data.
76-
77-
platform_data: Platform data specific to the device.
78-
79-
Example: for devices on custom boards, as typical of embedded
80-
and SOC based hardware, Linux often uses platform_data to point
81-
to board-specific structures describing devices and how they
82-
are wired. That can include what ports are available, chip
83-
variants, which GPIO pins act in what additional roles, and so
84-
on. This shrinks the "Board Support Packages" (BSPs) and
85-
minimizes board-specific #ifdefs in drivers.
86-
87-
current_state: Current power state of the device.
88-
89-
saved_state: Pointer to saved state of the device. This is usable by
90-
the device driver controlling the device.
91-
92-
release: Callback to free the device after all references have
93-
gone away. This should be set by the allocator of the
94-
device (i.e. the bus driver that discovered the device).
5+
See the kerneldoc for the struct device.
956

967

978
Programming Interface

‎Documentation/driver-model/driver.txt‎

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11

22
Device Drivers
33

4-
struct device_driver {
5-
char * name;
6-
struct bus_type * bus;
7-
8-
struct completion unloaded;
9-
struct kobject kobj;
10-
list_t devices;
11-
12-
struct module *owner;
13-
14-
int (*probe) (struct device * dev);
15-
int (*remove) (struct device * dev);
16-
17-
int (*suspend) (struct device * dev, pm_message_t state);
18-
int (*resume) (struct device * dev);
19-
};
20-
4+
See the kerneldoc for the struct device_driver.
215

226

237
Allocation

0 commit comments

Comments
 (0)