mdpy.c (bdef2b7896df293736330eb6eb0f43947049b828) mdpy.c (89345d5177aa0f6d678251e1e0870b0eeb1ab510)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Mediated virtual PCI display host device driver
4 *
5 * See mdpy-defs.h for device specs
6 *
7 * (c) Gerd Hoffmann <kraxel@redhat.com>
8 *

--- 69 unchanged lines hidden (view full) ---

78 .height = 1080,
79 },
80};
81
82static dev_t mdpy_devt;
83static struct class *mdpy_class;
84static struct cdev mdpy_cdev;
85static struct device mdpy_dev;
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Mediated virtual PCI display host device driver
4 *
5 * See mdpy-defs.h for device specs
6 *
7 * (c) Gerd Hoffmann <kraxel@redhat.com>
8 *

--- 69 unchanged lines hidden (view full) ---

78 .height = 1080,
79 },
80};
81
82static dev_t mdpy_devt;
83static struct class *mdpy_class;
84static struct cdev mdpy_cdev;
85static struct device mdpy_dev;
86static struct mdev_parent mdpy_parent;
86static u32 mdpy_count;
87static const struct vfio_device_ops mdpy_dev_ops;
88
89/* State of each mdev device */
90struct mdev_state {
91 struct vfio_device vdev;
92 u8 *vconfig;
93 u32 bar_mask;

--- 679 unchanged lines hidden (view full) ---

773 mdpy_dev.class = mdpy_class;
774 mdpy_dev.release = mdpy_device_release;
775 dev_set_name(&mdpy_dev, "%s", MDPY_NAME);
776
777 ret = device_register(&mdpy_dev);
778 if (ret)
779 goto err_class;
780
87static u32 mdpy_count;
88static const struct vfio_device_ops mdpy_dev_ops;
89
90/* State of each mdev device */
91struct mdev_state {
92 struct vfio_device vdev;
93 u8 *vconfig;
94 u32 bar_mask;

--- 679 unchanged lines hidden (view full) ---

774 mdpy_dev.class = mdpy_class;
775 mdpy_dev.release = mdpy_device_release;
776 dev_set_name(&mdpy_dev, "%s", MDPY_NAME);
777
778 ret = device_register(&mdpy_dev);
779 if (ret)
780 goto err_class;
781
781 ret = mdev_register_device(&mdpy_dev, &mdpy_driver);
782 ret = mdev_register_parent(&mdpy_parent, &mdpy_dev, &mdpy_driver);
782 if (ret)
783 goto err_device;
784
785 return 0;
786
787err_device:
788 device_unregister(&mdpy_dev);
789err_class:

--- 4 unchanged lines hidden (view full) ---

794 cdev_del(&mdpy_cdev);
795 unregister_chrdev_region(mdpy_devt, MINORMASK + 1);
796 return ret;
797}
798
799static void __exit mdpy_dev_exit(void)
800{
801 mdpy_dev.bus = NULL;
783 if (ret)
784 goto err_device;
785
786 return 0;
787
788err_device:
789 device_unregister(&mdpy_dev);
790err_class:

--- 4 unchanged lines hidden (view full) ---

795 cdev_del(&mdpy_cdev);
796 unregister_chrdev_region(mdpy_devt, MINORMASK + 1);
797 return ret;
798}
799
800static void __exit mdpy_dev_exit(void)
801{
802 mdpy_dev.bus = NULL;
802 mdev_unregister_device(&mdpy_dev);
803 mdev_unregister_parent(&mdpy_parent);
803
804 device_unregister(&mdpy_dev);
805 mdev_unregister_driver(&mdpy_driver);
806 cdev_del(&mdpy_cdev);
807 unregister_chrdev_region(mdpy_devt, MINORMASK + 1);
808 class_destroy(mdpy_class);
809 mdpy_class = NULL;
810}
811
812module_init(mdpy_dev_init)
813module_exit(mdpy_dev_exit)
804
805 device_unregister(&mdpy_dev);
806 mdev_unregister_driver(&mdpy_driver);
807 cdev_del(&mdpy_cdev);
808 unregister_chrdev_region(mdpy_devt, MINORMASK + 1);
809 class_destroy(mdpy_class);
810 mdpy_class = NULL;
811}
812
813module_init(mdpy_dev_init)
814module_exit(mdpy_dev_exit)