From: Andrew Morton <akpm@linux-foundation.org>
To: Matthew Garrett <mjg59@srcf.ucam.org>
Cc: linux-input@vger.kernel.org, linux-acpi@vger.kernel.org,
linux-kernel@vger.kernel.org, carlos@strangeworlds.co.uk
Subject: Re: RESEND: [PATCH 3/3] Misc: Add HP WMI laptop extras driver
Date: Wed, 28 May 2008 22:42:00 -0700 [thread overview]
Message-ID: <20080528224200.0c740819.akpm@linux-foundation.org> (raw)
In-Reply-To: <20080528132900.GC32646@srcf.ucam.org>
On Wed, 28 May 2008 14:34:25 +0100 Matthew Garrett <mjg59@srcf.ucam.org> wrote:
> This driver adds support for reading and configuring certain information
> on modern HP laptops with WMI BIOS interfaces. It supports enabling and
> disabling the ambient light sensor, querying attached displays and hard
> drive temperature, sending events on docking and querying the state of
> the dock and toggling the state of the wifi, bluetooth and wwan hardware
> via rfkill. It also makes the little "(i)" button work on machines that
> send that via WMI rather than via the keyboard controller.
>
> ...
>
> --- /dev/null
> +++ b/drivers/misc/hp-wmi.c
I see no Kconfig or Makefile updates.
>
> ...
>
> +static struct key_entry hp_wmi_keymap[] = {
> + {KE_SW, 0x01, SW_DOCK},
> + {KE_KEY, 0x02, KEY_BRIGHTNESSUP},
> + {KE_KEY, 0x03, KEY_BRIGHTNESSDOWN},
> + {KE_KEY, 0x04, KEY_HELP},
> + {KE_END, 0}
> +};
Could be made const. hp_wmi_input_setup() already honours that,
others will need tweaks.
> +static struct input_dev *hp_wmi_input_dev;
> +static struct platform_device *hp_wmi_platform_dev;
> +
> +static struct rfkill *wifi_rfkill;
> +static struct rfkill *bluetooth_rfkill;
> +static struct rfkill *wwan_rfkill;
It will be interesting to see the Kconfig rules for this driver..
> +static struct platform_driver hp_wmi_driver = {
> + .driver = {
> + .name = "hp-wmi",
> + .owner = THIS_MODULE,
> + },
.driver = {
.name = "hp-wmi",
.owner = THIS_MODULE,
},
would be more conventional layout.
> + .probe = hp_wmi_bios_setup,
> + .remove = hp_wmi_bios_remove,
> +};
> +
> +static int hp_wmi_perform_query(int query, int write, int value)
> +{
> + struct acpi_buffer input, output = { ACPI_ALLOCATE_BUFFER, NULL };
The NULL isn't strictly needed.
> + struct bios_args args;
> + struct bios_return bios_return;
> + acpi_status status;
> + union acpi_object *obj;
> +
> + args.signature = 0x55434553;
> + args.command = write ? 0x2 : 0x1;
> + args.commandtype = query;
> + args.datasize = write ? 0x4 : 0;
> + args.data = value;
Could have populated args with `= { .name = value, ... }'?
> + input.length = sizeof(struct bios_args);
> + input.pointer = &args;
And `input', perhaps.
> + status = wmi_evaluate_method(HPWMI_BIOS_GUID, 0, 0x3, &input, &output);
> +
> + obj = output.pointer;
> +
> + if (!obj || obj->type != ACPI_TYPE_BUFFER)
> + return -EINVAL;
> +
> + bios_return = *((struct bios_return *)obj->buffer.pointer);
> + if (bios_return.return_code > 0)
> + return bios_return.return_code * -1;
> + else
> + return bios_return.value;
> +}
> +
>
> ...
>
> +static int hp_wmi_setkeycode(struct input_dev *dev, int scancode, int keycode)
> +{
> + struct key_entry *key;
> +
> + int old_keycode;
Unneeded newline.
> + if (keycode < 0 || keycode > KEY_MAX)
> + return -EINVAL;
> +
> + key = hp_wmi_get_entry_by_scancode(scancode);
> + if (key && key->type == KE_KEY) {
> + old_keycode = key->keycode;
> + key->keycode = keycode;
> + set_bit(keycode, dev->keybit);
> + if (!hp_wmi_get_entry_by_keycode(old_keycode))
> + clear_bit(old_keycode, dev->keybit);
> + return 0;
> + }
> +
> + return -EINVAL;
> +}
> +
>
> ...
>
> +static int __init hp_wmi_bios_setup(struct platform_device *device)
> +{
> + device_create_file(&device->dev, &dev_attr_display);
> + device_create_file(&device->dev, &dev_attr_hddtemp);
> + device_create_file(&device->dev, &dev_attr_als);
> + device_create_file(&device->dev, &dev_attr_dock);
wham, four new warnings.
Please check and suitably handle errors.
next prev parent reply other threads:[~2008-05-29 5:42 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-23 16:09 [PATCH] Add switch for dock events Matthew Garrett
2008-05-24 1:23 ` Andrew Morton
2008-05-28 13:06 ` [PATCH 1/3] Input: " Matthew Garrett
2008-05-28 13:21 ` [PATCH 2/3] ACPI: Send switch event on " Matthew Garrett
2008-05-28 13:29 ` [PATCH 3/3] Misc: Add HP WMI laptop extras driver Matthew Garrett
2008-05-29 5:42 ` Andrew Morton [this message]
2008-05-29 8:07 ` RESEND: " Matthew Garrett
2008-05-29 8:23 ` Matthew Garrett
2008-06-02 23:30 ` Andrew Morton
2008-06-07 10:00 ` Carlos Corbacho
2008-05-29 5:32 ` RESEND: [PATCH 2/3] ACPI: Send switch event on dock events Andrew Morton
2008-05-29 8:15 ` Matthew Garrett
2008-05-29 8:22 ` Version 2: " Matthew Garrett
2008-06-09 9:48 ` Andrew Morton
2008-05-29 8:20 ` Version 2: [PATCH 1/3] Input: Add switch for " 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=20080528224200.0c740819.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=carlos@strangeworlds.co.uk \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-input@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;
as well as URLs for NNTP newsgroup(s).