Skip to contentSkip to conversation

drm/amdgpu: use drm_fb helper for console_(un)lock

PATCH In review Shirish S 3 participants 3 messages Jul 20, 2018 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Shirish S

author
#0 lore raw

PATCH 1/1 drm/amdgpu: use drm_fb helper for console_(un)lock

This patch removes the usage of console_(un)lock by replacing drm_fb_helper_set_suspend() to drm_fb_helper_set_suspend_unlocked() which locks and unlocks the console instead of locking ourselves.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c     | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -6
index 022c136..a759b74 100644
@@ -2691,11 +2691,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 			DRM_ERROR("amdgpu asic reset failed\n");
 	}
 
-	if (fbcon) {
-		console_lock();
+	if (fbcon)
 		amdgpu_fbdev_set_suspend(adev, 1);
-		console_unlock();
-	}
+
 	return 0;
 }
 
@@ -2784,9 +2782,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 			}
 			drm_modeset_unlock_all(dev);
 		}
-		console_lock();
 		amdgpu_fbdev_set_suspend(adev, 0);
-		console_unlock();
 	}
 
 	drm_kms_helper_poll_enable(dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
index d44b764..69c5d22 100644
@@ -373,8 +373,8 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev)
 void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state)
 {
 	if (adev->mode_info.rfbdev)
-		drm_fb_helper_set_suspend(&adev->mode_info.rfbdev->helper,
-			state);
+		drm_fb_helper_set_suspend_unlocked(&adev->mode_info.rfbdev->helper,
+						   state);
 }
 
 int amdgpu_fbdev_total_size(struct amdgpu_device *adev)
Signature · 6 lines
2.7.4

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

A message that is not in the archive (sent off-list or not yet received): 1532089848-31023-1-git-send-email-shirish.s-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#2 lore raw
Quoted 45 lines · Shirish S

This patch removes the usage of console_(un)lock by replacing drm_fb_helper_set_suspend() to drm_fb_helper_set_suspend_unlocked() which locks and unlocks the console instead of locking ourselves.

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c     | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -6
index 022c136..a759b74 100644
@@ -2691,11 +2691,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 			DRM_ERROR("amdgpu asic reset failed\n");
 	}
 
-	if (fbcon) {
-		console_lock();
+	if (fbcon)
 		amdgpu_fbdev_set_suspend(adev, 1);
-		console_unlock();
-	}
+
 	return 0;
 }
 
@@ -2784,9 +2782,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 			}
 			drm_modeset_unlock_all(dev);
 		}
-		console_lock();
 		amdgpu_fbdev_set_suspend(adev, 0);
-		console_unlock();
 	}
 
 	drm_kms_helper_poll_enable(dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index d44b764..69c5d22 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c void amdgpu_fbdev_fini(struct amdgpu_device *adev) · line 380

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
@@ -373,8 +373,8 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev)
 void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state)
 {
 	if (adev->mode_info.rfbdev)
-		drm_fb_helper_set_suspend(&adev->mode_info.rfbdev->helper,
-			state);
+		drm_fb_helper_set_suspend_unlocked(&adev->mode_info.rfbdev->helper,
+						   state);
 }
 
 int amdgpu_fbdev_total_size(struct amdgpu_device *adev)

Thanks for doing this, looks good.

Signature · 6 lines
Earthling Michel Dänzer               |               http://www.amd.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Reviewed-by
#3 lore raw
In reply to a message not in the archive
Quoted 6 lines · Shirish S

This patch removes the usage of console_(un)lock by replacing drm_fb_helper_set_suspend() to drm_fb_helper_set_suspend_unlocked() which locks and unlocks the console instead of locking ourselves.

Harry

Quoted 39 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 8 ++------
 drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c     | 4 ++--
 2 files changed, 4 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +2 -6
index 022c136..a759b74 100644
@@ -2691,11 +2691,9 @@ int amdgpu_device_suspend(struct drm_device *dev, bool suspend, bool fbcon)
 			DRM_ERROR("amdgpu asic reset failed\n");
 	}
 
-	if (fbcon) {
-		console_lock();
+	if (fbcon)
 		amdgpu_fbdev_set_suspend(adev, 1);
-		console_unlock();
-	}
+
 	return 0;
 }
 
@@ -2784,9 +2782,7 @@ int amdgpu_device_resume(struct drm_device *dev, bool resume, bool fbcon)
 			}
 			drm_modeset_unlock_all(dev);
 		}
-		console_lock();
 		amdgpu_fbdev_set_suspend(adev, 0);
-		console_unlock();
 	}
 
 	drm_kms_helper_poll_enable(dev);
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +0 -0
index d44b764..69c5d22 100644

drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c void amdgpu_fbdev_fini(struct amdgpu_device *adev) · line 380

Quoted 10 lines
drivers/gpu/drm/amd/amdgpu/amdgpu_fb.c +2 -2
@@ -373,8 +373,8 @@ void amdgpu_fbdev_fini(struct amdgpu_device *adev)
 void amdgpu_fbdev_set_suspend(struct amdgpu_device *adev, int state)
 {
 	if (adev->mode_info.rfbdev)
-		drm_fb_helper_set_suspend(&adev->mode_info.rfbdev->helper,
-			state);
+		drm_fb_helper_set_suspend_unlocked(&adev->mode_info.rfbdev->helper,
+						   state);
 }
 
 int amdgpu_fbdev_total_size(struct amdgpu_device *adev)

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