Skip to contentSkip to conversation

staging: vboxvideo: Address various review remarks

PATCH In review Hans de Goede 2 participants 9 messages Oct 22, 2018 Staging

lore
Share & tools
lore
#1 lore raw

PATCH 1/6 staging: vboxvideo: Cleanup header use

Stop adding -Iinclude/drm to the CFLAGS and stop using the obsolete "include-all" drm/drmP.h header.

---
 drivers/staging/vboxvideo/Makefile   | 2 --
 drivers/staging/vboxvideo/vbox_drv.c | 1 -
 drivers/staging/vboxvideo/vbox_drv.h | 2 +-
 drivers/staging/vboxvideo/vbox_fb.c  | 1 -
 drivers/staging/vboxvideo/vbox_ttm.c | 4 +++-
 5 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/vboxvideo/Makefile +0 -2
index 3f6094aa9cdf..1224f313af0c 100644
@@ -1,6 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Iinclude/drm
-
 vboxvideo-y :=  hgsmi_base.o modesetting.o vbva_base.o \
 		vbox_drv.o vbox_fb.o vbox_hgsmi.o vbox_irq.o vbox_main.o \
 		vbox_mode.o vbox_prime.o vbox_ttm.o
drivers/staging/vboxvideo/vbox_drv.c +0 -1
index d7440b9e5eea..9997beac00fb 100644
@@ -11,7 +11,6 @@
 #include <linux/console.h>
 #include <linux/vt_kern.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc_helper.h>
 
 #include "vbox_drv.h"
drivers/staging/vboxvideo/vbox_drv.h +1 -1
index f82e594eca4b..cb0bc9201a7f 100644
@@ -12,10 +12,10 @@
 
 #include <linux/genalloc.h>
 #include <linux/io.h>
+#include <linux/irqreturn.h>
 #include <linux/string.h>
 #include <linux/version.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_encoder.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_gem.h>
drivers/staging/vboxvideo/vbox_fb.c +0 -1
index 8041d0c46a6b..af224eb5ebc1 100644
@@ -17,7 +17,6 @@
 #include <linux/fb.h>
 #include <linux/init.h>
 
-#include <drm/drmP.h>
 #include <drm/drm_crtc.h>
 #include <drm/drm_fb_helper.h>
 #include <drm/drm_crtc_helper.h>
drivers/staging/vboxvideo/vbox_ttm.c +3 -1
index 74f2d271ddac..edc8686454bf 100644
@@ -6,8 +6,10 @@
  * Authors: Dave Airlie <[email protected]>
  *          Michael Thayer <[email protected]>
  */
+#include <linux/pci.h>
+#include <drm/drm_file.h>
+#include <drm/ttm/ttm_page_alloc.h>
 #include "vbox_drv.h"
-#include <ttm/ttm_page_alloc.h>
 
 static inline struct vbox_private *vbox_bdev(struct ttm_bo_device *bd)
 {
Signature · 1 line
2.19.0
#2 lore raw

PATCH 2/6 staging: vboxvideo: Use PCI_DEVICE() for our pci_id table

In reply to Hans de Goede

Use PCI_DEVICE() for our pci_id table and also simplify the terminating entry tio just "{ }".

---
 drivers/staging/vboxvideo/vbox_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/vboxvideo/vbox_drv.c +2 -2
index 9997beac00fb..f9f4c6c2a4e9 100644
@@ -23,8 +23,8 @@ 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},
+	{ PCI_DEVICE(0x80ee, 0xbeef) },
+	{ }
 };
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
Signature · 6 lines
2.19.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#3 lore raw

PATCH 3/6 staging: vboxvideo: Fixup some #ifdef-s

In reply to Hans de Goede

Add #ifdef CONFIG_PM_SLEEP around the suspend/hibernate functions.

Remove unnecessary #ifdef CONFIG_COMPAT, the .compat_ioctl member is always available and if CONFIG_COMPAT is not set then drm_compat_ioctl is defined to NULL.

---
 drivers/staging/vboxvideo/vbox_drv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/vboxvideo/vbox_drv.c +5 -3
