Commit 60043428a561a5d431ad479b7ecb79805ed04efc
Committed by
Greg Kroah-Hartman
1 parent
34b51f39e2
Exists in
master
and in
7 other branches
Convert from class_device to device for drivers/video
Convert from class_device to device for drivers/video. Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Showing 3 changed files with 20 additions and 17 deletions Side-by-side Diff
drivers/acpi/video.c
... | ... | @@ -316,7 +316,7 @@ |
316 | 316 | { |
317 | 317 | unsigned long state; |
318 | 318 | struct acpi_video_device *vd = |
319 | - (struct acpi_video_device *)class_get_devdata(&od->class_dev); | |
319 | + (struct acpi_video_device *)dev_get_drvdata(&od->dev); | |
320 | 320 | acpi_video_device_get_state(vd, &state); |
321 | 321 | return (int)state; |
322 | 322 | } |
... | ... | @@ -325,7 +325,7 @@ |
325 | 325 | { |
326 | 326 | unsigned long state = od->request_state; |
327 | 327 | struct acpi_video_device *vd= |
328 | - (struct acpi_video_device *)class_get_devdata(&od->class_dev); | |
328 | + (struct acpi_video_device *)dev_get_drvdata(&od->dev); | |
329 | 329 | return acpi_video_device_set_state(vd, state); |
330 | 330 | } |
331 | 331 |
drivers/video/output.c
... | ... | @@ -31,7 +31,8 @@ |
31 | 31 | MODULE_LICENSE("GPL"); |
32 | 32 | MODULE_AUTHOR("Luming Yu <luming.yu@intel.com>"); |
33 | 33 | |
34 | -static ssize_t video_output_show_state(struct class_device *dev,char *buf) | |
34 | +static ssize_t video_output_show_state(struct device *dev, | |
35 | + struct device_attribute *attr, char *buf) | |
35 | 36 | { |
36 | 37 | ssize_t ret_size = 0; |
37 | 38 | struct output_device *od = to_output_device(dev); |
... | ... | @@ -40,8 +41,9 @@ |
40 | 41 | return ret_size; |
41 | 42 | } |
42 | 43 | |
43 | -static ssize_t video_output_store_state(struct class_device *dev, | |
44 | - const char *buf,size_t count) | |
44 | +static ssize_t video_output_store_state(struct device *dev, | |
45 | + struct device_attribute *attr, | |
46 | + const char *buf,size_t count) | |
45 | 47 | { |
46 | 48 | char *endp; |
47 | 49 | struct output_device *od = to_output_device(dev); |
48 | 50 | |
49 | 51 | |
50 | 52 | |
... | ... | @@ -60,21 +62,22 @@ |
60 | 62 | return count; |
61 | 63 | } |
62 | 64 | |
63 | -static void video_output_class_release(struct class_device *dev) | |
65 | +static void video_output_release(struct device *dev) | |
64 | 66 | { |
65 | 67 | struct output_device *od = to_output_device(dev); |
66 | 68 | kfree(od); |
67 | 69 | } |
68 | 70 | |
69 | -static struct class_device_attribute video_output_attributes[] = { | |
71 | +static struct device_attribute video_output_attributes[] = { | |
70 | 72 | __ATTR(state, 0644, video_output_show_state, video_output_store_state), |
71 | 73 | __ATTR_NULL, |
72 | 74 | }; |
73 | 75 | |
76 | + | |
74 | 77 | static struct class video_output_class = { |
75 | 78 | .name = "video_output", |
76 | - .release = video_output_class_release, | |
77 | - .class_dev_attrs = video_output_attributes, | |
79 | + .dev_release = video_output_release, | |
80 | + .dev_attrs = video_output_attributes, | |
78 | 81 | }; |
79 | 82 | |
80 | 83 | struct output_device *video_output_register(const char *name, |
... | ... | @@ -91,11 +94,11 @@ |
91 | 94 | goto error_return; |
92 | 95 | } |
93 | 96 | new_dev->props = op; |
94 | - new_dev->class_dev.class = &video_output_class; | |
95 | - new_dev->class_dev.dev = dev; | |
96 | - strlcpy(new_dev->class_dev.class_id,name,KOBJ_NAME_LEN); | |
97 | - class_set_devdata(&new_dev->class_dev,devdata); | |
98 | - ret_code = class_device_register(&new_dev->class_dev); | |
97 | + new_dev->dev.class = &video_output_class; | |
98 | + new_dev->dev.parent = dev; | |
99 | + strlcpy(new_dev->dev.bus_id,name, BUS_ID_SIZE); | |
100 | + dev_set_drvdata(&new_dev->dev, devdata); | |
101 | + ret_code = device_register(&new_dev->dev); | |
99 | 102 | if (ret_code) { |
100 | 103 | kfree(new_dev); |
101 | 104 | goto error_return; |
... | ... | @@ -111,7 +114,7 @@ |
111 | 114 | { |
112 | 115 | if (!dev) |
113 | 116 | return; |
114 | - class_device_unregister(&dev->class_dev); | |
117 | + device_unregister(&dev->dev); | |
115 | 118 | } |
116 | 119 | EXPORT_SYMBOL(video_output_unregister); |
117 | 120 |
include/linux/video_output.h
... | ... | @@ -31,9 +31,9 @@ |
31 | 31 | struct output_device { |
32 | 32 | int request_state; |
33 | 33 | struct output_properties *props; |
34 | - struct class_device class_dev; | |
34 | + struct device dev; | |
35 | 35 | }; |
36 | -#define to_output_device(obj) container_of(obj, struct output_device, class_dev) | |
36 | +#define to_output_device(obj) container_of(obj, struct output_device, dev) | |
37 | 37 | struct output_device *video_output_register(const char *name, |
38 | 38 | struct device *dev, |
39 | 39 | void *devdata, |