public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Patrick Mochel <mochel@linux.intel.com>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org
Subject: Re: PATCH [1/3]: Provide generic backlight support in Asus ACPI driver
Date: Tue, 18 Apr 2006 09:11:00 -0700	[thread overview]
Message-ID: <20060418161100.GA31763@linux.intel.com> (raw)
In-Reply-To: <20060418082952.GA13811@srcf.ucam.org>

On Tue, Apr 18, 2006 at 09:29:52AM +0100, Matthew Garrett wrote:
> This allows Asus backlight control to be performed via 
> /sys/class/backlight. It does not currently remove the legacy /proc 
> interface.

Neat, though a few questions that apply to each of the three ACPI platform drivers..


> diff -urp drivers/acpi.bak/asus_acpi.c drivers/acpi/asus_acpi.c

> +static struct backlight_device *asus_backlight_device;
> +

Why is this dynamically allocated? If there is only one per driver, then the
register() function could take that as a parameter -- instead of passing various
variable to initialize it with -- and return an error. 

> -static int read_brightness(void)
> +static int read_brightness(struct backlight_device *bd)

It seems that you're always passing NULL to this. And, if you're not passing NULL,
aren't you always referencing the single global instance above? 

> -static void set_brightness(int value)
> +static int set_brightness(struct backlight_device *bd, int value)
>  {
>  	acpi_status status = 0;
>  
> +	value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
> +	/* 0 <= value <= 15 */

Is there something wrong with:

	if (value < 0)
		value = 0;
	else if (value > 15)
		value = 15;

? Or, could you just make the parameter an unsigned int and just keep the 2nd check? 

> -		value = (0 < value) ? ((15 < value) ? 15 : value) : 0;
> -		/* 0 <= value <= 15 */
> -		set_brightness(value);
> +		set_brightness(NULL,value);

There should be a space between parameters. 

> +	asus_backlight_device = backlight_device_register ("asus_bl", NULL,
> +							   &asusbl_data);
> +
> +	if (IS_ERR (asus_backlight_device)) {
> +		printk("Unable to register backlight\n");

Could you print the name of the driver? 

> +		acpi_bus_unregister_driver(&asus_hotk_driver);
> +		remove_proc_entry(PROC_ASUS, acpi_root_dir);

If the backlight fails to register, does it mean that these must also fail? 


Thanks,


	Patrick

  parent reply	other threads:[~2006-04-18 16:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-18  8:29 PATCH [1/3]: Provide generic backlight support in Asus ACPI driver Matthew Garrett
2006-04-18  8:30 ` PATCH [2/3]: Provide generic backlight support in IBM " Matthew Garrett
2006-04-18  8:32   ` PATCH [3/3]: Provide generic backlight support in Toshiba " Matthew Garrett
2006-04-18  9:18   ` PATCH [2/3]: Provide generic backlight support in IBM " Henrik Brix Andersen
2006-04-18  9:26     ` Matthew Garrett
2006-04-18 16:11 ` Patrick Mochel [this message]
2006-04-18 16:28   ` PATCH [1/3]: Provide generic backlight support in Asus " Matthew Garrett
2006-04-19 18:49   ` Matthew Garrett
2006-04-19 18:49     ` PATCH [2/3]: Provide generic backlight support in IBM " Matthew Garrett
2006-04-19 18:50       ` PATCH [3/3]: Provide generic backlight support in Toshiba " Matthew Garrett
2006-04-19 18:53     ` PATCH [1/3]: Provide generic backlight support in Asus " Patrick Mochel
2006-04-19 20:13     ` Henrik Brix Andersen
2006-04-19 20:25       ` Matthew Garrett

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=20060418161100.GA31763@linux.intel.com \
    --to=mochel@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox