This is the result of running linux/scripts/Lindent + manual cleanups. After this the file passes linux/scripts/checkpatch -f except for the LINUX_VERSION_CODE checks.
This patch contains no functional changes, only coding style fixes, including changing uintXX_t types to uXX. Signed-off-by: Hans de Goede <hdego...@redhat.com> --- src/VBox/Additions/linux/drm/vbox_drv.c | 318 ++++++++++++++++---------------- 1 file changed, 161 insertions(+), 157 deletions(-) diff --git a/src/VBox/Additions/linux/drm/vbox_drv.c b/src/VBox/Additions/linux/drm/vbox_drv.c index 00924fe8..b7af0061 100644 --- a/src/VBox/Additions/linux/drm/vbox_drv.c +++ b/src/VBox/Additions/linux/drm/vbox_drv.c @@ -51,133 +51,128 @@ module_param_named(modeset, vbox_modeset, int, 0400); static struct drm_driver driver; -static const struct pci_device_id pciidlist[] = -{ - {0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, - {0, 0, 0}, +static const struct pci_device_id pciidlist[] = { + { 0x80ee, 0xbeef, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, + { 0, 0, 0}, }; - MODULE_DEVICE_TABLE(pci, pciidlist); static int vbox_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) { - return drm_get_pci_dev(pdev, ent, &driver); + return drm_get_pci_dev(pdev, ent, &driver); } - static void vbox_pci_remove(struct pci_dev *pdev) { - struct drm_device *dev = pci_get_drvdata(pdev); + struct drm_device *dev = pci_get_drvdata(pdev); - drm_put_dev(dev); + drm_put_dev(dev); } - - static int vbox_drm_freeze(struct drm_device *dev) { - drm_kms_helper_poll_disable(dev); + drm_kms_helper_poll_disable(dev); - pci_save_state(dev->pdev); + pci_save_state(dev->pdev); - console_lock(); - vbox_fbdev_set_suspend(dev, 1); - console_unlock(); - return 0; + console_lock(); + vbox_fbdev_set_suspend(dev, 1); + console_unlock(); + + return 0; } static int vbox_drm_thaw(struct drm_device *dev) { - int error = 0; + drm_mode_config_reset(dev); + drm_helper_resume_force_mode(dev); - drm_mode_config_reset(dev); - drm_helper_resume_force_mode(dev); + console_lock(); + vbox_fbdev_set_suspend(dev, 0); + console_unlock(); - console_lock(); - vbox_fbdev_set_suspend(dev, 0); - console_unlock(); - return error; + return 0; } static int vbox_drm_resume(struct drm_device *dev) { - int ret; + int ret; + + if (pci_enable_device(dev->pdev)) + return -EIO; - if (pci_enable_device(dev->pdev)) - return -EIO; + ret = vbox_drm_thaw(dev); + if (ret) + return ret; - ret = vbox_drm_thaw(dev); - if (ret) - return ret; + drm_kms_helper_poll_enable(dev); - drm_kms_helper_poll_enable(dev); - return 0; + return 0; } static int vbox_pm_suspend(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - int error; + struct pci_dev *pdev = to_pci_dev(dev); + struct drm_device *ddev = pci_get_drvdata(pdev); + int error; + + error = vbox_drm_freeze(ddev); + if (error) + return error; - error = vbox_drm_freeze(ddev); - if (error) - return error; + pci_disable_device(pdev); + pci_set_power_state(pdev, PCI_D3hot); - pci_disable_device(pdev); - pci_set_power_state(pdev, PCI_D3hot); - return 0; + return 0; } static int vbox_pm_resume(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - return vbox_drm_resume(ddev); + struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); + + return vbox_drm_resume(ddev); } static int vbox_pm_freeze(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); + struct pci_dev *pdev = to_pci_dev(dev); + struct drm_device *ddev = pci_get_drvdata(pdev); - if (!ddev || !ddev->dev_private) - return -ENODEV; - return vbox_drm_freeze(ddev); + if (!ddev || !ddev->dev_private) + return -ENODEV; + return vbox_drm_freeze(ddev); } static int vbox_pm_thaw(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); - return vbox_drm_thaw(ddev); + struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); + + return vbox_drm_thaw(ddev); } static int vbox_pm_poweroff(struct device *dev) { - struct pci_dev *pdev = to_pci_dev(dev); - struct drm_device *ddev = pci_get_drvdata(pdev); + struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev)); - return vbox_drm_freeze(ddev); + return vbox_drm_freeze(ddev); } static const struct dev_pm_ops vbox_pm_ops = { - .suspend = vbox_pm_suspend, - .resume = vbox_pm_resume, - .freeze = vbox_pm_freeze, - .thaw = vbox_pm_thaw, - .poweroff = vbox_pm_poweroff, - .restore = vbox_pm_resume, + .suspend = vbox_pm_suspend, + .resume = vbox_pm_resume, + .freeze = vbox_pm_freeze, + .thaw = vbox_pm_thaw, + .poweroff = vbox_pm_poweroff, + .restore = vbox_pm_resume, }; -static struct pci_driver vbox_pci_driver = -{ - .name = DRIVER_NAME, - .id_table = pciidlist, - .probe = vbox_pci_probe, - .remove = vbox_pci_remove, - .driver.pm = &vbox_pm_ops, +static struct pci_driver vbox_pci_driver = { + .name = DRIVER_NAME, + .id_table = pciidlist, + .probe = vbox_pci_probe, + .remove = vbox_pci_remove, + .driver.pm = &vbox_pm_ops, }; #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) @@ -187,136 +182,145 @@ static struct pci_driver vbox_pci_driver = * EINVAL error. I do not want the code to hang around forever, which is * why I am limiting it to certain kernel versions. We can increase the * limit if some distributions uses old X servers with new kernels. */ -long vbox_ioctl(struct file *filp, - unsigned int cmd, unsigned long arg) +long vbox_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) { - long rc = drm_ioctl(filp, cmd, arg); - if (cmd == DRM_IOCTL_MODE_DIRTYFB && rc == -EINVAL) - return -EOVERFLOW; - return rc; + long rc = drm_ioctl(filp, cmd, arg); + + if (cmd == DRM_IOCTL_MODE_DIRTYFB && rc == -EINVAL) + return -EOVERFLOW; + + return rc; } #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) */ -static const struct file_operations vbox_fops = -{ - .owner = THIS_MODULE, - .open = drm_open, - .release = drm_release, +static const struct file_operations vbox_fops = { + .owner = THIS_MODULE, + .open = drm_open, + .release = drm_release, #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0) - .unlocked_ioctl = vbox_ioctl, + .unlocked_ioctl = vbox_ioctl, #else - .unlocked_ioctl = drm_ioctl, + .unlocked_ioctl = drm_ioctl, #endif - .mmap = vbox_mmap, - .poll = drm_poll, + .mmap = vbox_mmap, + .poll = drm_poll, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) - .fasync = drm_fasync, + .fasync = drm_fasync, #endif #ifdef CONFIG_COMPAT - .compat_ioctl = drm_compat_ioctl, + .compat_ioctl = drm_compat_ioctl, #endif - .read = drm_read, + .read = drm_read, }; static int vbox_master_set(struct drm_device *dev, - struct drm_file *file_priv, - bool from_open) + struct drm_file *file_priv, bool from_open) { - struct vbox_private *vbox = dev->dev_private; - /* We do not yet know whether the new owner can handle hotplug, so we - * do not advertise dynamic modes on the first query and send a - * tentative hotplug notification after that to see if they query again. */ - vbox->initial_mode_queried = false; - mutex_lock(&vbox->hw_mutex); - /* Disable VBVA when someone releases master in case the next person tries - * to do VESA. */ - /** @todo work out if anyone is likely to and whether it will even work. */ - /* Update: we also disable it because if the new master does not do dirty - * rectangle reporting (e.g. old versions of Plymouth) then at least the - * first screen will still be updated. We enable it as soon as we - * receive a dirty rectangle report. */ - vbox_disable_accel(vbox); - mutex_unlock(&vbox->hw_mutex); - return 0; + struct vbox_private *vbox = dev->dev_private; + + /* + * We do not yet know whether the new owner can handle hotplug, so we + * do not advertise dynamic modes on the first query and send a + * tentative hotplug notification after that to see if they query again. + */ + vbox->initial_mode_queried = false; + + mutex_lock(&vbox->hw_mutex); + /* + * Disable VBVA when someone releases master in case the next person + * tries tries to do VESA. + */ + /** @todo work out if anyone is likely to and whether it will work. */ + /* + * Update: we also disable it because if the new master does not do + * dirty rectangle reporting (e.g. old versions of Plymouth) then at + * least the first screen will still be updated. We enable it as soon + * as we receive a dirty rectangle report. + */ + vbox_disable_accel(vbox); + mutex_unlock(&vbox->hw_mutex); + + return 0; } #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0) static void vbox_master_drop(struct drm_device *dev, - struct drm_file *file_priv, - bool from_release) + struct drm_file *file_priv, bool from_release) #else -static void vbox_master_drop(struct drm_device *dev, - struct drm_file *file_priv) +static void vbox_master_drop(struct drm_device *dev, struct drm_file *file_priv) #endif { - struct vbox_private *vbox = dev->dev_private; - /* See vbox_master_set() */ - vbox->initial_mode_queried = false; - mutex_lock(&vbox->hw_mutex); - vbox_disable_accel(vbox); - mutex_unlock(&vbox->hw_mutex); + struct vbox_private *vbox = dev->dev_private; + + /* See vbox_master_set() */ + vbox->initial_mode_queried = false; + + mutex_lock(&vbox->hw_mutex); + vbox_disable_accel(vbox); + mutex_unlock(&vbox->hw_mutex); } -static struct drm_driver driver = -{ - .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_PRIME, - .dev_priv_size = 0, - - .load = vbox_driver_load, - .unload = vbox_driver_unload, - .lastclose = vbox_driver_lastclose, - .master_set = vbox_master_set, - .master_drop = vbox_master_drop, +static struct drm_driver driver = { + .driver_features = + DRIVER_MODESET | DRIVER_GEM | DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | + DRIVER_PRIME, + .dev_priv_size = 0, + + .load = vbox_driver_load, + .unload = vbox_driver_unload, + .lastclose = vbox_driver_lastclose, + .master_set = vbox_master_set, + .master_drop = vbox_master_drop, #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0) - .set_busid = drm_pci_set_busid, + .set_busid = drm_pci_set_busid, #endif - .fops = &vbox_fops, - .irq_handler = vbox_irq_handler, - .name = DRIVER_NAME, - .desc = DRIVER_DESC, - .date = DRIVER_DATE, - .major = DRIVER_MAJOR, - .minor = DRIVER_MINOR, - .patchlevel = DRIVER_PATCHLEVEL, - - .gem_free_object = vbox_gem_free_object, - .dumb_create = vbox_dumb_create, - .dumb_map_offset = vbox_dumb_mmap_offset, + .fops = &vbox_fops, + .irq_handler = vbox_irq_handler, + .name = DRIVER_NAME, + .desc = DRIVER_DESC, + .date = DRIVER_DATE, + .major = DRIVER_MAJOR, + .minor = DRIVER_MINOR, + .patchlevel = DRIVER_PATCHLEVEL, + + .gem_free_object = vbox_gem_free_object, + .dumb_create = vbox_dumb_create, + .dumb_map_offset = vbox_dumb_mmap_offset, #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0) - .dumb_destroy = vbox_dumb_destroy, + .dumb_destroy = vbox_dumb_destroy, #else - .dumb_destroy = drm_gem_dumb_destroy, + .dumb_destroy = drm_gem_dumb_destroy, #endif - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, - .prime_fd_to_handle = drm_gem_prime_fd_to_handle, - .gem_prime_export = drm_gem_prime_export, - .gem_prime_import = drm_gem_prime_import, - .gem_prime_pin = vbox_gem_prime_pin, - .gem_prime_unpin = vbox_gem_prime_unpin, - .gem_prime_get_sg_table = vbox_gem_prime_get_sg_table, - .gem_prime_import_sg_table = vbox_gem_prime_import_sg_table, - .gem_prime_vmap = vbox_gem_prime_vmap, - .gem_prime_vunmap = vbox_gem_prime_vunmap, - .gem_prime_mmap = vbox_gem_prime_mmap, - + .prime_handle_to_fd = drm_gem_prime_handle_to_fd, + .prime_fd_to_handle = drm_gem_prime_fd_to_handle, + .gem_prime_export = drm_gem_prime_export, + .gem_prime_import = drm_gem_prime_import, + .gem_prime_pin = vbox_gem_prime_pin, + .gem_prime_unpin = vbox_gem_prime_unpin, + .gem_prime_get_sg_table = vbox_gem_prime_get_sg_table, + .gem_prime_import_sg_table = vbox_gem_prime_import_sg_table, + .gem_prime_vmap = vbox_gem_prime_vmap, + .gem_prime_vunmap = vbox_gem_prime_vunmap, + .gem_prime_mmap = vbox_gem_prime_mmap, }; static int __init vbox_init(void) { #ifdef CONFIG_VGA_CONSOLE - if (vgacon_text_force() && vbox_modeset == -1) - return -EINVAL; + if (vgacon_text_force() && vbox_modeset == -1) + return -EINVAL; #endif - if (vbox_modeset == 0) - return -EINVAL; + if (vbox_modeset == 0) + return -EINVAL; - return drm_pci_init(&driver, &vbox_pci_driver); + return drm_pci_init(&driver, &vbox_pci_driver); } + static void __exit vbox_exit(void) { - drm_pci_exit(&driver, &vbox_pci_driver); + drm_pci_exit(&driver, &vbox_pci_driver); } module_init(vbox_init); -- 2.13.0 _______________________________________________ vbox-dev mailing list vbox-dev@virtualbox.org https://www.virtualbox.org/mailman/listinfo/vbox-dev