From patchwork Mon May 25 22:22:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Moreau X-Patchwork-Id: 6477371 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C1B4F9F399 for ; Mon, 25 May 2015 22:21:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DCA58205EC for ; Mon, 25 May 2015 22:21:16 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id E7648205F2 for ; Mon, 25 May 2015 22:21:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 166736E473; Mon, 25 May 2015 15:21:15 -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 797506E2C6; Mon, 25 May 2015 15:21:13 -0700 (PDT) Received: from testlinux.localdomain (unknown [83.248.242.206]) (Authenticated sender: pierre.morrow) by smtp1-g21.free.fr (Postfix) with ESMTPSA id AC917940060; Tue, 26 May 2015 00:17:34 +0200 (CEST) From: Pierre Moreau To: nouveau@lists.freedesktop.org Subject: [PATCH 2/8] acpi: Add evaluate to functons evaluating _DSM Date: Tue, 26 May 2015 00:22:47 +0200 Message-Id: <1432592573-13743-2-git-send-email-pierre.morrow@free.fr> X-Mailer: git-send-email 2.4.1 In-Reply-To: <1432592573-13743-1-git-send-email-pierre.morrow@free.fr> References: <1432592573-13743-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 This makes it clearer when reading the function name, as well as following the names of the related ACPI function. Signed-off-by: Pierre Moreau Reviewed-by: Dave Airlie --- drm/nouveau/nouveau_acpi.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drm/nouveau/nouveau_acpi.c b/drm/nouveau/nouveau_acpi.c index 4a48e21..1f18018 100644 --- a/drm/nouveau/nouveau_acpi.c +++ b/drm/nouveau/nouveau_acpi.c @@ -71,7 +71,7 @@ static const char nouveau_op_dsm_muid[] = { 0xA7, 0x2B, 0x60, 0x42, 0xA6, 0xB5, 0xBE, 0xE0, }; -static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result) +static int nouveau_evaluate_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *result) { int i; union acpi_object *obj; @@ -118,7 +118,7 @@ static int nouveau_check_optimus_dsm(acpi_handle handle) * Function 0 returns a Buffer containing available functions. * The args parameter is ignored for function 0, so just put 0 in it */ - if (nouveau_optimus_dsm(handle, 0, 0, &result)) + if (nouveau_evaluate_optimus_dsm(handle, 0, 0, &result)) return 0; /* @@ -128,7 +128,7 @@ static int nouveau_check_optimus_dsm(acpi_handle handle) return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS); } -static int nouveau_mux_dsm(acpi_handle handle, int func, int arg) +static int nouveau_evaluate_mux_dsm(acpi_handle handle, int func, int arg) { int ret = 0; union acpi_object *obj; @@ -155,7 +155,7 @@ static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id) { mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_MUX_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0); mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_MUX_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0); - return nouveau_mux_dsm(handle, NOUVEAU_DSM_MUX_LED, mux_id); + return nouveau_evaluate_mux_dsm(handle, NOUVEAU_DSM_MUX_LED, mux_id); } static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switcheroo_state state) @@ -165,7 +165,7 @@ static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switchero arg = NOUVEAU_DSM_MUX_POWER_SPEED; else arg = NOUVEAU_DSM_MUX_POWER_STAMINA; - nouveau_mux_dsm(handle, NOUVEAU_DSM_MUX_POWER, arg); + nouveau_evaluate_mux_dsm(handle, NOUVEAU_DSM_MUX_POWER, arg); return 0; } @@ -233,8 +233,8 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev) if (retval & NOUVEAU_DSM_HAS_OPT) { uint32_t result; - nouveau_optimus_dsm(dhandle, NOUVEAU_DSM_OPTIMUS_CAPS, 0, - &result); + nouveau_evaluate_optimus_dsm(dhandle, NOUVEAU_DSM_OPTIMUS_CAPS, + 0, &result); dev_info(&pdev->dev, "optimus capabilities: %s, status %s%s\n", (result & OPTIMUS_ENABLED) ? "enabled" : "disabled", (result & OPTIMUS_DYNAMIC_PWR_CAP) ? "dynamic power, " : "", @@ -324,11 +324,14 @@ void nouveau_switcheroo_optimus_dsm(void) if (!nouveau_dsm_priv.optimus_detected) return; - nouveau_optimus_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_OPTIMUS_FLAGS, - 0x3, &result); + nouveau_evaluate_optimus_dsm(nouveau_dsm_priv.dhandle, + NOUVEAU_DSM_OPTIMUS_FLAGS, + 0x3, &result); - nouveau_optimus_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_OPTIMUS_CAPS, - NOUVEAU_DSM_OPTIMUS_SET_POWERDOWN, &result); + nouveau_evaluate_optimus_dsm(nouveau_dsm_priv.dhandle, + NOUVEAU_DSM_OPTIMUS_CAPS, + NOUVEAU_DSM_OPTIMUS_SET_POWERDOWN, + &result); }