[PATCH v2 4/9] acpi: Allow evaluate_optimus_dsm to take NULL results

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Changes since v1:
* Fix check for result being not NULL in nouveau_evaluate_optimus_dsm

Signed-off-by: Pierre Moreau <pierre.morrow@xxxxxxx>
---
 drm/nouveau/nouveau_acpi.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drm/nouveau/nouveau_acpi.c b/drm/nouveau/nouveau_acpi.c
index 3f01067..01dbf1d 100644
--- a/drm/nouveau/nouveau_acpi.c
+++ b/drm/nouveau/nouveau_acpi.c
@@ -88,15 +88,14 @@ static int nouveau_evaluate_optimus_dsm(acpi_handle handle, int func, int arg, u
 	for (i = 0; i < 4; i++)
 		args_buff[i] = (arg >> i * 8) & 0xFF;
 
-	*result = 0;
 	obj = acpi_evaluate_dsm_typed(handle, nouveau_op_dsm_muid, nouveau_op_dsm_rid,
 				      func, &argv4, ACPI_TYPE_BUFFER);
 	if (!obj) {
 		acpi_handle_info(handle, "failed to evaluate _DSM\n");
 		return AE_ERROR;
 	} else {
-		if (obj->buffer.length == 4) {
-			*result |= obj->buffer.pointer[0];
+		if (result && obj->buffer.length == 4) {
+			*result  = obj->buffer.pointer[0];
 			*result |= (obj->buffer.pointer[1] << 8);
 			*result |= (obj->buffer.pointer[2] << 16);
 			*result |= (obj->buffer.pointer[3] << 24);
@@ -322,18 +321,17 @@ void nouveau_register_dsm_handler(void)
 /* Must be called for Optimus models before the card can be turned off */
 void nouveau_switcheroo_optimus_dsm(void)
 {
-	u32 result = 0;
 	if (!nouveau_dsm_priv.optimus_detected)
 		return;
 
 	nouveau_evaluate_optimus_dsm(nouveau_dsm_priv.dhandle,
 			             NOUVEAU_DSM_OPTIMUS_FLAGS,
-			             0x3, &result);
+			             0x3, NULL);
 
 	nouveau_evaluate_optimus_dsm(nouveau_dsm_priv.dhandle,
 			             NOUVEAU_DSM_OPTIMUS_CAPS,
 			             NOUVEAU_DSM_OPTIMUS_SET_POWERDOWN,
-			             &result);
+			             NULL);
 
 }
 
-- 
2.4.2

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux