diff mbox

[2/8] acpi: Add evaluate to functons evaluating _DSM

Message ID 1432592573-13743-2-git-send-email-pierre.morrow@free.fr (mailing list archive)
State New, archived
Headers show

Commit Message

Pierre Moreau May 25, 2015, 10:22 p.m. UTC
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 <pierre.morrow@free.fr>
---
 drm/nouveau/nouveau_acpi.c | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

Comments

Samuel Pitoiset May 26, 2015, 8:01 a.m. UTC | #1
s/functons/functions in the commit message.

On 05/26/2015 12:22 AM, Pierre Moreau wrote:
> 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 <pierre.morrow@free.fr>
> ---
>   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);
>   
>   }
>
Dave Airlie May 28, 2015, 2:59 a.m. UTC | #2
On 26 May 2015 at 18:01, Samuel Pitoiset <samuel.pitoiset@gmail.com> wrote:
> s/functons/functions in the commit message.
>
>
> On 05/26/2015 12:22 AM, Pierre Moreau wrote:
>>
>> This makes it clearer when reading the function name, as well as following
>> the
>> names of the related ACPI function.
>>

Apart from Samuel's suggested fix,

Reviewed-by: Dave Airlie <airlied@redhat.com>
diff mbox

Patch

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);
 
 }