This source file includes following definitions.
- drm_minor_get_slot
- drm_minor_alloc
- drm_minor_free
- drm_minor_register
- drm_minor_unregister
- drm_minor_acquire
- drm_minor_release
- drm_put_dev
- drm_dev_enter
- drm_dev_exit
- drm_dev_unplug
- drm_fs_init_fs_context
- drm_fs_inode_new
- drm_fs_inode_free
- drm_dev_init
- devm_drm_dev_init_release
- devm_drm_dev_init
- drm_dev_fini
- drm_dev_alloc
- drm_dev_release
- drm_dev_get
- drm_dev_put
- create_compat_control_link
- remove_compat_control_link
- drm_dev_register
- drm_dev_unregister
- drm_dev_set_unique
- drm_stub_open
- drm_core_exit
- drm_core_init
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 #include <linux/debugfs.h>
30 #include <linux/fs.h>
31 #include <linux/module.h>
32 #include <linux/moduleparam.h>
33 #include <linux/mount.h>
34 #include <linux/pseudo_fs.h>
35 #include <linux/slab.h>
36 #include <linux/srcu.h>
37
38 #include <drm/drm_client.h>
39 #include <drm/drm_color_mgmt.h>
40 #include <drm/drm_drv.h>
41 #include <drm/drm_file.h>
42 #include <drm/drm_mode_object.h>
43 #include <drm/drm_print.h>
44
45 #include "drm_crtc_internal.h"
46 #include "drm_internal.h"
47 #include "drm_legacy.h"
48
49
50
51
52
53 unsigned int drm_debug = 0;
54 EXPORT_SYMBOL(drm_debug);
55
56 MODULE_AUTHOR("Gareth Hughes, Leif Delgass, José Fonseca, Jon Smirl");
57 MODULE_DESCRIPTION("DRM shared core routines");
58 MODULE_LICENSE("GPL and additional rights");
59 MODULE_PARM_DESC(debug, "Enable debug output, where each bit enables a debug category.\n"
60 "\t\tBit 0 (0x01) will enable CORE messages (drm core code)\n"
61 "\t\tBit 1 (0x02) will enable DRIVER messages (drm controller code)\n"
62 "\t\tBit 2 (0x04) will enable KMS messages (modesetting code)\n"
63 "\t\tBit 3 (0x08) will enable PRIME messages (prime code)\n"
64 "\t\tBit 4 (0x10) will enable ATOMIC messages (atomic code)\n"
65 "\t\tBit 5 (0x20) will enable VBL messages (vblank code)\n"
66 "\t\tBit 7 (0x80) will enable LEASE messages (leasing code)\n"
67 "\t\tBit 8 (0x100) will enable DP messages (displayport code)");
68 module_param_named(debug, drm_debug, int, 0600);
69
70 static DEFINE_SPINLOCK(drm_minor_lock);
71 static struct idr drm_minors_idr;
72
73
74
75
76
77
78
79
80 static bool drm_core_init_complete = false;
81
82 static struct dentry *drm_debugfs_root;
83
84 DEFINE_STATIC_SRCU(drm_unplug_srcu);
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99 static struct drm_minor **drm_minor_get_slot(struct drm_device *dev,
100 unsigned int type)
101 {
102 switch (type) {
103 case DRM_MINOR_PRIMARY:
104 return &dev->primary;
105 case DRM_MINOR_RENDER:
106 return &dev->render;
107 default:
108 BUG();
109 }
110 }
111
112 static int drm_minor_alloc(struct drm_device *dev, unsigned int type)
113 {
114 struct drm_minor *minor;
115 unsigned long flags;
116 int r;
117
118 minor = kzalloc(sizeof(*minor), GFP_KERNEL);
119 if (!minor)
120 return -ENOMEM;
121
122 minor->type = type;
123 minor->dev = dev;
124
125 idr_preload(GFP_KERNEL);
126 spin_lock_irqsave(&drm_minor_lock, flags);
127 r = idr_alloc(&drm_minors_idr,
128 NULL,
129 64 * type,
130 64 * (type + 1),
131 GFP_NOWAIT);
132 spin_unlock_irqrestore(&drm_minor_lock, flags);
133 idr_preload_end();
134
135 if (r < 0)
136 goto err_free;
137
138 minor->index = r;
139
140 minor->kdev = drm_sysfs_minor_alloc(minor);
141 if (IS_ERR(minor->kdev)) {
142 r = PTR_ERR(minor->kdev);
143 goto err_index;
144 }
145
146 *drm_minor_get_slot(dev, type) = minor;
147 return 0;
148
149 err_index:
150 spin_lock_irqsave(&drm_minor_lock, flags);
151 idr_remove(&drm_minors_idr, minor->index);
152 spin_unlock_irqrestore(&drm_minor_lock, flags);
153 err_free:
154 kfree(minor);
155 return r;
156 }
157
158 static void drm_minor_free(struct drm_device *dev, unsigned int type)
159 {
160 struct drm_minor **slot, *minor;
161 unsigned long flags;
162
163 slot = drm_minor_get_slot(dev, type);
164 minor = *slot;
165 if (!minor)
166 return;
167
168 put_device(minor->kdev);
169
170 spin_lock_irqsave(&drm_minor_lock, flags);
171 idr_remove(&drm_minors_idr, minor->index);
172 spin_unlock_irqrestore(&drm_minor_lock, flags);
173
174 kfree(minor);
175 *slot = NULL;
176 }
177
178 static int drm_minor_register(struct drm_device *dev, unsigned int type)
179 {
180 struct drm_minor *minor;
181 unsigned long flags;
182 int ret;
183
184 DRM_DEBUG("\n");
185
186 minor = *drm_minor_get_slot(dev, type);
187 if (!minor)
188 return 0;
189
190 ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
191 if (ret) {
192 DRM_ERROR("DRM: Failed to initialize /sys/kernel/debug/dri.\n");
193 goto err_debugfs;
194 }
195
196 ret = device_add(minor->kdev);
197 if (ret)
198 goto err_debugfs;
199
200
201 spin_lock_irqsave(&drm_minor_lock, flags);
202 idr_replace(&drm_minors_idr, minor, minor->index);
203 spin_unlock_irqrestore(&drm_minor_lock, flags);
204
205 DRM_DEBUG("new minor registered %d\n", minor->index);
206 return 0;
207
208 err_debugfs:
209 drm_debugfs_cleanup(minor);
210 return ret;
211 }
212
213 static void drm_minor_unregister(struct drm_device *dev, unsigned int type)
214 {
215 struct drm_minor *minor;
216 unsigned long flags;
217
218 minor = *drm_minor_get_slot(dev, type);
219 if (!minor || !device_is_registered(minor->kdev))
220 return;
221
222
223 spin_lock_irqsave(&drm_minor_lock, flags);
224 idr_replace(&drm_minors_idr, NULL, minor->index);
225 spin_unlock_irqrestore(&drm_minor_lock, flags);
226
227 device_del(minor->kdev);
228 dev_set_drvdata(minor->kdev, NULL);
229 drm_debugfs_cleanup(minor);
230 }
231
232
233
234
235
236
237
238
239
240
241 struct drm_minor *drm_minor_acquire(unsigned int minor_id)
242 {
243 struct drm_minor *minor;
244 unsigned long flags;
245
246 spin_lock_irqsave(&drm_minor_lock, flags);
247 minor = idr_find(&drm_minors_idr, minor_id);
248 if (minor)
249 drm_dev_get(minor->dev);
250 spin_unlock_irqrestore(&drm_minor_lock, flags);
251
252 if (!minor) {
253 return ERR_PTR(-ENODEV);
254 } else if (drm_dev_is_unplugged(minor->dev)) {
255 drm_dev_put(minor->dev);
256 return ERR_PTR(-ENODEV);
257 }
258
259 return minor;
260 }
261
262 void drm_minor_release(struct drm_minor *minor)
263 {
264 drm_dev_put(minor->dev);
265 }
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439 void drm_put_dev(struct drm_device *dev)
440 {
441 DRM_DEBUG("\n");
442
443 if (!dev) {
444 DRM_ERROR("cleanup called no dev\n");
445 return;
446 }
447
448 drm_dev_unregister(dev);
449 drm_dev_put(dev);
450 }
451 EXPORT_SYMBOL(drm_put_dev);
452
453
454
455
456
457
458
459
460
461
462
463
464
465 bool drm_dev_enter(struct drm_device *dev, int *idx)
466 {
467 *idx = srcu_read_lock(&drm_unplug_srcu);
468
469 if (dev->unplugged) {
470 srcu_read_unlock(&drm_unplug_srcu, *idx);
471 return false;
472 }
473
474 return true;
475 }
476 EXPORT_SYMBOL(drm_dev_enter);
477
478
479
480
481
482
483
484
485 void drm_dev_exit(int idx)
486 {
487 srcu_read_unlock(&drm_unplug_srcu, idx);
488 }
489 EXPORT_SYMBOL(drm_dev_exit);
490
491
492
493
494
495
496
497
498
499
500
501 void drm_dev_unplug(struct drm_device *dev)
502 {
503
504
505
506
507
508
509 dev->unplugged = true;
510 synchronize_srcu(&drm_unplug_srcu);
511
512 drm_dev_unregister(dev);
513 }
514 EXPORT_SYMBOL(drm_dev_unplug);
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534 static int drm_fs_cnt;
535 static struct vfsmount *drm_fs_mnt;
536
537 static int drm_fs_init_fs_context(struct fs_context *fc)
538 {
539 return init_pseudo(fc, 0x010203ff) ? 0 : -ENOMEM;
540 }
541
542 static struct file_system_type drm_fs_type = {
543 .name = "drm",
544 .owner = THIS_MODULE,
545 .init_fs_context = drm_fs_init_fs_context,
546 .kill_sb = kill_anon_super,
547 };
548
549 static struct inode *drm_fs_inode_new(void)
550 {
551 struct inode *inode;
552 int r;
553
554 r = simple_pin_fs(&drm_fs_type, &drm_fs_mnt, &drm_fs_cnt);
555 if (r < 0) {
556 DRM_ERROR("Cannot mount pseudo fs: %d\n", r);
557 return ERR_PTR(r);
558 }
559
560 inode = alloc_anon_inode(drm_fs_mnt->mnt_sb);
561 if (IS_ERR(inode))
562 simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
563
564 return inode;
565 }
566
567 static void drm_fs_inode_free(struct inode *inode)
568 {
569 if (inode) {
570 iput(inode);
571 simple_release_fs(&drm_fs_mnt, &drm_fs_cnt);
572 }
573 }
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631 int drm_dev_init(struct drm_device *dev,
632 struct drm_driver *driver,
633 struct device *parent)
634 {
635 int ret;
636
637 if (!drm_core_init_complete) {
638 DRM_ERROR("DRM core is not initialized\n");
639 return -ENODEV;
640 }
641
642 BUG_ON(!parent);
643
644 kref_init(&dev->ref);
645 dev->dev = get_device(parent);
646 dev->driver = driver;
647
648
649 dev->driver_features = ~0u;
650
651 drm_legacy_init_members(dev);
652 INIT_LIST_HEAD(&dev->filelist);
653 INIT_LIST_HEAD(&dev->filelist_internal);
654 INIT_LIST_HEAD(&dev->clientlist);
655 INIT_LIST_HEAD(&dev->vblank_event_list);
656
657 spin_lock_init(&dev->event_lock);
658 mutex_init(&dev->struct_mutex);
659 mutex_init(&dev->filelist_mutex);
660 mutex_init(&dev->clientlist_mutex);
661 mutex_init(&dev->master_mutex);
662
663 dev->anon_inode = drm_fs_inode_new();
664 if (IS_ERR(dev->anon_inode)) {
665 ret = PTR_ERR(dev->anon_inode);
666 DRM_ERROR("Cannot allocate anonymous inode: %d\n", ret);
667 goto err_free;
668 }
669
670 if (drm_core_check_feature(dev, DRIVER_RENDER)) {
671 ret = drm_minor_alloc(dev, DRM_MINOR_RENDER);
672 if (ret)
673 goto err_minors;
674 }
675
676 ret = drm_minor_alloc(dev, DRM_MINOR_PRIMARY);
677 if (ret)
678 goto err_minors;
679
680 ret = drm_legacy_create_map_hash(dev);
681 if (ret)
682 goto err_minors;
683
684 drm_legacy_ctxbitmap_init(dev);
685
686 if (drm_core_check_feature(dev, DRIVER_GEM)) {
687 ret = drm_gem_init(dev);
688 if (ret) {
689 DRM_ERROR("Cannot initialize graphics execution manager (GEM)\n");
690 goto err_ctxbitmap;
691 }
692 }
693
694 ret = drm_dev_set_unique(dev, dev_name(parent));
695 if (ret)
696 goto err_setunique;
697
698 return 0;
699
700 err_setunique:
701 if (drm_core_check_feature(dev, DRIVER_GEM))
702 drm_gem_destroy(dev);
703 err_ctxbitmap:
704 drm_legacy_ctxbitmap_cleanup(dev);
705 drm_legacy_remove_map_hash(dev);
706 err_minors:
707 drm_minor_free(dev, DRM_MINOR_PRIMARY);
708 drm_minor_free(dev, DRM_MINOR_RENDER);
709 drm_fs_inode_free(dev->anon_inode);
710 err_free:
711 put_device(dev->dev);
712 mutex_destroy(&dev->master_mutex);
713 mutex_destroy(&dev->clientlist_mutex);
714 mutex_destroy(&dev->filelist_mutex);
715 mutex_destroy(&dev->struct_mutex);
716 drm_legacy_destroy_members(dev);
717 return ret;
718 }
719 EXPORT_SYMBOL(drm_dev_init);
720
721 static void devm_drm_dev_init_release(void *data)
722 {
723 drm_dev_put(data);
724 }
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739 int devm_drm_dev_init(struct device *parent,
740 struct drm_device *dev,
741 struct drm_driver *driver)
742 {
743 int ret;
744
745 if (WARN_ON(!parent || !driver->release))
746 return -EINVAL;
747
748 ret = drm_dev_init(dev, driver, parent);
749 if (ret)
750 return ret;
751
752 ret = devm_add_action(parent, devm_drm_dev_init_release, dev);
753 if (ret)
754 devm_drm_dev_init_release(dev);
755
756 return ret;
757 }
758 EXPORT_SYMBOL(devm_drm_dev_init);
759
760
761
762
763
764
765
766
767
768
769
770
771
772 void drm_dev_fini(struct drm_device *dev)
773 {
774 drm_vblank_cleanup(dev);
775
776 if (drm_core_check_feature(dev, DRIVER_GEM))
777 drm_gem_destroy(dev);
778
779 drm_legacy_ctxbitmap_cleanup(dev);
780 drm_legacy_remove_map_hash(dev);
781 drm_fs_inode_free(dev->anon_inode);
782
783 drm_minor_free(dev, DRM_MINOR_PRIMARY);
784 drm_minor_free(dev, DRM_MINOR_RENDER);
785
786 put_device(dev->dev);
787
788 mutex_destroy(&dev->master_mutex);
789 mutex_destroy(&dev->clientlist_mutex);
790 mutex_destroy(&dev->filelist_mutex);
791 mutex_destroy(&dev->struct_mutex);
792 drm_legacy_destroy_members(dev);
793 kfree(dev->unique);
794 }
795 EXPORT_SYMBOL(drm_dev_fini);
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819 struct drm_device *drm_dev_alloc(struct drm_driver *driver,
820 struct device *parent)
821 {
822 struct drm_device *dev;
823 int ret;
824
825 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
826 if (!dev)
827 return ERR_PTR(-ENOMEM);
828
829 ret = drm_dev_init(dev, driver, parent);
830 if (ret) {
831 kfree(dev);
832 return ERR_PTR(ret);
833 }
834
835 return dev;
836 }
837 EXPORT_SYMBOL(drm_dev_alloc);
838
839 static void drm_dev_release(struct kref *ref)
840 {
841 struct drm_device *dev = container_of(ref, struct drm_device, ref);
842
843 if (dev->driver->release) {
844 dev->driver->release(dev);
845 } else {
846 drm_dev_fini(dev);
847 kfree(dev);
848 }
849 }
850
851
852
853
854
855
856
857
858
859
860
861
862
863 void drm_dev_get(struct drm_device *dev)
864 {
865 if (dev)
866 kref_get(&dev->ref);
867 }
868 EXPORT_SYMBOL(drm_dev_get);
869
870
871
872
873
874
875
876
877 void drm_dev_put(struct drm_device *dev)
878 {
879 if (dev)
880 kref_put(&dev->ref, drm_dev_release);
881 }
882 EXPORT_SYMBOL(drm_dev_put);
883
884 static int create_compat_control_link(struct drm_device *dev)
885 {
886 struct drm_minor *minor;
887 char *name;
888 int ret;
889
890 if (!drm_core_check_feature(dev, DRIVER_MODESET))
891 return 0;
892
893 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY);
894 if (!minor)
895 return 0;
896
897
898
899
900
901
902
903
904
905
906 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64);
907 if (!name)
908 return -ENOMEM;
909
910 ret = sysfs_create_link(minor->kdev->kobj.parent,
911 &minor->kdev->kobj,
912 name);
913
914 kfree(name);
915
916 return ret;
917 }
918
919 static void remove_compat_control_link(struct drm_device *dev)
920 {
921 struct drm_minor *minor;
922 char *name;
923
924 if (!drm_core_check_feature(dev, DRIVER_MODESET))
925 return;
926
927 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY);
928 if (!minor)
929 return;
930
931 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64);
932 if (!name)
933 return;
934
935 sysfs_remove_link(minor->kdev->kobj.parent, name);
936
937 kfree(name);
938 }
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960 int drm_dev_register(struct drm_device *dev, unsigned long flags)
961 {
962 struct drm_driver *driver = dev->driver;
963 int ret;
964
965 mutex_lock(&drm_global_mutex);
966
967 ret = drm_minor_register(dev, DRM_MINOR_RENDER);
968 if (ret)
969 goto err_minors;
970
971 ret = drm_minor_register(dev, DRM_MINOR_PRIMARY);
972 if (ret)
973 goto err_minors;
974
975 ret = create_compat_control_link(dev);
976 if (ret)
977 goto err_minors;
978
979 dev->registered = true;
980
981 if (dev->driver->load) {
982 ret = dev->driver->load(dev, flags);
983 if (ret)
984 goto err_minors;
985 }
986
987 if (drm_core_check_feature(dev, DRIVER_MODESET))
988 drm_modeset_register_all(dev);
989
990 ret = 0;
991
992 DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
993 driver->name, driver->major, driver->minor,
994 driver->patchlevel, driver->date,
995 dev->dev ? dev_name(dev->dev) : "virtual device",
996 dev->primary->index);
997
998 goto out_unlock;
999
1000 err_minors:
1001 remove_compat_control_link(dev);
1002 drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
1003 drm_minor_unregister(dev, DRM_MINOR_RENDER);
1004 out_unlock:
1005 mutex_unlock(&drm_global_mutex);
1006 return ret;
1007 }
1008 EXPORT_SYMBOL(drm_dev_register);
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024 void drm_dev_unregister(struct drm_device *dev)
1025 {
1026 if (drm_core_check_feature(dev, DRIVER_LEGACY))
1027 drm_lastclose(dev);
1028
1029 dev->registered = false;
1030
1031 drm_client_dev_unregister(dev);
1032
1033 if (drm_core_check_feature(dev, DRIVER_MODESET))
1034 drm_modeset_unregister_all(dev);
1035
1036 if (dev->driver->unload)
1037 dev->driver->unload(dev);
1038
1039 if (dev->agp)
1040 drm_pci_agp_destroy(dev);
1041
1042 drm_legacy_rmmaps(dev);
1043
1044 remove_compat_control_link(dev);
1045 drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
1046 drm_minor_unregister(dev, DRM_MINOR_RENDER);
1047 }
1048 EXPORT_SYMBOL(drm_dev_unregister);
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061 int drm_dev_set_unique(struct drm_device *dev, const char *name)
1062 {
1063 kfree(dev->unique);
1064 dev->unique = kstrdup(name, GFP_KERNEL);
1065
1066 return dev->unique ? 0 : -ENOMEM;
1067 }
1068 EXPORT_SYMBOL(drm_dev_set_unique);
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090 static int drm_stub_open(struct inode *inode, struct file *filp)
1091 {
1092 const struct file_operations *new_fops;
1093 struct drm_minor *minor;
1094 int err;
1095
1096 DRM_DEBUG("\n");
1097
1098 mutex_lock(&drm_global_mutex);
1099 minor = drm_minor_acquire(iminor(inode));
1100 if (IS_ERR(minor)) {
1101 err = PTR_ERR(minor);
1102 goto out_unlock;
1103 }
1104
1105 new_fops = fops_get(minor->dev->driver->fops);
1106 if (!new_fops) {
1107 err = -ENODEV;
1108 goto out_release;
1109 }
1110
1111 replace_fops(filp, new_fops);
1112 if (filp->f_op->open)
1113 err = filp->f_op->open(inode, filp);
1114 else
1115 err = 0;
1116
1117 out_release:
1118 drm_minor_release(minor);
1119 out_unlock:
1120 mutex_unlock(&drm_global_mutex);
1121 return err;
1122 }
1123
1124 static const struct file_operations drm_stub_fops = {
1125 .owner = THIS_MODULE,
1126 .open = drm_stub_open,
1127 .llseek = noop_llseek,
1128 };
1129
1130 static void drm_core_exit(void)
1131 {
1132 unregister_chrdev(DRM_MAJOR, "drm");
1133 debugfs_remove(drm_debugfs_root);
1134 drm_sysfs_destroy();
1135 idr_destroy(&drm_minors_idr);
1136 drm_connector_ida_destroy();
1137 }
1138
1139 static int __init drm_core_init(void)
1140 {
1141 int ret;
1142
1143 drm_connector_ida_init();
1144 idr_init(&drm_minors_idr);
1145
1146 ret = drm_sysfs_init();
1147 if (ret < 0) {
1148 DRM_ERROR("Cannot create DRM class: %d\n", ret);
1149 goto error;
1150 }
1151
1152 drm_debugfs_root = debugfs_create_dir("dri", NULL);
1153
1154 ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
1155 if (ret < 0)
1156 goto error;
1157
1158 drm_core_init_complete = true;
1159
1160 DRM_DEBUG("Initialized\n");
1161 return 0;
1162
1163 error:
1164 drm_core_exit();
1165 return ret;
1166 }
1167
1168 module_init(drm_core_init);
1169 module_exit(drm_core_exit);