Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>


authored by

tonyj@suse.de and committed by
Greg Kroah-Hartman
60043428 34b51f39

+20 -17
+2 -2
drivers/acpi/video.c
··· 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 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
+16 -13
drivers/video/output.c
··· 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); ··· 41 40 return ret_size; 42 41 } 43 42 44 - static ssize_t video_output_store_state(struct class_device *dev, 45 - const char *buf,size_t count) 43 + static ssize_t video_output_store_state(struct device *dev, 44 + struct device_attribute *attr, 45 + const char *buf,size_t count) 46 46 { 47 47 char *endp; 48 48 struct output_device *od = to_output_device(dev); ··· 62 60 return count; 63 61 } 64 62 65 - static void video_output_class_release(struct class_device *dev) 63 + static void video_output_release(struct device *dev) 66 64 { 67 65 struct output_device *od = to_output_device(dev); 68 66 kfree(od); 69 67 } 70 68 71 - static struct class_device_attribute video_output_attributes[] = { 69 + static struct device_attribute video_output_attributes[] = { 72 70 __ATTR(state, 0644, video_output_show_state, video_output_store_state), 73 71 __ATTR_NULL, 74 72 }; 75 73 74 + 76 75 static struct class video_output_class = { 77 76 .name = "video_output", 78 - .release = video_output_class_release, 79 - .class_dev_attrs = video_output_attributes, 77 + .dev_release = video_output_release, 78 + .dev_attrs = video_output_attributes, 80 79 }; 81 80 82 81 struct output_device *video_output_register(const char *name, ··· 94 91 goto error_return; 95 92 } 96 93 new_dev->props = op; 97 - new_dev->class_dev.class = &video_output_class; 98 - new_dev->class_dev.dev = dev; 99 - strlcpy(new_dev->class_dev.class_id,name,KOBJ_NAME_LEN); 100 - class_set_devdata(&new_dev->class_dev,devdata); 101 - ret_code = class_device_register(&new_dev->class_dev); 94 + new_dev->dev.class = &video_output_class; 95 + new_dev->dev.parent = dev; 96 + strlcpy(new_dev->dev.bus_id,name, BUS_ID_SIZE); 97 + dev_set_drvdata(&new_dev->dev, devdata); 98 + ret_code = device_register(&new_dev->dev); 102 99 if (ret_code) { 103 100 kfree(new_dev); 104 101 goto error_return; ··· 114 111 { 115 112 if (!dev) 116 113 return; 117 - class_device_unregister(&dev->class_dev); 114 + device_unregister(&dev->dev); 118 115 } 119 116 EXPORT_SYMBOL(video_output_unregister); 120 117
+2 -2
include/linux/video_output.h
··· 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,