public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Renninger <trenn@suse.de>
To: Shaohua Li <shaohua.li@intel.com>
Cc: linux acpi <linux-acpi@vger.kernel.org>,
	Len Brown <lenb@kernel.org>, Andi Kleen <andi@firstfloor.org>,
	Henrique de Moraes Holschuh <hmh@hmh.eng.br>,
	Holger Macht <hmacht@suse.de>, mjg59 <mjg59@srcf.ucam.org>,
	Tejun Heo <htejun@gmail.com>
Subject: Re: [patch 4/11]makeing dock driver supports bay and battery hotplug
Date: Thu, 18 Sep 2008 19:10:02 +0200	[thread overview]
Message-ID: <200809181910.03573.trenn@suse.de> (raw)
In-Reply-To: <1219889038.29375.29.camel@sli10-desk.sh.intel.com>

Sorry for the late reply...


On Thursday 28 August 2008 04:03:58 Shaohua Li wrote:
> Making dock driver supports bay and battery hotplug. They are all
> regarded as dock, and unified handled.
>
> Signed-off-by: Shaohua Li <shaohua.li@intel.com>
> ---
...
> +
> +static int is_battery(acpi_handle handle)
> +{
> +	struct acpi_device_info *info;
> +	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
> +	int ret = 1;
> +
> +	if (!ACPI_SUCCESS(acpi_get_object_info(handle, &buffer)))
> +		return 0;
> +	info = buffer.pointer;
> +	if (!(info->valid & ACPI_VALID_HID))
> +		ret = 0;
> +	else
> +		ret = !strcmp("PNP0C0A", info->hardware_id.value);
> +
> +	kfree(buffer.pointer);
Better get the device and then use:
const struct acpi_device_id battery_device_ids[] = {
        {"PNP0C0A", 0},
        {"", 0},
};
acpi_match_device_ids(struct acpi_device *device, battery_device_ids);
No need to allocate memory. This also matches batteries where the ID might be 
hidden in the CID list.
...

Something general:
I do not like the idea of this approach.
Battery and ATA device do get an eject notification?
Why can't they handle things themselves?
What is the gain to make battery and ata "dock" capable devices?
What if a PCI(e) device or whatever other device is also connected to the 
docking station. Do we want to add all devices attached to a dock station 
statically?

Would it make sense to add (if notifications are sent to these even this 
should not be needed):
  .eject
  .dock
functions. The dock driver can then go down the tree and call all children's 
eject functions.

I wonder how this can be solved in a more generic way.

Also this patchset mixes up sever fixes and dock design changes patches.
It would be great if the fixes can just go into test, not sure about the 
design change...

    Thomas

  reply	other threads:[~2008-09-18 17:10 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28  2:03 [patch 4/11]makeing dock driver supports bay and battery hotplug Shaohua Li
2008-09-18 17:10 ` Thomas Renninger [this message]
2008-09-18 19:16   ` Thomas Renninger
2008-09-22  1:24     ` Shaohua Li
2008-09-22  9:17       ` Thomas Renninger
2008-09-22 10:58         ` Holger Macht
  -- strict thread matches above, loose matches on Subject: below --
2008-08-27  3:14 Shaohua Li
2008-08-27 23:13 ` Andi Kleen

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=200809181910.03573.trenn@suse.de \
    --to=trenn@suse.de \
    --cc=andi@firstfloor.org \
    --cc=hmacht@suse.de \
    --cc=hmh@hmh.eng.br \
    --cc=htejun@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=mjg59@srcf.ucam.org \
    --cc=shaohua.li@intel.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