[vbox-dev] [PATCH 2/7] Additions: linux/drm: Change vbox_drv.h to kernel coding style
Hans de Goede
hdegoede at redhat.com
Thu Jun 8 19:08:09 UTC 2017
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 <hdegoede at redhat.com>
---
src/VBox/Additions/linux/drm/vbox_drv.h | 267 ++++++++++++++++----------------
1 file changed, 133 insertions(+), 134 deletions(-)
diff --git a/src/VBox/Additions/linux/drm/vbox_drv.h b/src/VBox/Additions/linux/drm/vbox_drv.h
index d21cded6..0d411b18 100644
--- a/src/VBox/Additions/linux/drm/vbox_drv.h
+++ b/src/VBox/Additions/linux/drm/vbox_drv.h
@@ -49,14 +49,12 @@
#include <drm/ttm/ttm_module.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 18, 0)
-# include <drm/drm_gem.h>
+#include <drm/drm_gem.h>
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 11, 0)
-# include <drm/drm_encoder.h>
+#include <drm/drm_encoder.h>
#endif
-/* #include "vboxvideo.h" */
-
#include "product-generated.h"
#define DRIVER_AUTHOR VBOX_VENDOR
@@ -71,64 +69,69 @@
#define VBOX_MAX_CURSOR_WIDTH 64
#define VBOX_MAX_CURSOR_HEIGHT 64
-#define CURSOR_PIXEL_COUNT VBOX_MAX_CURSOR_WIDTH * VBOX_MAX_CURSOR_HEIGHT
-#define CURSOR_DATA_SIZE CURSOR_PIXEL_COUNT * 4 + CURSOR_PIXEL_COUNT / 8
+#define CURSOR_PIXEL_COUNT (VBOX_MAX_CURSOR_WIDTH * VBOX_MAX_CURSOR_HEIGHT)
+#define CURSOR_DATA_SIZE (CURSOR_PIXEL_COUNT * 4 + CURSOR_PIXEL_COUNT / 8)
#define VBOX_MAX_SCREENS 32
-#define GUEST_HEAP_OFFSET(vbox) (vbox->full_vram_size - VBVA_ADAPTER_INFORMATION_SIZE)
+#define GUEST_HEAP_OFFSET(vbox) ((vbox)->full_vram_size - \
+ VBVA_ADAPTER_INFORMATION_SIZE)
#define GUEST_HEAP_SIZE VBVA_ADAPTER_INFORMATION_SIZE
#define GUEST_HEAP_USABLE_SIZE (VBVA_ADAPTER_INFORMATION_SIZE - \
- sizeof(HGSMIHOSTFLAGS))
+ sizeof(HGSMIHOSTFLAGS))
#define HOST_FLAGS_OFFSET GUEST_HEAP_USABLE_SIZE
struct vbox_fbdev;
struct vbox_private {
- struct drm_device *dev;
-
- u8 __iomem *guest_heap;
- u8 __iomem *vbva_buffers;
- struct gen_pool *guest_pool;
- struct VBVABUFFERCONTEXT *vbva_info;
- bool any_pitch;
- unsigned num_crtcs;
- /** Amount of available VRAM, including space used for buffers. */
- uint32_t full_vram_size;
- /** Amount of available VRAM, not including space used for buffers. */
- uint32_t available_vram_size;
- /** Array of structures for receiving mode hints. */
- VBVAMODEHINT *last_mode_hints;
-
- struct vbox_fbdev *fbdev;
-
- int fb_mtrr;
-
- struct {
- struct drm_global_reference mem_global_ref;
- struct ttm_bo_global_ref bo_global_ref;
- struct ttm_bo_device bdev;
- bool mm_initialised;
- } ttm;
-
- struct mutex hw_mutex;
- bool isr_installed;
- /** We decide whether or not user-space supports display hot-plug
- * depending on whether they react to a hot-plug event after the initial
- * mode query. */
- bool initial_mode_queried;
- struct work_struct hotplug_work;
- uint32_t input_mapping_width;
- uint32_t input_mapping_height;
- /** Is user-space using an X.Org-style layout of one large frame-buffer
- * encompassing all screen ones or is the fbdev console active? */
- bool single_framebuffer;
- uint32_t cursor_width;
- uint32_t cursor_height;
- uint32_t cursor_hot_x;
- uint32_t cursor_hot_y;
- size_t cursor_data_size;
- uint8_t cursor_data[CURSOR_DATA_SIZE];
+ struct drm_device *dev;
+
+ u8 __iomem *guest_heap;
+ u8 __iomem *vbva_buffers;
+ struct gen_pool *guest_pool;
+ struct VBVABUFFERCONTEXT *vbva_info;
+ bool any_pitch;
+ unsigned int num_crtcs;
+ /** Amount of available VRAM, including space used for buffers. */
+ u32 full_vram_size;
+ /** Amount of available VRAM, not including space used for buffers. */
+ u32 available_vram_size;
+ /** Array of structures for receiving mode hints. */
+ VBVAMODEHINT *last_mode_hints;
+
+ struct vbox_fbdev *fbdev;
+
+ int fb_mtrr;
+
+ struct {
+ struct drm_global_reference mem_global_ref;
+ struct ttm_bo_global_ref bo_global_ref;
+ struct ttm_bo_device bdev;
+ bool mm_initialised;
+ } ttm;
+
+ struct mutex hw_mutex; /* protects modeset and accel/vbva accesses */
+ bool isr_installed;
+ /**
+ * We decide whether or not user-space supports display hot-plug
+ * depending on whether they react to a hot-plug event after the initial
+ * mode query.
+ */
+ bool initial_mode_queried;
+ struct work_struct hotplug_work;
+ u32 input_mapping_width;
+ u32 input_mapping_height;
+ /**
+ * Is user-space using an X.Org-style layout of one large frame-buffer
+ * encompassing all screen ones or is the fbdev console active?
+ */
+ bool single_framebuffer;
+ u32 cursor_width;
+ u32 cursor_height;
+ u32 cursor_hot_x;
+ u32 cursor_hot_y;
+ size_t cursor_data_size;
+ u8 cursor_data[CURSOR_DATA_SIZE];
};
#undef CURSOR_PIXEL_COUNT
@@ -145,48 +148,48 @@ void vbox_driver_lastclose(struct drm_device *dev);
struct vbox_gem_object;
#ifndef VGA_PORT_HGSMI_HOST
-# define VGA_PORT_HGSMI_HOST 0x3b0
-# define VGA_PORT_HGSMI_GUEST 0x3d0
+#define VGA_PORT_HGSMI_HOST 0x3b0
+#define VGA_PORT_HGSMI_GUEST 0x3d0
#endif
struct vbox_connector {
- struct drm_connector base;
- char name[32];
- struct vbox_crtc *vbox_crtc;
- struct {
- uint16_t width;
- uint16_t height;
- bool disconnected;
- } mode_hint;
+ struct drm_connector base;
+ char name[32];
+ struct vbox_crtc *vbox_crtc;
+ struct {
+ u16 width;
+ u16 height;
+ bool disconnected;
+ } mode_hint;
};
struct vbox_crtc {
- struct drm_crtc base;
- bool blanked;
- bool disconnected;
- unsigned crtc_id;
- uint32_t fb_offset;
- bool cursor_enabled;
- uint16_t x_hint;
- uint16_t y_hint;
+ struct drm_crtc base;
+ bool blanked;
+ bool disconnected;
+ unsigned int crtc_id;
+ u32 fb_offset;
+ bool cursor_enabled;
+ u16 x_hint;
+ u16 y_hint;
};
struct vbox_encoder {
- struct drm_encoder base;
+ struct drm_encoder base;
};
struct vbox_framebuffer {
- struct drm_framebuffer base;
- struct drm_gem_object *obj;
+ struct drm_framebuffer base;
+ struct drm_gem_object *obj;
};
struct vbox_fbdev {
- struct drm_fb_helper helper;
- struct vbox_framebuffer afb;
- int size;
- struct ttm_bo_kmap_obj mapping;
- int x1, y1, x2, y2; /* dirty rect */
- spinlock_t dirty_lock;
+ struct drm_fb_helper helper;
+ struct vbox_framebuffer afb;
+ int size;
+ struct ttm_bo_kmap_obj mapping;
+ int x1, y1, x2, y2; /* dirty rect */
+ spinlock_t dirty_lock;
};
#define to_vbox_crtc(x) container_of(x, struct vbox_crtc, base)
@@ -194,19 +197,19 @@ struct vbox_fbdev {
#define to_vbox_encoder(x) container_of(x, struct vbox_encoder, base)
#define to_vbox_framebuffer(x) container_of(x, struct vbox_framebuffer, base)
-extern int vbox_mode_init(struct drm_device *dev);
-extern void vbox_mode_fini(struct drm_device *dev);
+int vbox_mode_init(struct drm_device *dev);
+void vbox_mode_fini(struct drm_device *dev);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0)
-# define DRM_MODE_FB_CMD drm_mode_fb_cmd
+#define DRM_MODE_FB_CMD drm_mode_fb_cmd
#else
-# define DRM_MODE_FB_CMD drm_mode_fb_cmd2
+#define DRM_MODE_FB_CMD drm_mode_fb_cmd2
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 15, 0)
-# define CRTC_FB(crtc) (crtc)->fb
+#define CRTC_FB(crtc) ((crtc)->fb)
#else
-# define CRTC_FB(crtc) (crtc)->primary->fb
+#define CRTC_FB(crtc) ((crtc)->primary->fb)
#endif
void vbox_enable_accel(struct vbox_private *vbox);
@@ -214,16 +217,16 @@ void vbox_disable_accel(struct vbox_private *vbox);
void vbox_report_caps(struct vbox_private *vbox);
void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
- struct drm_clip_rect *rects,
- unsigned num_rects);
+ struct drm_clip_rect *rects,
+ unsigned int num_rects);
int vbox_framebuffer_init(struct drm_device *dev,
- struct vbox_framebuffer *vbox_fb,
+ struct vbox_framebuffer *vbox_fb,
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
- const
+ const
#endif
- struct DRM_MODE_FB_CMD *mode_cmd,
- struct drm_gem_object *obj);
+ struct DRM_MODE_FB_CMD *mode_cmd,
+ struct drm_gem_object *obj);
int vbox_fbdev_init(struct drm_device *dev);
void vbox_fbdev_fini(struct drm_device *dev);
@@ -231,42 +234,39 @@ void vbox_fbdev_set_suspend(struct drm_device *dev, int state);
void vbox_fbdev_set_base(struct vbox_private *vbox, unsigned long gpu_addr);
struct vbox_bo {
- struct ttm_buffer_object bo;
- struct ttm_placement placement;
- struct ttm_bo_kmap_obj kmap;
- struct drm_gem_object gem;
+ struct ttm_buffer_object bo;
+ struct ttm_placement placement;
+ struct ttm_bo_kmap_obj kmap;
+ struct drm_gem_object gem;
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
- u32 placements[3];
+ u32 placements[3];
#else
- struct ttm_place placements[3];
+ struct ttm_place placements[3];
#endif
- int pin_count;
+ int pin_count;
};
+
#define gem_to_vbox_bo(gobj) container_of((gobj), struct vbox_bo, gem)
-static inline struct vbox_bo *
-vbox_bo(struct ttm_buffer_object *bo)
+static inline struct vbox_bo *vbox_bo(struct ttm_buffer_object *bo)
{
- return container_of(bo, struct vbox_bo, bo);
+ return container_of(bo, struct vbox_bo, bo);
}
-
#define to_vbox_obj(x) container_of(x, struct vbox_gem_object, base)
-extern int vbox_dumb_create(struct drm_file *file,
- struct drm_device *dev,
- struct drm_mode_create_dumb *args);
+int vbox_dumb_create(struct drm_file *file,
+ struct drm_device *dev,
+ struct drm_mode_create_dumb *args);
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 12, 0)
-extern int vbox_dumb_destroy(struct drm_file *file,
- struct drm_device *dev,
- uint32_t handle);
+int vbox_dumb_destroy(struct drm_file *file,
+ struct drm_device *dev, u32 handle);
#endif
-extern void vbox_gem_free_object(struct drm_gem_object *obj);
-extern int vbox_dumb_mmap_offset(struct drm_file *file,
- struct drm_device *dev,
- uint32_t handle,
- uint64_t *offset);
+void vbox_gem_free_object(struct drm_gem_object *obj);
+int vbox_dumb_mmap_offset(struct drm_file *file,
+ struct drm_device *dev,
+ u32 handle, u64 *offset);
#define DRM_FILE_PAGE_OFFSET (0x10000000ULL >> PAGE_SHIFT)
@@ -274,62 +274,61 @@ int vbox_mm_init(struct vbox_private *vbox);
void vbox_mm_fini(struct vbox_private *vbox);
int vbox_bo_create(struct drm_device *dev, int size, int align,
- uint32_t flags, struct vbox_bo **pvboxbo);
+ u32 flags, struct vbox_bo **pvboxbo);
int vbox_gem_create(struct drm_device *dev,
- u32 size, bool iskernel,
- struct drm_gem_object **obj);
+ u32 size, bool iskernel, struct drm_gem_object **obj);
int vbox_bo_pin(struct vbox_bo *bo, u32 pl_flag, u64 *gpu_addr);
int vbox_bo_unpin(struct vbox_bo *bo);
static inline int vbox_bo_reserve(struct vbox_bo *bo, bool no_wait)
{
- int ret;
+ int ret;
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 7, 0)
- ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL);
+ ret = ttm_bo_reserve(&bo->bo, true, no_wait, NULL);
#else
- ret = ttm_bo_reserve(&bo->bo, true, no_wait, false, 0);
+ ret = ttm_bo_reserve(&bo->bo, true, no_wait, false, 0);
#endif
- if (ret)
- {
- if (ret != -ERESTARTSYS && ret != -EBUSY)
- DRM_ERROR("reserve failed %p\n", bo);
- return ret;
- }
- return 0;
+ if (ret) {
+ if (ret != -ERESTARTSYS && ret != -EBUSY)
+ DRM_ERROR("reserve failed %p\n", bo);
+ return ret;
+ }
+ return 0;
}
static inline void vbox_bo_unreserve(struct vbox_bo *bo)
{
- ttm_bo_unreserve(&bo->bo);
+ ttm_bo_unreserve(&bo->bo);
}
void vbox_ttm_placement(struct vbox_bo *bo, int domain);
int vbox_bo_push_sysram(struct vbox_bo *bo);
int vbox_mmap(struct file *filp, struct vm_area_struct *vma);
-/*vbox_prime*/
+/* vbox_prime.c */
int vbox_gem_prime_pin(struct drm_gem_object *obj);
void vbox_gem_prime_unpin(struct drm_gem_object *obj);
struct sg_table *vbox_gem_prime_get_sg_table(struct drm_gem_object *obj);
-struct drm_gem_object *vbox_gem_prime_import_sg_table(
- struct drm_device *dev,
+struct drm_gem_object *vbox_gem_prime_import_sg_table(struct drm_device *dev,
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0)
- size_t size,
+ size_t size,
#else
- struct dma_buf_attachment *attach,
+ struct dma_buf_attachment
+ *attach,
#endif
- struct sg_table *table);
+ struct sg_table *table);
void *vbox_gem_prime_vmap(struct drm_gem_object *obj);
void vbox_gem_prime_vunmap(struct drm_gem_object *obj, void *vaddr);
int vbox_gem_prime_mmap(struct drm_gem_object *obj,
- struct vm_area_struct *area);
+ struct vm_area_struct *area);
/* vbox_irq.c */
int vbox_irq_init(struct vbox_private *vbox);
void vbox_irq_fini(struct vbox_private *vbox);
void vbox_report_hotplug(struct vbox_private *vbox);
irqreturn_t vbox_irq_handler(int irq, void *arg);
+
#endif
--
2.13.0
More information about the vbox-dev
mailing list