Skip to contentSkip to conversation

drm: gm12u320: Some minor cleanups

PATCH In review Hans de Goede 2 participants 6 messages Jul 30, 2019 – Aug 12, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm: gm12u320: Some minor cleanups

3 small cleanups:

1) Drop unused DRIVER_PATCHLEVEL
2) We do not set mode_config.preferred_depth, so instead of passing the unset mode_config.preferred_depth to drm_fbdev_generic_setup simply pass 0
3) Use __maybe_unused instead of #ifdef CONFIG_PM around the suspend / resume functions

---
 drivers/gpu/drm/gm12u320/gm12u320.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
drivers/gpu/drm/gm12u320/gm12u320.c +4 -7
index 3dfe86defefc..a60854d7c14c 100644
@@ -33,7 +33,6 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)");
 #define DRIVER_DATE		"2019"
 #define DRIVER_MAJOR		1
 #define DRIVER_MINOR		0
-#define DRIVER_PATCHLEVEL	1
 
 /*
  * The DLP has an actual width of 854 pixels, but that is not a multiple
@@ -747,7 +746,7 @@ static int gm12u320_usb_probe(struct usb_interface *interface,
 	if (ret)
 		goto err_put;
 
-	drm_fbdev_generic_setup(dev, dev->mode_config.preferred_depth);
+	drm_fbdev_generic_setup(dev, 0);
 
 	return 0;
 
@@ -766,9 +765,8 @@ static void gm12u320_usb_disconnect(struct usb_interface *interface)
 	drm_dev_put(dev);
 }
 
-#ifdef CONFIG_PM
-static int gm12u320_suspend(struct usb_interface *interface,
-			    pm_message_t message)
+static __maybe_unused int gm12u320_suspend(struct usb_interface *interface,
+					   pm_message_t message)
 {
 	struct drm_device *dev = usb_get_intfdata(interface);
 	struct gm12u320_device *gm12u320 = dev->dev_private;
@@ -779,7 +777,7 @@ static int gm12u320_suspend(struct usb_interface *interface,
 	return 0;
 }
 
-static int gm12u320_resume(struct usb_interface *interface)
+static __maybe_unused int gm12u320_resume(struct usb_interface *interface)
 {
 	struct drm_device *dev = usb_get_intfdata(interface);
 	struct gm12u320_device *gm12u320 = dev->dev_private;
@@ -790,7 +788,6 @@ static int gm12u320_resume(struct usb_interface *interface)
 
 	return 0;
 }
-#endif
 
 static const struct usb_device_id id_table[] = {
 	{ USB_DEVICE(0x1de1, 0xc102) },
Signature · 6 lines
2.21.0

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

PATCH 2/2 drm: gm12u320: Use DRM_DEV_ERROR everywhere

Previously the driver was using a mix of DRM_ERROR and dev_err, be consisent and use DRM_DEV_ERROR everywhere instead.

---
 drivers/gpu/drm/gm12u320/gm12u320.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)
drivers/gpu/drm/gm12u320/gm12u320.c +10 -7
index a60854d7c14c..4c47aa4de09b 100644
@@ -44,6 +44,9 @@ MODULE_PARM_DESC(eco_mode, "Turn on Eco mode (less bright, more silent)");
 
 #define GM12U320_BLOCK_COUNT		20
 
+#define GM12U320_ERR(fmt, ...) \
+	DRM_DEV_ERROR(&gm12u320->udev->dev, fmt, ##__VA_ARGS__)
+
 #define MISC_RCV_EPT			1
 #define DATA_RCV_EPT			2
 #define DATA_SND_EPT			3
@@ -219,7 +222,7 @@ static int gm12u320_misc_request(struct gm12u320_device *gm12u320,
 			   usb_sndbulkpipe(gm12u320->udev, MISC_SND_EPT),
 			   gm12u320->cmd_buf, CMD_SIZE, &len, CMD_TIMEOUT);
 	if (ret || len != CMD_SIZE) {
-		dev_err(&gm12u320->udev->dev, "Misc. req. error %d\n", ret);
+		GM12U320_ERR("Misc. req. error %d\n", ret);
 		return -EIO;
 	}
 
@@ -229,7 +232,7 @@ static int gm12u320_misc_request(struct gm12u320_device *gm12u320,
 			   gm12u320->cmd_buf, MISC_VALUE_SIZE, &len,
 			   DATA_TIMEOUT);
 	if (ret || len != MISC_VALUE_SIZE) {
-		dev_err(&gm12u320->udev->dev, "Misc. value error %d\n", ret);
+		GM12U320_ERR("Misc. value error %d\n", ret);
 		return -EIO;
 	}
 	/* cmd_buf[0] now contains the read value, which we don't use */
