All of lore.kernel.org
 help / color / mirror / Atom feed
From: Len Brown <lenb@kernel.org>
To: Alexey Starikovskiy <astarikovskiy@suse.de>
Cc: Thomas Tuttle <linux-kernel@ttuttle.net>, linux-acpi@vger.kernel.org
Subject: Re: [PATCH 1/2] [PATCH] ACPI: video: Don't call absent methods
Date: Mon, 3 Sep 2007 10:49:27 -0400	[thread overview]
Message-ID: <200709031049.28282.lenb@kernel.org> (raw)
In-Reply-To: <20070903122958.20082.6843.stgit@z61m>

Is it a good idea to return AE_OK when no operation was actually performed?

-Len

On Monday 03 September 2007 08:29, Alexey Starikovskiy wrote:
> Signed-off-by: Ryan May <rmay@ou.edu>
> Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
> ---
> 
>  drivers/acpi/video.c |   18 ++++++++++--------
>  1 files changed, 10 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
> index 3c9bb85..83aa41c 100644
> --- a/drivers/acpi/video.c
> +++ b/drivers/acpi/video.c
> @@ -409,14 +409,16 @@ acpi_video_device_lcd_query_levels(struct acpi_video_device *device,
>  static int
>  acpi_video_device_lcd_set_level(struct acpi_video_device *device, int level)
>  {
> -	int status;
> +	int status = AE_OK;
>  	union acpi_object arg0 = { ACPI_TYPE_INTEGER };
>  	struct acpi_object_list args = { 1, &arg0 };
>  
>  
>  	arg0.integer.value = level;
> -	status = acpi_evaluate_object(device->dev->handle, "_BCM", &args, NULL);
> -
> +	if (device->cap._BCM)
> +		status = acpi_evaluate_object(device->dev->handle, "_BCM",
> +					      &args, NULL);
> +	device->brightness->curr = level;
>  	printk(KERN_DEBUG "set_level status: %x\n", status);
>  	return status;
>  }
> @@ -425,11 +427,11 @@ static int
>  acpi_video_device_lcd_get_level_current(struct acpi_video_device *device,
>  					unsigned long *level)
>  {
> -	int status;
> -
> -	status = acpi_evaluate_integer(device->dev->handle, "_BQC", NULL, level);
> -
> -	return status;
> +	if (device->cap._BQC)
> +		return acpi_evaluate_integer(device->dev->handle, "_BQC", NULL,
> +					     level);
> +	*level = device->brightness->curr;
> +	return AE_OK;
>  }
>  
>  static int
> 
> -
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

  parent reply	other threads:[~2007-09-03 14:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-03 12:29 [PATCH 1/2] [PATCH] ACPI: video: Don't call absent methods Alexey Starikovskiy
2007-09-03 12:30 ` [PATCH 2/2] ACPI: VIDEO: Adjust current level to closest available one Alexey Starikovskiy
2007-09-03 14:49 ` Len Brown [this message]
2007-09-03 15:15   ` [PATCH 1/2] [PATCH] ACPI: video: Don't call absent methods Alexey Starikovskiy
2007-09-14 14:01 ` Ryan May
2007-10-02 13:22 ` Ryan May
2007-10-02 15:52   ` Alexey Starikovskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200709031049.28282.lenb@kernel.org \
    --to=lenb@kernel.org \
    --cc=astarikovskiy@suse.de \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@ttuttle.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.