From patchwork Thu May 28 06:40:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Moreau X-Patchwork-Id: 6496321 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 898ECC0020 for ; Thu, 28 May 2015 06:38:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C0D70204CF for ; Thu, 28 May 2015 06:38:09 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id D9433202EC for ; Thu, 28 May 2015 06:38:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C66526EB1B; Wed, 27 May 2015 23:38:07 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp1-g21.free.fr (smtp1-g21.free.fr [212.27.42.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6A8B06EB19; Wed, 27 May 2015 23:38:06 -0700 (PDT) Received: from testlinux.localdomain (unknown [83.248.242.206]) (Authenticated sender: pierre.morrow) by smtp1-g21.free.fr (Postfix) with ESMTPSA id 569A59400C4; Thu, 28 May 2015 08:34:22 +0200 (CEST) From: Pierre Moreau To: nouveau@lists.freedesktop.org Subject: [PATCH v2 4/9] acpi: Allow evaluate_optimus_dsm to take NULL results Date: Thu, 28 May 2015 08:40:44 +0200 Message-Id: <1432795249-4458-4-git-send-email-pierre.morrow@free.fr> X-Mailer: git-send-email 2.4.2 In-Reply-To: <1432795249-4458-1-git-send-email-pierre.morrow@free.fr> References: <1432795249-4458-1-git-send-email-pierre.morrow@free.fr> Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Changes since v1: * Fix check for result being not NULL in nouveau_evaluate_optimus_dsm Signed-off-by: Pierre Moreau --- 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); }