@@ -240,7 +243,7 @@ static int gm12u320_misc_request(struct gm12u320_device *gm12u320,
 			   gm12u320->cmd_buf, READ_STATUS_SIZE, &len,
 			   CMD_TIMEOUT);
 	if (ret || len != READ_STATUS_SIZE) {
-		dev_err(&gm12u320->udev->dev, "Misc. status error %d\n", ret);
+		GM12U320_ERR("Misc. status error %d\n", ret);
 		return -EIO;
 	}
 
@@ -277,7 +280,7 @@ static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
 
 	vaddr = drm_gem_shmem_vmap(fb->obj[0]);
 	if (IS_ERR(vaddr)) {
-		DRM_ERROR("failed to vmap fb: %ld\n", PTR_ERR(vaddr));
+		GM12U320_ERR("failed to vmap fb: %ld\n", PTR_ERR(vaddr));
 		goto put_fb;
 	}
 
@@ -285,7 +288,7 @@ static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
 		ret = dma_buf_begin_cpu_access(
 			fb->obj[0]->import_attach->dmabuf, DMA_FROM_DEVICE);
 		if (ret) {
-			DRM_ERROR("dma_buf_begin_cpu_access err: %d\n", ret);
+			GM12U320_ERR("dma_buf_begin_cpu_access err: %d\n", ret);
 			goto vunmap;
 		}
 	}
@@ -328,7 +331,7 @@ static void gm12u320_copy_fb_to_blocks(struct gm12u320_device *gm12u320)
 		ret = dma_buf_end_cpu_access(fb->obj[0]->import_attach->dmabuf,
 					     DMA_FROM_DEVICE);
 		if (ret)
-			DRM_ERROR("dma_buf_end_cpu_access err: %d\n", ret);
+			GM12U320_ERR("dma_buf_end_cpu_access err: %d\n", ret);
 	}
 vunmap:
 	drm_gem_shmem_vunmap(fb->obj[0], vaddr);
@@ -430,7 +433,7 @@ static void gm12u320_fb_update_work(struct work_struct *work)
 err:
 	/* Do not log errors caused by module unload or device unplug */
 	if (ret != -ECONNRESET && ret != -ESHUTDOWN)
-		dev_err(&gm12u320->udev->dev, "Frame update error: %d\n", ret);
+		GM12U320_ERR("Frame update error: %d\n", ret);
 }
 
 static void gm12u320_fb_mark_dirty(struct drm_framebuffer *fb,
Signature · 6 lines
2.21.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm: gm12u320: Use DRM_DEV_ERROR everywhere

Quoted 6 lines · Hans de Goede

Previously the driver was using a mix of DRM_ERROR and dev_err, be consisent and use DRM_DEV_ERROR everywhere instead.

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

Reviewed-by on v1 1/2
#3 lore raw
In reply to Hans de Goede

Hi Hans.

Quoted 11 lines · Hans de Goede

3 small cleanups:

1) Drop unused DRIVER_PATCHLEVEL
2) We do not set mode_config.preferred_depth, so instead of passing the unset mode_config.preferred_depth to drm_fbdev_generic_setup simply pass 0
3) Use __maybe_unused instead of #ifdef CONFIG_PM around the suspend / resume functions

If you add:

And adjust to the new location.

Then this is:

Quoted 1 line

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

#4 lore raw

Hi,

Quoted 12 lines · Sam Ravnborg

Hi Hans.

Quoted 9 lines · Hans de Goede

3 small cleanups:

1) Drop unused DRIVER_PATCHLEVEL
2) We do not set mode_config.preferred_depth, so instead of passing the unset mode_config.preferred_depth to drm_fbdev_generic_setup simply pass 0
3) Use __maybe_unused instead of #ifdef CONFIG_PM around the suspend / resume functions

Quoted 8 lines
Quoted 2 lines

If you add:

And adjust to the new location.

Then this is:

Thank you for the review. I will push this to drm-misc-next, with the suggested changes, tomorrow (when I'm back behind my workstation which has all the necessary kernel trees).

Regards,

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

#5 lore raw
In reply to Sam Ravnborg

Hi,

Quoted 12 lines · Sam Ravnborg

Hi Hans.

Quoted 9 lines · Hans de Goede

3 small cleanups:

1) Drop unused DRIVER_PATCHLEVEL
2) We do not set mode_config.preferred_depth, so instead of passing the unset mode_config.preferred_depth to drm_fbdev_generic_setup simply pass 0
3) Use __maybe_unused instead of #ifdef CONFIG_PM around the suspend / resume functions

Quoted 8 lines
Quoted 2 lines

If you add:

And adjust to the new location.

Then this is:

I've just pushed these to drm-misc-next, thank you for your input and reviews.

Regards,

Hans

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