index f9f4c6c2a4e9..b6e6530aa4be 100644
@@ -117,6 +117,7 @@ static void vbox_pci_remove(struct pci_dev *pdev)
 	drm_dev_put(&vbox->ddev);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int vbox_pm_suspend(struct device *dev)
 {
 	struct vbox_private *vbox = dev_get_drvdata(dev);
@@ -172,13 +173,16 @@ static const struct dev_pm_ops vbox_pm_ops = {
 	.poweroff = vbox_pm_poweroff,
 	.restore = vbox_pm_resume,
 };
+#endif
 
 static struct pci_driver vbox_pci_driver = {
 	.name = DRIVER_NAME,
 	.id_table = pciidlist,
 	.probe = vbox_pci_probe,
 	.remove = vbox_pci_remove,
+#ifdef CONFIG_PM_SLEEP
 	.driver.pm = &vbox_pm_ops,
+#endif
 };
 
 static const struct file_operations vbox_fops = {
@@ -186,11 +190,9 @@ static const struct file_operations vbox_fops = {
 	.open = drm_open,
 	.release = drm_release,
 	.unlocked_ioctl = drm_ioctl,
+	.compat_ioctl = drm_compat_ioctl,
 	.mmap = vbox_mmap,
 	.poll = drm_poll,
-#ifdef CONFIG_COMPAT
-	.compat_ioctl = drm_compat_ioctl,
-#endif
 	.read = drm_read,
 };
 
Signature · 1 line
2.19.0
#4 lore raw

Re: [PATCH 3/6] staging: vboxvideo: Fixup some #ifdef-s

Quoted 17 lines · Hans de Goede

Add #ifdef CONFIG_PM_SLEEP around the suspend/hibernate functions.

Remove unnecessary #ifdef CONFIG_COMPAT, the .compat_ioctl member is always available and if CONFIG_COMPAT is not set then drm_compat_ioctl is defined to NULL.

---
 drivers/staging/vboxvideo/vbox_drv.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/vboxvideo/vbox_drv.c +0 -0
index f9f4c6c2a4e9..b6e6530aa4be 100644

drivers/staging/vboxvideo/vbox_drv.c static void vbox_pci_remove(struct pci_dev *pdev) · line 121

Quoted 5 lines
drivers/staging/vboxvideo/vbox_drv.c +1 -0
@@ -117,6 +117,7 @@ static void vbox_pci_remove(struct pci_dev *pdev)
        drm_dev_put(&vbox->ddev);
 }
 
+#ifdef CONFIG_PM_SLEEP
 static int vbox_pm_suspend(struct device *dev)

AFAICT Arnd has been annotating these as __maybe_unused

-Emil
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#5 lore raw

Re: [PATCH 3/6] staging: vboxvideo: Fixup some #ifdef-s

Hi,

Quoted 21 lines · Emil Velikov
Quoted 20 lines · Hans de Goede

Add #ifdef CONFIG_PM_SLEEP around the suspend/hibernate functions.

Remove unnecessary #ifdef CONFIG_COMPAT, the .compat_ioctl member is always available and if CONFIG_COMPAT is not set then drm_compat_ioctl is defined to NULL.

---
  drivers/staging/vboxvideo/vbox_drv.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/staging/vboxvideo/vbox_drv.c +0 -0
index f9f4c6c2a4e9..b6e6530aa4be 100644
@@ -117,6 +117,7 @@ static void vbox_pci_remove(struct pci_dev *pdev)
         drm_dev_put(&vbox->ddev);
  }
 
Quoted 4 lines

drivers/staging/vboxvideo/vbox_drv.c static void vbox_pci_remove(struct pci_dev *pdev) · line 121

Quoted 2 lines
drivers/staging/vboxvideo/vbox_drv.c +1 -0
+#ifdef CONFIG_PM_SLEEP
  static int vbox_pm_suspend(struct device *dev)

AFAICT Arnd has been annotating these as __maybe_unused

That only works in combinations with a macro like SET_SYSTEM_SLEEP_PM_OPS(), which makes sure that we do not actually set the .suspend, etc. members of dev_pm_ops when CONFIG_PM_SLEEP is not set, so that the code actually gets compiled out.

We cannot use SET_SYSTEM_SLEEP_PM_OPS here, since the suspend and hibernate paths differ.

Regards,

Hans

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#6 lore raw

PATCH 4/6 staging: vboxvideo: Add myself as MODULE_AUTHOR

In reply to Hans de Goede

Add myself as MODULE_AUTHOR.

---
 drivers/staging/vboxvideo/vbox_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/vboxvideo/vbox_drv.c +1 -0
index b6e6530aa4be..80d7395e48dc 100644
@@ -277,5 +277,6 @@ module_init(vbox_init);
 module_exit(vbox_exit);
 
 MODULE_AUTHOR("Oracle Corporation");
+MODULE_AUTHOR("Hans de Goede <[email protected]>");
 MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL and additional rights");
Signature · 1 line
2.19.0
#7 lore raw

PATCH 5/6 staging: vboxvideo: Drop DRM_MODE_FB_CMD define

In reply to Hans de Goede

This is a leftover from when the driver was out of tree and also build against older kernels.

---
 drivers/staging/vboxvideo/vbox_drv.h  | 4 +---
 drivers/staging/vboxvideo/vbox_fb.c   | 2 +-
 drivers/staging/vboxvideo/vbox_main.c | 2 +-
 3 files changed, 3 insertions(+), 5 deletions(-)
drivers/staging/vboxvideo/vbox_drv.h +1 -3
index cb0bc9201a7f..e2a6b2b5bfc3 100644
@@ -164,8 +164,6 @@ void vbox_hw_fini(struct vbox_private *vbox);
 int vbox_mode_init(struct vbox_private *vbox);
 void vbox_mode_fini(struct vbox_private *vbox);
 
-#define DRM_MODE_FB_CMD drm_mode_fb_cmd2
-
 void vbox_report_caps(struct vbox_private *vbox);
 
 void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
@@ -174,7 +172,7 @@ void vbox_framebuffer_dirty_rectangles(struct drm_framebuffer *fb,
 
 int vbox_framebuffer_init(struct vbox_private *vbox,
 			  struct vbox_framebuffer *vbox_fb,
-			  const struct DRM_MODE_FB_CMD *mode_cmd,
+			  const struct drm_mode_fb_cmd2 *mode_cmd,
 			  struct drm_gem_object *obj);
 
 int vboxfb_create(struct drm_fb_helper *helper,
drivers/staging/vboxvideo/vbox_fb.c +1 -1
index af224eb5ebc1..d3a5255c93b6 100644
@@ -51,7 +51,7 @@ int vboxfb_create(struct drm_fb_helper *helper,
 	struct vbox_private *vbox =
 		container_of(helper, struct vbox_private, fb_helper);
 	struct pci_dev *pdev = vbox->ddev.pdev;
-	struct DRM_MODE_FB_CMD mode_cmd;
+	struct drm_mode_fb_cmd2 mode_cmd;
 	struct drm_framebuffer *fb;
 	struct fb_info *info;
 	struct drm_gem_object *gobj;
drivers/staging/vboxvideo/vbox_main.c +1 -1
index 1328f82a083d..8348e71c4c9d 100644
@@ -103,7 +103,7 @@ static const struct drm_framebuffer_funcs vbox_fb_funcs = {
 
 int vbox_framebuffer_init(struct vbox_private *vbox,
 			  struct vbox_framebuffer *vbox_fb,
-			  const struct DRM_MODE_FB_CMD *mode_cmd,
+			  const struct drm_mode_fb_cmd2 *mode_cmd,
 			  struct drm_gem_object *obj)
 {
 	int ret;
Signature · 6 lines
2.19.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#8 lore raw

PATCH 6/6 staging: vboxvideo: Use DRM_FB_HELPER_DEFAULT_OPS

In reply to Hans de Goede

Use DRM_FB_HELPER_DEFAULT_OPS rather then open-coding it.

---
 drivers/staging/vboxvideo/vbox_fb.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/staging/vboxvideo/vbox_fb.c +1 -7
index d3a5255c93b6..8a2f2e8b57c1 100644
@@ -33,16 +33,10 @@ static struct fb_deferred_io vbox_defio = {
 
 static struct fb_ops vboxfb_ops = {
 	.owner = THIS_MODULE,
-	.fb_check_var = drm_fb_helper_check_var,
-	.fb_set_par = drm_fb_helper_set_par,
+	DRM_FB_HELPER_DEFAULT_OPS,
 	.fb_fillrect = drm_fb_helper_sys_fillrect,
 	.fb_copyarea = drm_fb_helper_sys_copyarea,
 	.fb_imageblit = drm_fb_helper_sys_imageblit,
-	.fb_pan_display = drm_fb_helper_pan_display,
-	.fb_blank = drm_fb_helper_blank,
-	.fb_setcmap = drm_fb_helper_setcmap,
-	.fb_debug_enter = drm_fb_helper_debug_enter,
-	.fb_debug_leave = drm_fb_helper_debug_leave,
 };
 
 int vboxfb_create(struct drm_fb_helper *helper,
Signature · 6 lines
2.19.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel