Linux ACPI
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: Yu Luming <luming.yu@gmail.com>
Cc: Andrew Morton <akpm@osdl.org>,
	len.brown@intel.com, Matt Domsch <Matt_Domsch@dell.com>,
	Alessandro Guido <alessandro.guido@gmail.com>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	jengelh@linux01.gwdg.de, gelma@gelma.net, ismail@pardus.org.tr,
	Richard Hughes <hughsient@gmail.com>
Subject: Re: [patch 3/6] backlight and output sysfs support for acpi video driver
Date: Thu, 2 Nov 2006 20:59:55 +0000	[thread overview]
Message-ID: <20061102205954.GB4887@ucw.cz> (raw)
In-Reply-To: <200611042118.08629.luming.yu@gmail.com>

Hi!

> backlight and output sysfs support for acpi video driver

Yes, using generic interfaces is always nice...

> @@ -482,6 +536,134 @@ acpi_video_bus_DOS(struct acpi_video_bus
>  	return status;
>  }
>  
> +
> +/*
> + * copy & paste some code for acpi_pci_data, acpi_pci_data_handler,acpi_pci_data
> + * from pci_bind.c
> + * To-do: write a new API: acpi_pci_get.
> + */

This comment only(?) serves to confuse me...

> +	pathname = kmalloc(ACPI_PATHNAME_MAX, GFP_KERNEL);
> +	if (!pathname)
> +		return -ENOMEM;
> +	memset(pathname, 0, ACPI_PATHNAME_MAX);

kzalloc()? (More than once in this file).

> +	buffer.length = ACPI_PATHNAME_MAX;
> +	buffer.pointer = pathname;
> +
> +	data = kmalloc(sizeof(struct acpi_pci_data), GFP_KERNEL);
> +	if (!data) {
> +		kfree(pathname);
> +		return NULL;
> +	}
> +	memset(data, 0, sizeof(struct acpi_pci_data));
> +
> +	acpi_get_name(device->handle, ACPI_FULL_PATHNAME, &buffer);
> +	printk(KERN_INFO PREFIX "finding PCI device [%s]...\n", pathname);
> +
> +	/*
> +	 * Segment & Bus
> +	 * -------------
> +	 * These are obtained via the parent device's ACPI-PCI context.
> +	 */
> +go_up:
> +	status = acpi_get_data(device->parent->handle, acpi_pci_data_handler,
> +			       (void **)&pdata);
> +	if (ACPI_FAILURE(status) || !pdata || !pdata->bus) {
> +		struct acpi_device *tmp_dev;
> +
> +		tmp_dev = device->parent;
> +		if (tmp_dev->parent && (tmp_dev->parent->handle != ACPI_ROOT_OBJECT)) {
> +			device = tmp_dev;
> +			goto go_up;
> +		}

Could we use plain old loop here?

> +	printk(KERN_INFO PREFIX "data->dev =%p", &data->dev);
> +	printk(KERN_INFO PREFIX "data->dev->dev =%p\n", &data->dev->dev);

I doubt this is useful info for non-debugging. dprintk?
>  
>  
> +	data = acpi_pci_get (device->video->device);
> +        if (!data || !(data->dev)) {

tabs vs. spaces... more than once in this file.

> +		printk(KERN_ERR PREFIX "acpi_video_device:no valid data from acpi_pci_get\n");
> +		return ;

return; looks more natural.

> @@ -1691,8 +1913,9 @@ static int acpi_video_bus_add(struct acp
>  	int result = 0;
>  	acpi_status status = 0;
>  	struct acpi_video_bus *video = NULL;
> +        char proc_dir_name[32];
>  
> -
> +	memset(proc_dir_name, 0, 32);

What about '= { 0, };', instead?

						Pavel
-- 
Thanks for all the (sleeping) penguins.

  reply	other threads:[~2006-11-02 20:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-02 13:18 [patch 3/6] backlight and output sysfs support for acpi video driver Yu Luming
2006-11-02 20:59 ` Pavel Machek [this message]
  -- strict thread matches above, loose matches on Subject: below --
2006-11-02 13:19 Yu Luming

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=20061102205954.GB4887@ucw.cz \
    --to=pavel@ucw.cz \
    --cc=Matt_Domsch@dell.com \
    --cc=akpm@osdl.org \
    --cc=alessandro.guido@gmail.com \
    --cc=gelma@gelma.net \
    --cc=hughsient@gmail.com \
    --cc=ismail@pardus.org.tr \
    --cc=jengelh@linux01.gwdg.de \
    --cc=len.brown@intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luming.yu@gmail.com \
    /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